Support Forum

Thanked 0 times

25 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

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?

AT Alex T
Alex T
Member

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.

YS Yellow Swordfish
Yellow Swordfish
Member

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!

AT Alex T
Alex T
Member

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

Admin
Level 10
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;
 
 
YS Yellow Swordfish
Yellow Swordfish
Member

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.

AT Alex T
Alex T
Member

Yellow Swordfish said
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.

I was just checking and my own stats were not correct:

Admin
Level 10
Forum Posts: 3785
Member Since:
August 28, 2014
Thanked 0 times
 
Reputation: 0
 
After resetting the plugin cache:
 
Admin
Level 10
Forum Posts: 3785
Member Since:
August 28, 2014
Thanked 960 times
 
Reputation: 2001
 
I’ll check randomly to see if this works.  
MP Mr Papa
Mr Papa
Member

just to be clear, the change Andy gave in post #18 will only work within the topic view loop – not necessarily anywhere in the forum display (ie profile)….  it will  not be the final fix (its much more involved)…

AT Alex T
Alex T
Member

Just noticed this happened once again.  

 

Admin
Level 10
Forum Posts: 3841
Member Since:
August 28, 2014
Thanked 0 times
 
Reputation: 0
 
Happened in a thread that is pinned.  
IK Ike
Ike
Member

So does running the ‘Reset Users Plugin Data Cache’ fix things again?

Might be a case of just running the task every time you notice the count displays incorrectly until a fix is released, but best wait for Andy to comment in case there is more to it..

MP Mr Papa
Mr Papa
Member

we hope to get the updated plugin released this weekend…

in meantime, I would revert to the original plugin and if you want to update it again to the final fix, in the main plugin file sp-thanks-plugin.php find this line

add_action('sph_user_class_member',                'sp_thanks_load_to_user_class');

and after it add this line

add_action('sph_user_class_member_small',        'sp_thanks_load_to_user_class');