Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Post thanks plugin ?
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 24, 2012 - 8:47 pm

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

Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Sep 24, 2012 - 11:18 pm

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%');
Avatar
sptab
Member
sp_UserOfflineSmall Offline
Oct 1, 2012 - 4:27 am

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 wink

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 1, 2012 - 5:59 am

Good news. 'Thanks' for the update.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
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: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625