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
Thanked 0 times
Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 27, 2015 - 9:13 am

Mr Papa said
yes, need a bit more background data when you see it...  any patterns?  

when you see it, is it repeatable?  if you reload page, does it still show?  if should be or might indicate caching type activity at play...  if it is repeatable, can you go to forum - toolbox - data inspector and turn on the spThisPostUser data... and then relook at the page and get us the thanks data in the user object where you see 0...

There is no discernible pattern that I may point to.  It seems it happens randomly to everyone.  

Did you mean this:

[thanks] => 75 [thanked] => 344

This is what it shows, however right now this user has the zero times thanked.  

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 27, 2015 - 11:54 am

Sorry - can you be a little more precise...

Are you saying that the data inspector shows those two values for a specific user but at the same time is displaying zero on the actual post display?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 27, 2015 - 12:03 pm

Yellow Swordfish said
Sorry - can you be a little more precise...

Are you saying that the data inspector shows those two values for a specific user but at the same time is displaying zero on the actual post display?

Yes, here is another user:

[reputation_daily] => 0 [thanks] => 110 [thanked] => 437<br /><br />
Here is what his thanks look like:
Members
[Image Can Not Be Found]
Forum Posts: 1882
Member Since:
September 30, 2014
Thanked 0 times
 
Reputation: 984
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 27, 2015 - 1:13 pm

I think I have managed to replicate this although will need to do a little more diagnosis.  I will come back here when I know for sure..

andy-signature.png
YELLOW
SWORDFISH
Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 27, 2015 - 1:22 pm

Yellow Swordfish said
I think I have managed to replicate this although will need to do a little more diagnosis.  I will come back here when I know for sure..

Great, thanks!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 27, 2015 - 1:32 pm

I can give you some code for a temporary fix if you are up to making some small changes to a file.

This will be temporary as I believe the actual final fix will need to be a little more diagnosis and work. Bit then the final, real foix will come throu8gh ion a plugin update so this should see you through

Are you OK to make some code edits?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 27, 2015 - 3:30 pm

Yellow Swordfish said
I can give you some code for a temporary fix if you are up to making some small changes to a file.
This will be temporary as I believe the actual final fix will need to be a little more diagnosis and work. Bit then the final, real foix will come throu8gh ion a plugin update so this should see you through
Are you OK to make some code edits?

Sure, shoot.  I'll try and work it in.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 27, 2015 - 3:59 pm

OK - these changes will work assuming that you ONLY use this template function within the forum display and not outside of the forum - such as a sidebar for example. If this is not the case then do not do this!

The file you will need is located in the simple-press plugins location - by default:
/wp-content/sp-resources/forum-plugins/post-thanks/template-tags/sp-thanks-user-stats.php

On the very first line if the function change:

global $spThisUser;

to

global $spThisUser, $spThisPostUser;

locate this block of code:

# set up the user data
if (empty($userid)) {
    $user = $spThisUser;
} else {
    $user = sp_get_user($userid);
}

and replace it with this single line:

$user = $spThisPostUser;

and that should do it - I hope!

andy-signature.png
YELLOW
SWORDFISH
Avatar
Alex T
Member
sp_UserOfflineSmall Offline
Oct 27, 2015 - 4:15 pm

Ok, updated the code but still see this for me:

Admin
[Image Can Not Be Found]
Forum Posts: 3783
Member Since:
August 28, 2014
Thanked 0 times
 
Reputation: 0
 
I'll give it some time.  Last time I changed some code it took a little while for it to take effect.  I cleared all caches just in case.  
 
And here's how it looks like in the code:
 
function sp_thanks_do_user_stats($args='', $userid, $label='') {
 global $spThisUser, $spThisPostUser;

 $defs = array('tagClass' => 'spThanksUserStats',
 'usespan' => 0,
 );
 $a = wp_parse_args($args, $defs);
 $a = apply_filters('sph_ThanksUserStats_args', $a);
 extract($a, EXTR_SKIP);

 # sanitize before use
 $tagClass = esc_attr($tagClass);
 $usespan = (int) $usespan;

 $userid = (int) $userid;
 $label = sp_filter_title_display($label);

 # bail if empty userid and we have a guest
 if (empty($userid) && empty($spThisUser->ID)) return;

 $user = $spThisPostUser;

 if (empty($user->thanked)) $user->thanked = 0;
 if (empty($user->thanks)) $user->thanks = 0;

 

 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Oct 28, 2015 - 4:56 am

If it persists - go to the forum admin > Toolbox > Housekeeping - and run the task 'Reset Users Plugin Data Cache'. See of that rebuilds the numbers for you.

andy-signature.png
YELLOW
SWORDFISH
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: 620
Members: 17366
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626