Calculating number of user comments and posts
-
Hi There,
I’ve been messing around with this code for ages and don’t seem any closer then I was before I started.
Essentially, within the comments.php loop, I am attempting to calculate the total number of posts and comments made by each user who are listed in each thread. I am not looking to calculate the number of comments in the thread, but rather the total number of comments and new posts created in total. So for example, I’d like to be able to say
User : Foo
Total Posts : =sum(all posts and comments ever made).
On : https://www.reviewrecruiter.com.au/members/forum-chat?view=blogs
So – on the comments section, I’d like to have Total Posts : (comments + posts)The process I’ve been following is to grab the comment_author() but this returns null if the user has not entered in their full name. In my case, I am not allowing users to enter firstname and surname as part of the registration process, rather just their logon name. However, this returns anonymous if the user has not filled in these details.
Even when using the get_user_by_email() it requires the login name which again I can’t seem to locate.
Does anyone have any ideas or suggestions on how to do this?
- The topic ‘Calculating number of user comments and posts’ is closed to new replies.