miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Showing the number of topics in the header

Author tom322
Registered
#1 | Posted: 10 Aug 2012 17:44 
I wanted to include the number of topics of a logged user in the main_header.tpl. I tried {$user_num_topics} but it didn't work (the value was always '0'). Is there a simple way to do it (other than an extra DB query)? Maybe some row[x] or similar ;). Thanks.

Author Paul
Lead Developer
#2 | Posted: 10 Aug 2012 18:25 | Edited by: Paul 
main_header.tpl? Well, not sure if I know the template of such filename in miniBB :) I suppose, you mean templates/main_header.html...

If so, I'm also afraid there is no simple way to get the number of user topics in the default version.
You may try to modify bb_cookie.php for that.

Look up for the following string:

$GLOBALS['dbUserSheme']['num_posts'][1]

It should be extended to have the other field after it:

$GLOBALS['dbUserSheme']['num_posts'][1].', '.$GLOBALS['dbUserSheme']['num_topics'][1]

Then where it says

$GLOBALS['user_num_posts']=$row[X];

add the following:

$GLOBALS['user_num_topics']=$row[X+1];

for example, for the admin procedure, it should look like:

$GLOBALS['user_num_topics']=$row[3];

for regular users procedure, it may look by default like:

$GLOBALS['user_num_topics']=$row[7];

Only after you have updated this file, you may refer to the topics amount in any template as to:

{$user_num_topics}

Author tom322
Registered
#3 | Posted: 10 Aug 2012 18:31 | Edited by: tom322 
Yes, sorry - that's what happens what posting without coffee, I meant main_header.html ;).

Not the first time something seemed simple is not simple at all (except for you ;). I'll check it out and if problems will report here, thank you!

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Showing the number of topics in the header Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB