Hotaru Docs


Function Reference/h currentuser

Role of $h->currentUser

$h->currentUser is a class defined in the core code of Hotaru that gives you access to the properties associated with the currently logged on user.

Methods and Properties

This is the formal documentation of $h->currentUser. You should not need to alter the properties directly, but instead can use the methods to interact with them. Also see Interacting with $h->currentUser for useful functions that avoid the need to change the code for this class.



Interacting with $h->currentUser

most of the time you can return the information you want without actually dealing with the class internals and globals variables. There are many functions you can call that will enable you to get the information you need.

Example Code

Here are a number of simple example code using the $h->currentUser class.

To return the logged in user's name somewhere in the page:

if ($h->currentUser->loggedIn) { echo $h->currentUser->name; }

In a template this may look something like this, perhaps in the header section:

if ($h->currentUser->loggedIn) {
$id = $h->lang["user_man_username"];
echo "<li>Welcome " . $h->currentUser->name . "    ~   </li>";
} ?>