• Resolved LeadGuitarMx

    (@leadguitar)


    Hello : )

    There is a way of subtracting points without generate a log in the database?

    I’m using this code:
    wordpoints_subtract_points( $user_id, 10, 'points', 'my_log_type' );

    But I don’t want to see that log in my “wordpoints_points_logs” page.

    Thanks for your help : )

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

    (@jdgrimes)

    Hi @leadguitar,

    There are two options here. If you just want the log to be invisible to some or all users, you can use the points logs viewing restrictions API. If you really don’t want the transaction to be logged at all, then you can hook into the 'wordpoints_points_log' filter.

    Example:

    
    add_filter( 'wordpoints_points_log', '__return_false' );
    wordpoints_subtract_points( $user_id, 10, 'points', 'my_log_type' );
    remove_filter( 'wordpoints_points_log', '__return_false' );
    

    Most of the time, I would recommend using the viewing restrictions API. Then you have the transaction logged in case you ever change your mind and do want to display it. If you don’t log it all, then it is gone forever. That’s why I haven’t really documented this feature. ??

    Thread Starter LeadGuitarMx

    (@leadguitar)

    Thanks for your answer, it will help me ??

    I did a wp_schedule_event for subtract points to the users without activity but it generate a lot of logs.

    My idea is something like: You win points visiting and participating but if you don’t have activity you’ll lose a point every day.

    And when a user lose all the points, I’ll send a message saying “Your account will be suspended for inactivity”

    I’m not so sure but.. I’ll try ??

    But anyways, thanks so very much again. Now I’ll give you 5 stars for your great work ??

    • This reply was modified 6 years, 8 months ago by LeadGuitarMx.
    Plugin Author J.D. Grimes

    (@jdgrimes)

    Thanks for the 5 stars! Glad to help!

    I’ve added this to the list of ideas as well; maybe if other people are interested I’ll create an extension supplying this feature at some point.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Subtracting Points without generate log?’ is closed to new replies.