• Resolved extsol

    (@extsol)


    I want to show a button on the site if the user is logged in and the user have verified his/her email address. How can i get the status of the current user in php?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter extsol

    (@extsol)

    here is what i tried:

    if ( is_user_logged_in() ) {
    $current_user = wp_get_current_user(); // Retrieve the current logged-in user
    $account_status = ur_user(‘account_status’, $current_user->ID); // Get the registration status

    echo 'Account status: ' . $account_status; // Output the account status for testing

    }

    • This reply was modified 1 month, 3 weeks ago by extsol.
    Plugin Support sanjuacharya77

    (@sanjuacharya77)

    Hi @extsol,

    Could you please add this code:

    if ( is_user_logged_in() ) {$current_user = wp_get_current_user(); // Retrieve the current logged-in user
    $account_status = get_user_meta( $current_user->ID, ‘ur_confirm_email’, true );

    if ( $account_status !== ‘true’ ) { // If the registration status is not ‘true’
    echo ‘<style>
    .your-button-class {
    display: none;
    }
    </style>’;
    }
    }
    Do let us know whether it works for you or not and I will get back to you.

    Regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.