Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Add last forum posts to author.php
Avatar
cwwcwi0ecnuwijcowecwreiovuejwcko
Member
Free Members
sp_UserOfflineSmall Offline
Dec 28, 2012 - 7:04 am

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.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 28, 2012 - 7:21 am
andy-signature.png
YELLOW
SWORDFISH
Avatar
cwwcwi0ecnuwijcowecwreiovuejwcko
Member
Free Members
sp_UserOfflineSmall Offline
Dec 28, 2012 - 7:55 am

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.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 28, 2012 - 10:03 am

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...

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 28, 2012 - 10:57 am

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');

Avatar
cwwcwi0ecnuwijcowecwreiovuejwcko
Member
Free Members
sp_UserOfflineSmall Offline
Dec 28, 2012 - 11:04 am

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

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 28, 2012 - 11:08 am

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...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625