2012-10-18, 05:57 AM
hi
how do i retrieve the username and post count and show it in the header
kenny
how do i retrieve the username and post count and show it in the header
kenny
display a username in header
|
2012-10-18, 05:57 AM
hi
how do i retrieve the username and post count and show it in the header kenny
Use this variable for username:
{$mybb->user['username']} For post counts of the user: {$mybb->user['postnum']}
2012-10-18, 06:12 AM
sorry should have said a specific user
2012-10-18, 06:13 AM
Which user? How do you plan to choose such user?
2012-10-18, 06:20 AM
i know the user i want to display and it will not change i also want to show the users last visit and post count
example bob 17/10/2012 39 posts
Something like this?
<?php define("IN_MYBB", 1); require ('global.php'); // be sure that u r running this php-code in the same // directory of global.php, or else change the path. $user = get_user(SPECIFIC_UID); $name = $user['username']; // grab other info in same pattern ?> <?echo $name?>
2012-10-18, 06:36 AM
You probably can use something like Template Conditionals. header template:
But, if the desired information is not supposed to be frequently changed, then probably using some kind of cache method, or even static information could be better when it comes to performance.
I guess you will have to get the data from the database...
You probably will need a plugin, since, AFAIK, we can't use PHP in templates It will be a simple plugin though, just to grab the data from the database and display it in the header. |
« Next Oldest | Next Newest »
|