echouser (function)

Last updated: Fri, Jan 13, 2023 7:27 am
Return to Knowledgebase


A flexible function to echo out some type of user name



Version Information

First Introduced v3.0.0


# Parameter Data Type Required Description
1 $id int Yes The id of the user whose name you would like to echo
2 $echoType = null int Yes Override the default echo user formatting
3 $return = false bool Yes Optionally, you can return the user information instead of using echo to send it to the screen.


Data Type Description of Returned Data
string Whether echoed or returned as a variable, you will get a string back.



Further Documentation:

This function has a setting on the Admin Dashboard it is located on
Dashboard->settings->general->User Settings
You can choose between
Fname, Lname (Option 0)
Username (Option 1)
Username (Fname Lname) (Option 2)
Username (Fname) (Option 3)

The way this function works, if you change that setting on the dashboard, echouser will change how it displays usernames everywhere that function is called on your site
Example outputs would be
Dan Hoover [Fname Lname]
Admin [Username]
Admin (Dan Hoover) [Username (Fname Lname)]
Admin (Dan) [Username (Fname)]

If you have specified option 0 (Fname, Lname) on the dashboard, you can still override this to username by calling

echouser($user_id, 1);