Support » Plugin: WordPoints » Rank aren’t updating

  • Resolved szpansky

    (@szpansky)


    Hello, i got problem with display user ranks, when i manual set user points in database(in usermeta), in the rank is only updated count of points, the user rank rank is old. There is some trigger i need to run? when i manual adding points ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author J.D. Grimes

    (@jdgrimes)

    Hi @szpansky,

    As you have discovered, if you modify the database directly, you will have problems. There might be other problems caused by this in addition to the ranks not being updated, even though they aren’t apparent (yet).

    I’d suggest when you need to manually update a user’s points, that you do it on their user profile screen in the admin. That will trigger the code that is necessary to update the ranks.

    If you’d rather not use that screen in this case, would you mind explaining why not? What is your use-case?

    If nothing else, I would suggest at least using the wordpoints_alter_points() function, which will call the correct triggers.

    If you feel that you must alter the points directly in the database, you could call the wordpoints_alter_points action:

    
    	do_action( 'wordpoints_points_altered', $user_id, $points, $points_type, $log_type, $meta, $log_id );
    

    But I strongly recommend against this, it is better to use the function that WordPoints provides.

    Thank You for so fast answer.
    I’m adding points from android application, that need to be made automatically via php.
    and last question, in which file i can find that function wordpoints_alter_points?

    Plugin Author J.D. Grimes

    (@jdgrimes)

    The wordpoints_alter_points() function is in components/points/includes/points.php. However, just loading that file would not be sufficient to trigger the ranks update. You’d have to load the whole plugin.

    In your android app, do you mean that you are adding the points directly in the app in php, or that the app is calling the URL for a php file on the site that triggers the points to be added? (I’m not familiar with android app development.)

    Im calling the URL for php/json

    Plugin Author J.D. Grimes

    (@jdgrimes)

    Ah, OK. I have planned at some point to add integration with WordPress’s REST API feature, which would maybe be useful for this, but I haven’t done that yet. For now, I guess you will just use WordPress Ajax, or a custom file.

    Ok, Thank you 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Rank aren’t updating’ is closed to new replies.