Recent Topics

1 Oct 04, 2014 08:50    

Hi, i need some help
i wanna add the function of profile page: "$User->get_num_posts" to the main page
that every one can see how much post he have i try to use this:
$current_User->get_num_posts
in: index.main.php
but that didnt work.

i need that every user can see how much post he have

help?
Thanks.

2 Oct 09, 2014 07:32

Hi @denis012,

As you referred, get_num_posts is the right way to get the count of posts made by a particular user, but it is a method and it has to be invoked as a function (with a pair of parenthesis at the end of the statement).

Example:

echo T_('Number of posts') . ' ' . $current_User->get_num_posts();

I tested by adding that statement at the beginning of the _sidebar.inc.php file included in the evoPress skins, and I got the result shown in the screenshot.

Note: you can also use $current_User->get_reputation_posts() to show the percentage of public posts.

Regards!

3 Oct 09, 2014 09:30

Ok its worked :)
thank you so much!

4 Oct 11, 2014 08:33

I checked this again and an error will be displayed if you are not logged in. So you should do somehting like this:


	if ( isset($current_User) )
	{ 
		echo T_('Number of posts') . ' ' . $current_User->get_num_posts();
	}

MG


Form is loading...