Support Forum

Add last forum posts to author.php

CE cwwcwi0ecnuwijcowecwreiovuejwcko
cwwcwi0ecnuwijcowecwreiovuejwcko
Member

I have created a custom author.php page in WordPress for displaying user profile pages when clicked on a username. Currently I’m using two buttons to link to “forum threads started by this user” and “forum posts the user has posted in” (the same buttons shown beneath the search option from simple-press).

Actually it would be much nicer if I can directly list the users last forum posts on their profile instead of a link to them. Example:

Author Name
– Name, Info, Profile information bla bla bla etc.
– List of 5 recent posts made by user (if is author).
– List of 5 recent comments made by user
– 2 buttons to forum threads and topics (which I would like to replace by a list of 5 recent topics).

So how can I directly display those last xx posts (outside simple-press) on the user profile page.

6 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

I would start here: http://codex.simple-press.com/codex/plugins/our-plugins/the-template-tags-plugin/template-tag-author-posts/

CE cwwcwi0ecnuwijcowecwreiovuejwcko
cwwcwi0ecnuwijcowecwreiovuejwcko
Member

w00t, that was simple. Only got a few things..

– listTags attribute is not working (I don’t get a ul li output, only div). Tried setting it manually to true, but no luck.
– Add a separate class to the date field.
– Before date is displayed, there is a break <br/> echoed. How can I remove that without modifying core? I would like to display it all on one line.

Suggestion: Maybe instead of predefining variables in core, you should enable user variables like. $before, $after etc. So I can manually add <ul class=”xxxx”> hardcoded to my template and add <li> and </li> to before and after in the sp_AuthorPostsTag function.

MP Mr Papa
Mr Papa
Member

I will check on the list tags issue…

most of the template tags were copied over from 4.x versions…  we have updated the most often used ones to offer more options via template tag arguments like the core template functions first… we do plan to eventually redo all of them in this manner – just a matter of time…

MP Mr Papa
Mr Papa
Member

ah,didnt read your post close enough…  dont set $listTags to true…  its a query arg so you want to set it to 1… ie

sp_AuthorPostsTag(‘listTags=1’);

CE cwwcwi0ecnuwijcowecwreiovuejwcko
cwwcwi0ecnuwijcowecwreiovuejwcko
Member

Lol, did you just change that in the codex? I swear I read true/false and default value “true” :D

MP Mr Papa
Mr Papa
Member

Yes, I did change it…  but below the list of arguments, there was a note that said true/false must be entered as 1/0…  but it should be more clear with the actual values in the arguments and not rely on a note a few lines below…

in a query arg like that, true or false would come across as a string, not a boolean… so boolean type checks would fail…