2012-10-18, 05:57 AM
2012-10-18, 06:08 AM
Use this variable for username:
{$mybb->user['username']}
For post counts of the user:
{$mybb->user['postnum']}
{$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
example
bob 17/10/2012 39 posts
2012-10-18, 06:21 AM
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?>
<?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.
<setvar user>get_user('USERID')</setvar>
<if $tplvars['user']['uid'] then>
Username: <func htmlspecialchars_uni>$tplvars['user']['username']</func>
Post Count: <?=my_number_format($tplvars['user'][''postnum''])?>
</if>
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.
2012-10-18, 08:46 AM
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.
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.