Hello,
I have just updated my SP to latest 5.1.4, added and activate Post Thanks plugin.
I have also updated the default theme but I don’t see where the “Thanks” feature appears on each post, have I missed something ?
Thank you.
Hello,
I have just updated my SP to latest 5.1.4, added and activate Post Thanks plugin.
I have also updated the default theme but I don’t see where the “Thanks” feature appears on each post, have I missed something ?
Thank you.
have you added the template tag to make it show up where you want it??
http://codex.simple-press.com/codex/plugins/our-plugins/available-plugins/plugin-post-thanks/
It looks like I missed it, thanks for the link.
I’ve just added the tags, I’ll report here after a few days run.
Cheers.
What is the call within spTopicView.php to display something like “Thanked: xxx” after “Forum Posts: xxx” in the profile area of the topic? I couldn’t find it in the Codex section (in the link you mentioned above).
thanks! (no pun intended)
To show the number of thanks you can use
sp_thanks_user_stats('tagClass=spCenter spThanksUserStats', $spThisPostUser->user_id, 'Thanked %THANKED% times in %POSTS% posts')
Will be adding more info on that tomorrow but that’s the basic setting for putting in the display. Like under the member’s avatar in TopicView, Default Theme.
Brandon C said
To show the number of thanks you can usesp_thanks_user_stats('tagClass=spCenter spThanksUserStats', $spThisPostUser->user_id, 'Thanked %THANKED% times in %POSTS% posts')Will be adding more info on that tomorrow but that’s the basic setting for putting in the display. Like under the member’s avatar in TopicView, Default Theme.
I wanted to show thanks given as well as thanks earned, so I had to add some custom code to a couple of files.
Here’s the code I added to spTopicView.php right after the forum posts line:
sp_thanks_user_stats('tagClass=spCenter spThanksUserStats', $spThisPostUser->user_id, 'Thanks Given: %THANK%');
sp_thanks_user_stats('tagClass=spCenter spThanksUserStats', $spThisPostUser->user_id, 'Thanks Earned: %THANKED%');
I added lines 1 and 4 below to the sp-thanks-user-stats.php file like so:
if (empty($user->thank)) $user->thank = 0;
if (empty($user->thanked)) $user->thanked = 0;
$label = str_ireplace('%THANK%', $user->thank, $label);
$label = str_ireplace('%THANKED%', $user->thanked, $label);
$label = str_ireplace('%POSTS%', $user->posts, $label);
Can y’all add the thank code to sp-thanks-user-stats.php in the next update?
reading/replying via email, so cannot see everything you are doing… but did you try using the built in hooks/filters to that function to get the desire result? would save editing the core plugin files…
will read it in more detail tomorrow when I can visit the site…
we can consider it…
since you seem at least comfortable with coding, let me tell you a little secret… forum – toolbox – data inspector… you can use that handy little tool to tell you what data is already available in global object…
in this case, a user object, more specifically for each post in topic view, the $spThisPostUser… if you dump that out you will see the data that you can readily grab and use for each user for each post… the thanks given and thanked counts are there and can simple be output…
the template functions are really just generic helper functions for outputting basic elements… so rather than:
sp_thanks_user_stats('tagClass=spCenter spThanksUserStats', $spThisPostUser->user_id, 'Thanks Given: %THANK%'); sp_thanks_user_stats('tagClass=spCenter spThanksUserStats', $spThisPostUser->user_id, 'Thanks Earned: %THANKED%');
you could have just done
echo 'Thanks Given: '.$spThisPostUser->thanks; echo 'Thanks Received: '.$spThisPostUser->thanked;
and not had to edit the plugin… obviously not a big deal, but an easy to way to make some specific customizations…
It could be added to the plugin’s template file (sp-thanks-user-stats.php) like:
if (empty($user->thanked)) $user->thanked = 0;
if (empty($user->thanks)) $user->thanks = 0;
$label = str_ireplace('%THANKED%', $user->thanked, $label);
$label = str_ireplace('%THANKS%', $user->thanks, $label);
$label = str_ireplace('%POSTS%', $user->posts, $label);
Then when calling the function as he wants shown:
sp_thanks_user_stats('tagClass=spCenter spThanksUserStats', $spThisPostUser->user_id, 'Thanks given: %THANKS% <br /> Thanks received: %THANKED%');
sptab said
It looks like I missed it, thanks for the link.I’ve just added the tags, I’ll report here after a few days run.
Cheers.
After a few days tests, I do confirm it runs fine on my forum.
Thanks ![]()