• Resolved evollo

    (@evollo)


    We need to manually activate/deactivate/reactivate access restricted content based upon whether a member’s annual dues are paid. We cannot figure out how to do this.

    Once a member is “approved,” we cannot see a way to change their approval status to “pending approval.” If we change the user role from Member to Subscriber, the “approve” condition remains and the Subscriber continues to have access to restricted content.

    In the past, I seem to remember that there used to be a feature that allowed us to change approval status back to “prending review.” I can no longer see that option.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @evollo

    Have you tried checking the Registration Options in the UM User Role settings? You will be able to set the user to Pending Admin Review or Require Email Activation.

    Please go to WP Admin > Ultimate Member > User Roles > Edit a Role > see “Registration Options”.

    Regards,

    Thread Starter evollo

    (@evollo)

    The Pending Admin Review setting is not the problem. These members were previously approved through this the Pending Admin Review process and were approved. Now we have a situation where some members have not paid their membership renewal fees and we must block their access to restricted content until their dues are paid. Once their mambership status is reinstated, we need to “approve” them again.

    We need to be able to toggle between the “approved” and “pending approval” statuses, or have anaother way to “activate/inactivate” their access to restricted content.

    @evollo

    How are you changing the user role to “unpaid” status?
    WP Users list -> Edit the user -> Role

    Thread Starter evollo

    (@evollo)

    That’s the point. We cannot find a way to change the status to “unpaid.” We have changed the user role from Member to Subsctriber, which shoud restrict access to member-only content, but this has no effect. Even with a Subscriber user role, the user continues to have access to restricted content and the status remains “approved.”

    Thread Starter evollo

    (@evollo)

    One more thing … there are no status options like Unpaid or Inactive. The only status that might work is “Pending Approval,” but once approved, there appears to be no way to undo the approval.

    @evollo

    This code changes status for an ‘approved’ user to ‘awaiting_admin_review’
    when you change the user role from ‘um_member’ to ‘um_unpaid’.

    Change my um-slugs to your selected role slugs as in UM -> User Roles

    Code to child-theme functions.php

    add_action( 'set_user_role', 'my_set_user_role', 10, 3 );
    
    function my_set_user_role( $user_id, $new_role, $old_roles ) {
        
        if ( defined( 'um_plugin' )) {
            if( isset( $new_role ) && $new_role == 'um_unpaid' && in_array( 'um_member', $old_roles )) {
                um_fetch_user( $user_id );
                if( um_user( 'account_status' ) == 'approved' ) {
                    update_user_meta( $user_id, 'account_status', 'awaiting_admin_review', 'approved' );
                }
            }
        }
    }

    @evollo

    Changed the code so you get the toggle function and also made the setup easier.

    This code changes status
    for an ‘approved’ user to ‘awaiting_admin_review’
    when you change the user role from ‘um_member’ to ‘um_unpaid’

    and the status is switched back to ‘approved’ for user status ‘awaiting_admin_review’
    when you change the user role from ‘um_unpaid’ to ‘um_member’.

    add_action( 'set_user_role', 'my_set_user_role', 10, 3 );
    
    function my_set_user_role( $user_id, $new_role, $old_roles ) {
    
        // user setup 
        $member = 'um_member';
        $unpaid = 'um_unpaid';
        $status = 'awaiting_admin_review';
    
        if ( defined( 'um_plugin' )) {
            if( isset( $new_role ) && $new_role == $unpaid && in_array( $member, $old_roles )) {
                um_fetch_user( $user_id );
                if( um_user( 'account_status' ) == 'approved' ) {
                    update_user_meta( $user_id, 'account_status', $status, 'approved' );
                    delete_option( "um_cache_userdata_{$user_id}" );
                }
            }
            if( isset( $new_role ) && $new_role == $member && in_array( $unpaid, $old_roles )) {
                um_fetch_user( $user_id );            
                if( um_user( 'account_status' ) == $status ) {
                    update_user_meta( $user_id, 'account_status', 'approved', $status );
                    delete_option( "um_cache_userdata_{$user_id}" );
                }
            }
        }
    }
    • This reply was modified 3 years, 5 months ago by missveronica.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to deactivate/reactivate member previously approved’ is closed to new replies.