Support Forum

Template Tag for Showing Posts By User

RC Ryan Collins
Ryan Collins
Member

Hey guys,

Is there a template tag for displaying the topics an individual user has posted to and/or started?

I was thinking this could be useful for my users. 

5 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

This one sounds like it should do this: https://simple-press.com/documentation/codex/plugins/our-plugins/the-template-tags-plugin/template-tag-author-posts/

Afraid once again I have never personally tried this one!

For a complete list see: https://simple-press.com/documentation/codex/plugins/our-plugins/the-template-tags-plugin/

RC Ryan Collins
Ryan Collins
Member

Thank you for the reply.

Will this template tag automatically display the posts, specific to each user, upon that user logging in?

For example, will user 1 when logged in, automatically see his own posts if I place this template tag on a page on my website?

Then user 2 when logged in and viewing the same page, will automatically see his own posts?

I have around 900 users and I’m hoping to create a page on my website where each user can see all the topics he has posted to and/or started.

Not sure if it’s possible, thanks for the insight!

MP Mr Papa
Mr Papa
Member

per the codex article Andy linked to for you, yes…  

the third argument to the tag is the user id…  So you will want to set it up for the current user… something like:

global $current_user;
sp_AuthorPostsTag('authorId='.$current_user->ID);

for non logged in users, nothing will b shown… 

RC Ryan Collins
Ryan Collins
Member

Very cool, thank you.

I will give these template tags a try this week, and will report back with how things go.