• So I would like to implement something called milestones to egg users to participate more.

    How it works is once user crosses set number of points, they see a popup with congrats message something like “Awesome, you crossed a milestone of 100 points” and some information like the rank widget (with their rank appended), and some other info / message.

    Will something like this work?

    add_action( ‘init’, ‘mycred_milestones’ );
    function mycred_milestones() {
    $i = bp_loggedin_user_id();
    $bal = mycred_get_users_cred( $i );
    if ($bal|500 == 0) // milestone for every 500 points
    // call to jquery function to trigger the popup
    }

    Or better question,

    What is the best way to add_action. Am new to wp & bp so not know the best way for triggering an action something like this.

    Can you please guide.

    https://wordpress.org/plugins/mycred/

Viewing 3 replies - 1 through 3 (of 3 total)
  • This sounds fantastic! Great idea!

    Plugin Author myCred

    (@designbymerovingi)

    Hey.

    That would work but you should also wrap your code in a conditional check to make sure myCRED is installed. You could use:

    if ( function_exists( 'mycred_get_users_cred' ) ) {
    
    }

    Otherwise when you disable myCRED (for example when you update it) your code could cause a fatal PHP error turning your screen white since the function you want to use will not be available.

    Thread Starter envieme

    (@envieme)

    Oh thanks very much. Will do.

    Btw I am having problems printing the same data the top mycred users widget shows onto to a popup. How do I query it the best way?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Milestones Notification’ is closed to new replies.