Danigoodw
Danigoodw

Reputation: 379

Joomla! K2 - How to fetch Author Item Count for user page?

I have several authors on my website and each of them has a page of his own with his image, description and a list of all his items. I would like to add an "Item Counter" to their pages, so the page will look like this:

author name, number of posts -> author description -> author items.

The only thing i miss here is the number of posts by the author.

Thank you so much for the answers!

Upvotes: 0

Views: 704

Answers (1)

itoctopus
itoctopus

Reputation: 4271

You will need to slightly modify the K2 view (we did this to one of our clients). You will need to create a query that resembles the following in the view:

SELECT count(*) FROM #__k2_items WHERE authorid='id';

Now you should pass the result of that query to the template (using the assignRef function on the $this object. That's it!

Note: not sure about the field name authorid, I'm sure it's something else but I can't remember it on top of my head.

Upvotes: 0

Related Questions