Template Conditionals
If you are using the Template Conditionals plugin, it is required to add the helper functions to the list of allowed functions. This step is not required if you use the PHP in Templates plugin.
- Open file
/var/www/ougc.network/html/inc/plugins/phptpl_allowed_funcs.txt
- At the end of the file, find:
; yaml?
- Add after:
ougcDisplayNameGet ougcDisplayNameGetByUsername
Build Display Names from Templates
Use any of the following tags to print out the desired display name:
<?=ougcDisplayNameGet((int) $userID)?>
<?=ougcDisplayNameGetByUsername((string) $userName)?>
For example, edit the
forumbit_depth1_forum_lastpost
to build the last poster display name:<?=ougcDisplayNameGet((int) $lastpost_data['lastposteruid'])?>
Each helper function accepts at least 2 boolean additional paramethers,
$formatName
and $profileLink
respectively. The default for both is true
.<?=ougcDisplayNameGet((int) $userID, (bool) $formatName, (bool) $profileLink)?>
<?=ougcDisplayNameGetByUsername((string) $userName, (bool) $formatName, (bool) $profileLink)?>
The following will build the display name with no group format nor profile link:
<?=ougcDisplayNameGet((int) $lastpost_data['lastposteruid'], false, false)?>
It is recommended to use
ougcDisplayNameGet()
over ougcDisplayNameGetByUsername()
when possible.Regards.