Viewing 10 replies - 1 through 10 (of 10 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure what could be going on, since you never run update_post_meta or so on the _badgeos_points. Not sure if you have anywhere that may be deleting the key or perhaps ALL of the user meta. I did notice some custom BadgeOS functions referenced in there, but the pastebin doesn’t have anything about their definitions.

    Thread Starter roblund

    (@roblund)

    Here’s an example of one of the custom functions. The others functions are similar.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Nothing in the example that relates to deleting user meta. So, I’m not sure what could be going on. At no point can I see any usage of anything that would affect the _badgeos_points user meta key. Not sure if anywhere along the whole process all of the user meta gets reset and then rebuilt. Doesn’t look like it though, but that’s the best guess I have at the moment.

    Thread Starter roblund

    (@roblund)

    Still having the problem. Could it have anything to do with this function?

    //BadgeOS user points shortcode
    function badgeos_get_users_points_shortcode($user_id = 0) {
    
    // Use current user's ID if none specified
    if ( ! $user_id )
    $user_id = wp_get_current_user()->ID;
    
    // Return our user's points as an integer (sanely falls back to 0 if empty)
    return absint( get_user_meta( $user_id, '_badgeos_points', true ) );
    }
    add_shortcode( 'badgeos_get_users_points', 'badgeos_get_users_points_shortcode' );
    Michael Beckwith

    (@tw2113)

    The BenchPresser

    The only time that would return zero is if the _badgeos_points get_user_meta call returned an empty meta value, otherwise it’d just return a whole positive number that’s stored in the meta.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    hi Roblund, any changes with this one? or are we able to mark this resolved? It’s still a very strange error, to be honest.

    Thread Starter roblund

    (@roblund)

    Hi Michael,

    I haven’t solved it yet, but I haven’t spent much time looking for a solution. All I know is that the points remain when updating from the WP dashboard but are reset when updating from the front end page. I might end up removing the display of points from the page and use the BadgeOS widget instead and see if the error still occurs…

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    hmm, interesting that it’s only coming from one spot, but still frustrating. If/when you find the issue, I’d be curious to hear of it, but I understand time constraints as well.

    Thread Starter roblund

    (@roblund)

    Hi Michael, I couldn’t figure out the problem so I wiped my hands of the code and have used the User Meta plugin successfully to edit profiles from the front end. Good news is that points remain after updating the profile. Thanks for your help.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good to hear you got a solution somehow πŸ™‚

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Points reset after updating profile’ is closed to new replies.