• Resolved canhotro

    (@canhotro)


    Currently, I am using WP-Members Membership Plugin . New accounts require admin approval. But, sometimes I need to reject some fake accounts. Even after deleting those fake accounts, its being counted on the referrer profile.
    How can i count only approved accounts?

    I’m try with

    add_filter( 'wp_referral_code_validate_submission', function ($result){
        return false;
    }, 1, 1);
    
    add_action( 'wp_referral_code_before_refer_submitted', function ( $new_user_id, $referrer_user_id){
        update_user_meta( $new_user_id, 'shalior_referrer_id', $referrer_user_id);
    }  , 10 , 2);
    
    add_action( 'um_after_user_is_approved', 'shalior_um_after_user_is_approved', 10, 1 );
    function shalior_um_after_user_is_approved( $user_id ) {
        $referrer_user_id = get_user_meta( $user_id, 'shalior_referrer_id', true);
        update_user_meta( $user_id, 'wrc_referrer_id', $referrer_user_id );
    
        wp_referral_code_add_user_to_referrer_invite_list($user_id , $referrer_user_id);
    }

    and it’s not working.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author shalior

    (@shalior)

    Hi, the snippet you’re using is for UM plugin.
    use this instead, it’s untested let me know if it works or not.

    add_filter( 'wp_referral_code_validate_submission', function ($result){
        return false;
    }, 1, 1);
    
    add_action( 'wp_referral_code_before_refer_submitted', function ( $new_user_id, $referrer_user_id){
        update_user_meta( $new_user_id, 'shalior_referrer_id', $referrer_user_id);
    }  , 10 , 2);
    
    add_action( 'wpmem_user_activated', 'shalior_wpmem_after_user_is_approved', 10, 1 );
    function shalior_wpmem_after_user_is_approved( $user_id ) {
        $referrer_user_id = get_user_meta( $user_id, 'shalior_referrer_id', true);
        update_user_meta( $user_id, 'wrc_referrer_id', $referrer_user_id );
    
        wp_referral_code_add_user_to_referrer_invite_list($user_id , $referrer_user_id);
    }
    Thread Starter canhotro

    (@canhotro)

    thank you for your help but the shortcode error so the above code still doesn’t work yet.

    Plugin Author shalior

    (@shalior)

    The new update may fix your problem. if it doesn’t I can’t help, unfortunately.
    you need to debug by disabling other plugins.
    and wp members does not have a hook for approved users, which means if the code above does not work, it’s not doable.

    • This reply was modified 3 years, 8 months ago by shalior.
    Thread Starter canhotro

    (@canhotro)

    Thank you very much.
    Version 1.1.1 works with my website.

    Plugin Author shalior

    (@shalior)

    you’re welcome

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Only Admin Approved Accounts need to be counted!’ is closed to new replies.