miniBB ®

miniBB

®
Support Forums
  
 · Start · Sign in · Register · Search · Statistics · File Bank · Manual ·
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Showing the number of topics in the header

 
Author tom322
Active Member
#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 Lead Developer
#2 · Posted: 10 Aug 2012 18:25
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
Active Member
#3 · Posted: 10 Aug 2012 18:31
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
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Did you know that you may be allowed to hide miniBB credits and remove miniBB's copyright notice?