Display posts count in User Info header

Started by MrCreatoR, September 18, 2009, 06:53:55 PM

Previous topic - Next topic

MrCreatoR

Hi,

I am trying to display a total posts count in the forum's header, but i can't find out what is the variable (option?) that contain this info.

Here is what i am trying (in «Themes/default/index.template.php»):

Quoteecho '
<li> <strong>'
, $txt['posts'], ':</strong> ', $context['user']['posts'], '</li>';

but the counter is not shown. I can see in Display.template.php this used in posts:
Quote$message['member']['posts']

but it's also not good for the header.

Any ideas?

TheDisturbedOne

I think that is because one of the functions for number of posts isn't being called in the other pages.  If you put that code in, and you view a topic, will it show the number of posts in the header?

MrCreatoR

Quote from: TheDisturbedOne on September 19, 2009, 02:25:06 PM
I think that is because one of the functions for number of posts isn't being called in the other pages.  If you put that code in, and you view a topic, will it show the number of posts in the header?
Yes, it's shows. But i need it on all pages, what i can use for it? if i need some function in «index.template.php», then what is that function?


metallica48423

$user_info['posts']

If it doesn't load, make sure you have $user_info globalled inside whichever function you're editing to display it by adding $user info to the global declaration at the top of the function.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool


MrCreatoR

Quote from: metallica48423 on September 19, 2009, 03:40:34 PM
$user_info['posts']

If it doesn't load, make sure you have $user_info globalled inside whichever function you're editing to display it by adding $user info to the global declaration at the top of the function.
Thank you, it's working!
And thanks to TheDisturbedOne for the help.

Just one more small-related question: can we do the same for karma? i have karma description mod installed, and i want to display the karma in the same place with the messages count:
Quote if ($modSettings['karmaMode'] == 1)
echo $modSettings['karma']['good'] - $modSettings['karma']['bad'];
elseif ($modSettings['karmaMode'] == 2)
echo '+', $modSettings['karma']['good'], '/-', $modSettings['karma']['bad'];
echo '</li>';

$modSettings is declared at the begining of that function, but it's not displayed :(

TheDisturbedOne


MrCreatoR

Quote from: TheDisturbedOne on September 19, 2009, 04:20:13 PM
What if you remove the "echo '</li>';"
The same, this </li> is closed after earlier open list by <li> :)

I tried just the «echo $modSettings['karma']['good'] - $modSettings['karma']['bad'];», but it's resulting a 0.

MrCreatoR


MrCreatoR

Anyone? Or it's just impossible to add the karma info there?

Advertisement: