コード例 #1
0
/**
 * Prevent access to `user-edit.php`
 *
 * @since 0.2.0
 *
 * @param type $redirect_to
 * @param type $requested_redirect_to
 * @param type $user
 */
function wp_user_profiles_old_user_edit_redirect()
{
    // Get the user ID
    $user_id = !empty($_REQUEST['user_id']) ? absint($_REQUEST['user_id']) : get_current_user_id();
    // Get the redirect URL
    $user_edit_url = add_query_arg(array('page' => 'profile'), wp_user_profiles_get_admin_area_url($user_id));
    // Do the redirect
    wp_safe_redirect($user_edit_url);
    exit;
}
コード例 #2
0
/**
 * Conditionally filter the URL used to edit a user
 *
 * This function does some primitive routing for theme-side user profile editing,
 * but since this is largely in flux and likely related to several other plugins,
 * themes, and other factors, we'll be tweaking this a bit in the future.
 *
 * @since 0.1.0
 *
 * @param  string  $url
 * @param  int     $user_id
 * @param  string  $scheme
 *
 * @return string
 */
function wp_user_profiles_edit_user_url_filter($url = '', $user_id = 0, $scheme = '')
{
    // Admin area editing
    if (is_admin()) {
        $url = wp_user_profiles_get_admin_area_url($user_id, $scheme);
        // Theme side editing
    } else {
        $url = wp_user_profiles_get_edit_user_url($user_id);
    }
    return add_query_arg(array('page' => 'profile'), $url);
}