Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.
profile_link
With the new User Management System in PHP-Fusion v7.01, more user statues were added; two of those was the anonymous and deactivated user status. This required a new way of displaying the user profile links, which resulted in the profile_link() function.

Here the name of the user will be anonymous unless an Administrator with user privileges is viewing the link. Also the link can be set to members only from the Administration panel and the names will be non-clickable for guests.

profile_link

Quote

profile_link( integer $user_id, string $user_name, integer $user_status [ , string $class ] )


Parameters
user_id
The User ID of the user which is displayed

user_name
The User Name of the user which is displayed

user_status
The user's status; 0 = banned, 1 = active etc.

class
CSS class for the profile link

Return Values
Returns a link to the user's account along with the user name correctly depending on the user's status.

Basic profile_link() usage example
Code
<?php
// <a href='profile.php?lookup=1'>Administrator</a>
echo profile_link("1", "Administrator", "0");
 
// <a href='profile.php?lookup=1' class='my-class'>Administrator</a>
echo profile_link("1", "Administrator", "0", "my-class");
 
// Cancelled User Account (status = 5)
// <a href='profile.php?lookup=2'>Anonymous User</a>
echo profile_link("2", "Testuser", "5");
 
// Anonymized User (status = 6)
// <a href='profile.php?lookup=2'>Anonymous User</a>
echo profile_link("2", "Testuser", "6");
?>
Shows how the function behaves when the different parameters are altered.

Advanced profile_link() usage example
Code
<?php
$result = dbquery("SELECT user_id, user_name, user_status FROM ".DB_USERS." ");
 
while ($data = dbarray($result)) {
 echo profile_link($data['user_id'], $data['user_name'], $data['user_status']);
 echo "<br />";
}
?>

Here we lists all users and displays the name using the profile_link() function.

Changelog
7.01.00 - Function added to PHP-Fusion

Notes
User names will not be hidden for Administrators with users privileges even though the user is anonymized or cancelled.


See also …


References