Ejemplo n.º 1
0
function page_action_for_unapproved_users($callback)
{
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        if (!is_wp_error($current_user) and !get_user_meta($current_user->ID, 'wp-approve-user', true)) {
            $current_url = get_current_url();
            $edit_billing_address_url = get_edit_billing_address_url();
            $is_in_billing_address_page = $current_url == $edit_billing_address_url;
            call_user_func($callback, $is_in_billing_address_page);
            // echo "<p>The page is NOT permitted to access for unapproved users. </p><p><a href='".$edit_billing_address_url."'> go to edit address page</a> </p>";
            // exit();
        }
    }
}
Ejemplo n.º 2
0
function page_action_for_unapproved_users($callback)
{
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        if (!is_wp_error($current_user) and !get_user_meta($current_user->ID, 'wp-approve-user', true)) {
            $current_url = get_current_url();
            $edit_billing_address_url = get_edit_billing_address_url();
            $is_in_billing_address_page = $current_url == $edit_billing_address_url;
            // when billing address page loaded, request for home url is somehow made internally.
            // to avoid logout in this situation, calling home url is also allowed.
            $home = home_url() . "/";
            if ($current_url == $home) {
                $is_in_billing_address_page = true;
            }
            call_user_func($callback, $is_in_billing_address_page);
            // echo "<p>The page is NOT permitted to access for unapproved users. </p><p><a href='".$edit_billing_address_url."'> go to edit address page</a> </p>";
            // exit();
        }
    }
}