Matteo96:
Also just after the rank I would like to display: Post Count, Registration Date and Location.
Here's the question is not about the ranks, but how to display different values based on user's profile.
At first, you have to define them all in
$userInfoInPosts array of
setup_options.php. Example from miniBB demo:
$userInfoInPosts=array('user_custom1', 'user_custom2', $dbUserSheme['num_posts'][1], 'user_custom3', $dbUserSheme['username'][1], 'user_custompics');
So, this could be done basing on what's provided
$dbUserSheme set above, or just straight DB table names.
Then in
bb_plugins.php, you have to define a standalone function for each value in this array, naming it
parseUserInfo_FIELDNAME($val), where FIELDNAME stands for a field name.
$val is what this function gets from the topic displaying script, and you can operate it in any way you want. On the topic page, there will be displayed what this function returns back. Then in
templates/main_posts.html, for each field you have to paste:
{$userInfo_FIELDNAME[$poster_id]}.
I will show your case on easiest examples:
— setup_options.php:
$userInfoInPosts=array($dbUserSheme['num_posts'][1], $dbUserDate, $dbUserSheme['user_from'][1]); //paste this below the $dbUserSheme definition
— bb_plugins.php:
function parseUserInfo_user_regdate($val){
return 'Registered on: '.convert_date($val).'<br>';
//paste in main_posts.html: {$userInfo_user_regdate[$poster_id]}
}
function parseUserInfo_user_from($val){
if($val!='') return 'From: '.$val.'<br>';
else return '';
//paste in main_posts.html: {$userInfo_user_user_from[$poster_id]}
}
And if you have installed the Ranks add-on, it already generates values based on the
num_posts field, so — this function has to be extended, but NOT specified twice (this will lead to the duplication error in PHP). Here's an example on the default function:
function parseUserInfo_num_posts($val){
if($GLOBALS['action']=='userinfo') return $val-$GLOBALS['row'][10];
elseif($GLOBALS['cols'][0]!=1 and !isset($GLOBALS['userRanks'][$GLOBALS['cols'][0]])){
//Put the amount of posts (from...to) and the special rank. You could also put stars (*****) instead of a word, or graphics with <img> tag and pre-created images.
if($val>=1 and $val<=10) $rank='Starter';
elseif($val>10 and $val<=30) $rank='Expert';
elseif($val>30 and $val<=1000) $rank='Profy';
elseif($val>1000 and $val<=1500) $rank='Rich';
elseif($val>1500) $rank='Upscale';
else $rank='';
return ' '.$rank.'<br>Posts: '.$val;
}
}
I didn't try it all — feel free to post here if something doesn't work.