• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_admin_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中user_admin_url函数的典型用法代码示例。如果您正苦于以下问题:PHP user_admin_url函数的具体用法?PHP user_admin_url怎么用?PHP user_admin_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了user_admin_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: initialize

 public function initialize()
 {
     $this->user = new stdClass();
     if (is_user_logged_in()) {
         /* Populate settings we need for the menu based on the current user. */
         $this->user->blogs = get_blogs_of_user(get_current_user_id());
         if (is_multisite()) {
             $this->user->active_blog = get_active_blog_for_user(get_current_user_id());
             $this->user->domain = empty($this->user->active_blog) ? user_admin_url() : trailingslashit(get_home_url($this->user->active_blog->blog_id));
             $this->user->account_domain = $this->user->domain;
         } else {
             $this->user->active_blog = $this->user->blogs[get_current_blog_id()];
             $this->user->domain = trailingslashit(home_url());
             $this->user->account_domain = $this->user->domain;
         }
     }
     add_action('wp_head', 'wp_admin_bar_header');
     add_action('admin_head', 'wp_admin_bar_header');
     if (current_theme_supports('admin-bar')) {
         $admin_bar_args = get_theme_support('admin-bar');
         // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') );
         $header_callback = $admin_bar_args[0]['callback'];
     }
     if (empty($header_callback)) {
         $header_callback = '_admin_bar_bump_cb';
     }
     add_action('wp_head', $header_callback);
     wp_enqueue_script('admin-bar');
     wp_enqueue_style('admin-bar');
     do_action('admin_bar_init');
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:31,代码来源:class-wp-admin-bar.php


示例2: otl_authenticate_one_time_login

/**
 * Process one time login
 *
 * @since  1.0.0
 *
 * @return void
 */
function otl_authenticate_one_time_login()
{
    // No need to run if not a singular query for the one time login
    if (!is_single()) {
        return;
    }
    // No need to run if not a onetimelogin post
    global $post;
    if ('onetimelogin' !== $post->post_type) {
        return;
    }
    $user_id = get_post_meta(get_the_ID(), 'otl_user', true);
    $valid_user = get_userdata($user_id) ? true : false;
    $login_uses = get_post_meta(get_the_ID(), 'otl_times_used', true);
    // If the one time login is unused and the user is valid, log in
    if ('0' === $login_uses && $valid_user) {
        // Log in
        wp_clear_auth_cookie();
        wp_set_current_user($user_id);
        wp_set_auth_cookie($user_id);
        // Update some meta for logging and to prevent multiple uses
        update_post_meta(get_the_ID(), 'otl_times_used', '1');
        update_post_meta(get_the_ID(), 'otl_datetime_used', current_time('mysql'));
        // Redirect to wp-admin
        wp_safe_redirect(user_admin_url());
        exit;
    } else {
        wp_redirect(home_url());
        exit;
    }
    return;
}
开发者ID:ryanduff,项目名称:one-time-login,代码行数:39,代码来源:login-handler.php


示例3: getParams

 /**
  * Generate the parameters for the raas plugin.
  * @return array
  */
 public function getParams()
 {
     // Parameters to be sent to the DOM.
     $params = array('actionRaas' => 'gigya_raas', 'redirect' => user_admin_url(), 'canEditUsers' => current_user_can('edit_users'), 'raasWebScreen' => _gigParam($this->login_options, 'raasWebScreen', 'Default-RegistrationLogin'), 'raasMobileScreen' => _gigParam($this->login_options, 'raasMobileScreen', 'DefaultMobile-RegistrationLogin'), 'raasLoginScreen' => _gigParam($this->login_options, 'raasLoginScreen', 'gigya-login-screen'), 'raasRegisterScreen' => _gigParam($this->login_options, 'raasRegisterScreen', 'gigya-register-screen'), 'raasProfileWebScreen' => _gigParam($this->login_options, 'raasProfileWebScreen', 'Default-ProfileUpdate'), 'raasProfileMobileScreen' => _gigParam($this->login_options, 'raasProfileMobileScreen', 'DefaultMobile-ProfileUpdate'), 'raasOverrideLinks' => _gigParamDefaultOn($this->login_options, 'raasOverrideLinks'), 'raasLoginDiv' => _gigParam($this->login_options, 'raasLoginDiv', 'loginform'), 'raasRegisterDiv' => _gigParam($this->login_options, 'raasRegisterDiv', 'registerform'), 'raasProfileDiv' => _gigParam($this->login_options, 'raasProfileDiv', 'profile-page'));
     // Let others plugins to modify the raas parameters.
     $params = apply_filters('gigya_raas_params', $params);
     return $params;
 }
开发者ID:eferrao,项目名称:sp-wordpress,代码行数:12,代码来源:GigyaRaasSet.php


示例4: self_admin_url

 function self_admin_url($path = '', $scheme = 'admin')
 {
     if (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) {
         return network_admin_url($path, $scheme);
     } elseif (defined('WP_USER_ADMIN') && WP_USER_ADMIN) {
         return user_admin_url($path, $scheme);
     } else {
         return admin_url($path, $scheme);
     }
 }
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:10,代码来源:yarpp.php


示例5: thatcamp_edit_profile_url

function thatcamp_edit_profile_url($url)
{
    $path = 'profile.php';
    $scheme = 'admin';
    $active = get_active_blog_for_user(get_current_user_id());
    if ($active) {
        $url = get_admin_url($active->blog_id, $path, $scheme);
    } else {
        $url = user_admin_url($path, $scheme);
    }
    return $url;
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:12,代码来源:thatcamp-setup-admin-page.php


示例6: initialize

	/**
	 * @access public
	 */
	public function initialize() {
		$this->user = new stdClass;

		if ( is_user_logged_in() ) {
			/* Populate settings we need for the menu based on the current user. */
			$this->user->blogs = get_blogs_of_user( get_current_user_id() );
			if ( is_multisite() ) {
				$this->user->active_blog = get_active_blog_for_user( get_current_user_id() );
				$this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
				$this->user->account_domain = $this->user->domain;
			} else {
				$this->user->active_blog = $this->user->blogs[get_current_blog_id()];
				$this->user->domain = trailingslashit( home_url() );
				$this->user->account_domain = $this->user->domain;
			}
		}

		add_action( 'wp_head', 'wp_admin_bar_header' );

		add_action( 'admin_head', 'wp_admin_bar_header' );

		if ( current_theme_supports( 'admin-bar' ) ) {
			/**
			 * To remove the default padding styles from WordPress for the Toolbar, use the following code:
			 * add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );
			 */
			$admin_bar_args = get_theme_support( 'admin-bar' );
			$header_callback = $admin_bar_args[0]['callback'];
		}

		if ( empty($header_callback) )
			$header_callback = '_admin_bar_bump_cb';

		add_action('wp_head', $header_callback);

		wp_enqueue_script( 'admin-bar' );
		wp_enqueue_style( 'admin-bar' );

		/**
		 * Fires after WP_Admin_Bar is initialized.
		 *
		 * @since 3.1.0
		 */
		do_action( 'admin_bar_init' );
	}
开发者ID:ShankarVellal,项目名称:WordPress,代码行数:48,代码来源:class-wp-admin-bar.php


示例7: getParams

 /**
  * Generate the parameters for the login plugin.
  * @return array
  */
 public function getParams()
 {
     // Parameters to be sent to the DOM.
     $params = array('actionLogin' => 'gigya_login', 'actionCustomLogin' => 'custom_login', 'redirect' => _gigParam($this->login_options, 'redirect', user_admin_url()));
     $params['ui'] = array();
     $params['ui']['showTermsLink'] = false;
     $params['ui']['version'] = 2;
     if (!empty($this->login_options['width'])) {
         $params['ui']['width'] = $this->login_options['width'];
     }
     if (!empty($this->login_options['height'])) {
         $params['ui']['height'] = $this->login_options['height'];
     }
     if (!empty($this->login_options['showTermsLink'])) {
         $params['ui']['showTermsLink'] = $this->login_options['showTermsLink'];
     }
     if (!empty($this->login_options['enabledProviders'])) {
         $params['ui']['enabledProviders'] = $this->login_options['enabledProviders'];
     }
     if (!empty($this->login_options['buttonsStyle'])) {
         $params['ui']['buttonsStyle'] = $this->login_options['buttonsStyle'];
     }
     if (!empty($this->login_options['advancedLoginUI'])) {
         $arr = gigyaCMS::parseJSON($this->login_options['advancedLoginUI']);
         if (!empty($arr)) {
             foreach ($arr as $key => $val) {
                 $params['ui'][$key] = $val;
             }
         }
     }
     if (!empty($this->login_options['advancedAddConnectionsUI'])) {
         $arr = gigyaCMS::parseJSON($this->login_options['advancedAddConnectionsUI']);
         if (!empty($arr)) {
             foreach ($arr as $key => $val) {
                 $params['addConnection'][$key] = $val;
             }
         }
     }
     // Let others plugins to modify the login parameters.
     $params = apply_filters('gigya_login_params', $params);
     return $params;
 }
开发者ID:eferrao,项目名称:sp-wordpress,代码行数:46,代码来源:GigyaLoginSet.php


示例8: getContent

 /**
  * @param $args
  * @param $instance
  *
  * @return string
  */
 public function getContent($args, $instance)
 {
     $output = '';
     $title = apply_filters('widget_title', $instance['title']);
     // Get the data from the argument.
     //		require_once GIGYA__PLUGIN_DIR . 'features/login/GigyaRaasSet.php';
     //		$raas = new GigyaLoginSet();
     //		$data  = $raas->getParams();
     //
     //		// Override params or take the defaults.
     //		if ( ! empty( $instance['override'] ) ) {
     //			foreach ( $instance as $key => $value ) {
     //				if ( ! empty( $value ) ) {
     //					$data['ui'][$key] = esc_attr( $value );
     //				}
     //			}
     //		}
     // Set the output.
     $output .= $args['before_widget'];
     if (!empty($title)) {
         $output .= $args['before_title'] . $title . $args['after_title'];
     }
     if (!is_user_logged_in()) {
         $output .= '<div class="gigya-raas-widget">';
         $output .= '<a href="wp-login.php">' . __('Login') . '</a> | ';
         $output .= '<a href="wp-login.php?action=register">' . __('Register') . '</a>';
         $output .= '</div>';
     } else {
         $current_user = wp_get_current_user();
         $output .= '<div class="gigya-wp-account-widget">';
         $output .= '<a class="gigya-wp-avatar" href="' . user_admin_url('profile.php') . '">' . get_avatar($current_user->ID) . '</a>';
         $output .= '<div class="gigya-wp-info">';
         $output .= '<a class="gigya-wp-name" href="' . user_admin_url('profile.php') . '">' . $current_user->display_name . '</a>';
         $output .= '<a class="gigya-wp-logout" href="' . wp_logout_url() . '">' . __('Log Out') . '</a>';
         $output .= '</div></div>';
     }
     $output .= $args['after_widget'];
     return $output;
 }
开发者ID:eferrao,项目名称:sp-wordpress,代码行数:45,代码来源:GigyaRaasWidget.php


示例9: getContent

 /**
  * @param $args
  * @param $instance
  *
  * @return string
  */
 public function getContent($args, $instance)
 {
     $output = '';
     $title = apply_filters('widget_title', $instance['title']);
     // Get the data from the argument.
     require_once GIGYA__PLUGIN_DIR . 'features/login/GigyaLoginSet.php';
     $login = new GigyaLoginSet();
     $data = $login->getParams();
     // Override params or take the defaults.
     if (!empty($instance['override'])) {
         foreach ($instance as $key => $value) {
             if (!empty($value)) {
                 $data['ui'][$key] = esc_attr($value);
             }
         }
     }
     // Set the output.
     $output .= $args['before_widget'];
     if (!empty($title)) {
         $output .= $args['before_title'] . $title . $args['after_title'];
     }
     if (!is_user_logged_in()) {
         $output .= '<div class="gigya-login-widget"></div>';
         $output .= '<script class="data-login" type="application/json">' . json_encode($data) . '</script>';
     } else {
         $current_user = wp_get_current_user();
         $output .= '<div class="gigya-wp-account-widget">';
         $output .= '<a class="gigya-wp-avatar" href="' . user_admin_url('profile.php') . '">' . get_avatar($current_user->ID) . '</a>';
         $output .= '<div class="gigya-wp-info">';
         $output .= '<a class="gigya-wp-name" href="' . user_admin_url('profile.php') . '">' . $current_user->display_name . '</a>';
         $output .= '<a class="gigya-wp-logout" href="' . wp_logout_url() . '">' . __('Log Out') . '</a>';
         $output .= '</div></div>';
     }
     $output .= $args['after_widget'];
     return $output;
 }
开发者ID:eferrao,项目名称:sp-wordpress,代码行数:42,代码来源:GigyaLoginWidget.php


示例10: login

 /**
  * Login user. SSL support is not tested. 
  */
 public function login()
 {
     global $json_api;
     $secure_cookie = '';
     // If the user wants ssl but the session is not ssl, force a secure cookie.
     if (!empty($_POST['log']) && !force_ssl_admin()) {
         $user_name = sanitize_user($_POST['log']);
         if ($user = get_user_by('login', $user_name)) {
             // i'm guessing the user can change their login options to work with SSL
             if (get_user_option('use_ssl', $user->ID)) {
                 $secure_cookie = true;
                 //passing true to like so, force_ssl_admin(true), makes force_ssl_admin() return true and vice versa
                 //force_ssl_admin(true); http://codex.wordpress.org/Function_Reference/force_ssl_admin
                 // we are declaring error but not returning it for now
                 $errors = new WP_Error();
                 $errors->add('use_ssl', __("The login must use ssl."));
                 // not implemeted now
                 //return $errors;
             }
         }
     }
     if (isset($_REQUEST['redirect_to'])) {
         $redirect_to = $_REQUEST['redirect_to'];
         // Redirect to https if user wants ssl
         if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
             $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
         }
     } else {
         $redirect_to = admin_url();
     }
     $reauth = empty($_REQUEST['reauth']) ? false : true;
     // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure
     // cookie and redirect back to the referring non-secure admin page.  This allows logins to always be POSTed over SSL while allowing the user to choose visiting
     // the admin via http or https.
     if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
         $secure_cookie = false;
     }
     //$user = wp_authenticate_username_password('', $_POST['log'], $_POST['pwd']);
     $user = wp_signon('', $secure_cookie);
     if (is_wp_error($user)) {
         // user is an error object
         $errors = $user;
         // if both login and password are empty no error is added so we add one now
         if (empty($_POST['log']) && empty($_POST['pwd'])) {
             $errors->add('invalid_username', __("The username is empty."));
         }
         // Clear errors if loggedout is set.
         if (!empty($_GET['loggedout']) || $reauth) {
             $errors = new WP_Error();
         }
         // If cookies are disabled we can't log in even with a valid user+pass
         if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
             $errors->add('test_cookie', __("Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
         }
         // Some parts of this script use the main login form to display a message
         if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
             $errors->add('loggedout', __('You are now logged out.'), 'message');
         } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
             $errors->add('registerdisabled', __('User registration is currently not allowed.'));
         } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
             $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
         } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
             $errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
         } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
             $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
         } elseif ($interim_login) {
             $errors->add('expired', __('Your session has expired. Please log-in again.'), 'message');
         }
         // Clear any stale cookies.
         if ($reauth) {
             wp_clear_auth_cookie();
         }
         return $errors;
     }
     //if (!$reauth) {
     // does not redirect
     if (empty($redirect_to) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url()) {
         // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
         if (is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin($user->ID)) {
             $redirect_to = user_admin_url();
         } elseif (is_multisite() && !$user->has_cap('read')) {
             $redirect_to = get_dashboard_url($user->ID);
         } elseif (!$user->has_cap('edit_posts')) {
             $redirect_to = admin_url('profile.php');
         }
     }
     wp_set_current_user($user->ID);
     $user = $this->get_logged_in_user();
     // left in redirect_to since we could return the value later if we wanted
     return $user;
     //}
 }
开发者ID:andreiRS,项目名称:Radii8,代码行数:95,代码来源:user.php


示例11: get_edit_profile_url

/**
 * Get the URL to the user's profile editor.
 *
 * @since 3.1.0
 *
 * @param int $user User ID
 * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
 * @return string Dashboard url link with optional path appended
 */
function get_edit_profile_url($user, $scheme = 'admin')
{
    $user = (int) $user;
    if (is_user_admin()) {
        $url = user_admin_url('profile.php', $scheme);
    } elseif (is_network_admin()) {
        $url = network_admin_url('profile.php', $scheme);
    } else {
        $url = get_dashboard_url($user, 'profile.php', $scheme);
    }
    return apply_filters('edit_profile_url', $url, $user, $scheme);
}
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:21,代码来源:link-template.php


示例12: test_get_dashboard_url_for_user_with_no_sites

 /**
  * @ticket 39065
  */
 public function test_get_dashboard_url_for_user_with_no_sites()
 {
     add_filter('get_blogs_of_user', '__return_empty_array');
     $expected = is_multisite() ? user_admin_url() : admin_url();
     $this->assertEquals($expected, get_dashboard_url(self::$user_id));
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Develop,代码行数:9,代码来源:getDashboardUrl.php


示例13: test_admin_bar_contains_correct_about_link_for_users_with_no_role_in_multisite

 /**
  * @ticket 37949
  * @group multisite
  */
 public function test_admin_bar_contains_correct_about_link_for_users_with_no_role_in_multisite()
 {
     if (!is_multisite()) {
         $this->markTestSkipped('Test only runs in multisite');
     }
     // User is not a member of a site.
     remove_user_from_blog(self::$no_role_id, get_current_blog_id());
     wp_set_current_user(self::$no_role_id);
     $wp_admin_bar = $this->get_standard_admin_bar();
     $wp_logo_node = $wp_admin_bar->get_node('wp-logo');
     $about_node = $wp_admin_bar->get_node('about');
     $this->assertNotNull($wp_logo_node);
     $this->assertSame(user_admin_url('about.php'), $wp_logo_node->href);
     $this->assertArrayNotHasKey('tabindex', $wp_logo_node->meta);
     $this->assertNotNull($about_node);
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:20,代码来源:adminbar.php


示例14: template_redirect


//.........这里部分代码省略.........
             case 'register':
                 if (!get_option('users_can_register')) {
                     $redirect_to = site_url('wp-login.php?registration=disabled');
                     wp_redirect($redirect_to);
                     exit;
                 }
                 $user_login = '';
                 $user_email = '';
                 if ($http_post) {
                     $user_login = $_POST['user_login'];
                     $user_email = $_POST['user_email'];
                     $this->errors = self::register_new_user($user_login, $user_email);
                     if (!is_wp_error($this->errors)) {
                         $redirect_to = !empty($_POST['redirect_to']) ? $_POST['redirect_to'] : site_url('wp-login.php?checkemail=registered');
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                 }
                 break;
             case 'login':
             default:
                 $secure_cookie = '';
                 $interim_login = isset($_REQUEST['interim-login']);
                 // If the user wants ssl but the session is not ssl, force a secure cookie.
                 if (!empty($_POST['log']) && !force_ssl_admin()) {
                     $user_name = sanitize_user($_POST['log']);
                     if ($user = get_user_by('login', $user_name)) {
                         if (get_user_option('use_ssl', $user->ID)) {
                             $secure_cookie = true;
                             force_ssl_admin(true);
                         }
                     }
                 }
                 if (!empty($_REQUEST['redirect_to'])) {
                     $redirect_to = $_REQUEST['redirect_to'];
                     // Redirect to https if user wants ssl
                     if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
                         $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
                     }
                 } else {
                     $redirect_to = admin_url();
                 }
                 $reauth = empty($_REQUEST['reauth']) ? false : true;
                 // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure
                 // cookie and redirect back to the referring non-secure admin page.  This allows logins to always be POSTed over SSL while allowing the user to choose visiting
                 // the admin via http or https.
                 if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
                     $secure_cookie = false;
                 }
                 if ($http_post && isset($_POST['log'])) {
                     $user = wp_signon('', $secure_cookie);
                     $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
                     if (!is_wp_error($user) && !$reauth) {
                         if (empty($redirect_to) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url()) {
                             // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
                             if (is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin($user->ID)) {
                                 $redirect_to = user_admin_url();
                             } elseif (is_multisite() && !$user->has_cap('read')) {
                                 $redirect_to = get_dashboard_url($user->ID);
                             } elseif (!$user->has_cap('edit_posts')) {
                                 $redirect_to = admin_url('profile.php');
                             }
                         }
                         wp_safe_redirect($redirect_to);
                         exit;
                     }
                     $this->errors = $user;
                 }
                 // Clear errors if loggedout is set.
                 if (!empty($_GET['loggedout']) || $reauth) {
                     $this->errors = new WP_Error();
                 }
                 // Some parts of this script use the main login form to display a message
                 if (isset($_GET['loggedout']) && true == $_GET['loggedout']) {
                     $this->errors->add('loggedout', __('You are now logged out.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
                     $this->errors->add('registerdisabled', __('User registration is currently not allowed.', 'theme-my-login'));
                 } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
                     $this->errors->add('confirm', __('Check your e-mail for the confirmation link.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['resetpass']) && 'complete' == $_GET['resetpass']) {
                     $this->errors->add('password_reset', __('Your password has been reset.', 'theme-my-login'), 'message');
                 } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
                     $this->errors->add('registered', __('Registration complete. Please check your e-mail.', 'theme-my-login'), 'message');
                 } elseif ($interim_login) {
                     $this->errors->add('expired', __('Your session has expired. Please log-in again.', 'theme-my-login'), 'message');
                 } elseif (strpos($redirect_to, 'about.php?updated')) {
                     $this->errors->add('updated', __('<strong>You have successfully updated WordPress!</strong> Please log back in to experience the awesomeness.', 'theme-my-login'), 'message');
                 } elseif ($reauth) {
                     $this->errors->add('reauth', __('Please log in to continue.', 'theme-my-login'), 'message');
                 }
                 // Clear any stale cookies.
                 if ($reauth) {
                     wp_clear_auth_cookie();
                 }
                 break;
         }
         // end switch
     }
     // endif has_filter()
 }
开发者ID:Kilbourne,项目名称:restart,代码行数:101,代码来源:class-theme-my-login.php


示例15: pods_v


//.........这里部分代码省略.........
                        $scheme = $var[1];
                    }
                } else {
                    $path = $var;
                }
                $output = network_home_url($path, $scheme);
                break;
            case 'network-admin-url':
                $path = '';
                $scheme = null;
                if (is_array($var)) {
                    if (isset($var[0])) {
                        $path = $var[0];
                    } elseif (isset($var[1])) {
                        $scheme = $var[1];
                    }
                } else {
                    $path = $var;
                }
                $output = network_admin_url($path, $scheme);
                break;
            case 'user-admin-url':
                $path = '';
                $scheme = null;
                if (is_array($var)) {
                    if (isset($var[0])) {
                        $path = $var[0];
                    } elseif (isset($var[1])) {
                        $scheme = $var[1];
                    }
                } else {
                    $path = $var;
                }
                $output = user_admin_url($path, $scheme);
                break;
            case 'prefix':
                global $wpdb;
                $output = $wpdb->prefix;
                break;
            case 'server':
                if (!pods_strict()) {
                    if (isset($_SERVER[$var])) {
                        $output = pods_unslash($_SERVER[$var]);
                    } elseif (isset($_SERVER[strtoupper($var)])) {
                        $output = pods_unslash($_SERVER[strtoupper($var)]);
                    }
                }
                break;
            case 'session':
                if (isset($_SESSION[$var])) {
                    $output = $_SESSION[$var];
                }
                break;
            case 'global':
            case 'globals':
                if (isset($GLOBALS[$var])) {
                    $output = $GLOBALS[$var];
                }
                break;
            case 'cookie':
                if (isset($_COOKIE[$var])) {
                    $output = pods_unslash($_COOKIE[$var]);
                }
                break;
            case 'constant':
                if (defined($var)) {
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:67,代码来源:data.php


示例16: doLogin

 public function doLogin()
 {
     $minecraftjp = $this->getMinecraftJP();
     $authType = !empty($_SESSION['auth_type']) ? $_SESSION['auth_type'] : 'login';
     $redirectTo = !empty($_SESSION['redirect_to']) ? $_SESSION['redirect_to'] : '';
     if ($authType == 'link') {
         try {
             $mcjpUser = $minecraftjp->getUser();
         } catch (\Exception $e) {
             $this->setFlash($e->getMessage(), 'default', array('class' => 'error'));
             wp_safe_redirect(admin_url('profile.php'));
             exit;
         }
         if (!empty($mcjpUser)) {
             $userId = get_current_user_id();
             $existsUserId = $this->User->getUserIdBySub($mcjpUser['sub']);
             if (!empty($existsUserId) && $existsUserId != $userId) {
                 $this->setFlash(__('This account is already linked.', App::NAME), 'default', array('class' => 'error'));
             } else {
                 update_user_meta($userId, 'minecraftjp_sub', $mcjpUser['sub']);
                 update_user_meta($userId, 'minecraftjp_uuid', $mcjpUser['uuid']);
                 update_user_meta($userId, 'minecraftjp_username', $mcjpUser['preferred_username']);
                 $this->setFlash(__('Minecraft.jp account linked successfully.', App::NAME));
             }
         } else {
             $this->setFlash(__('Authorization denied.', App::NAME), 'default', array('class' => 'error'));
         }
         wp_safe_redirect(admin_url('profile.php'));
     } else {
         try {
             $mcjpUser = $minecraftjp->getUser();
         } catch (\Exception $e) {
             $this->setFlash($e->getMessage(), 'default', array('class' => 'error'));
             wp_safe_redirect(site_url('wp-login.php'));
             exit;
         }
         if (!empty($mcjpUser)) {
             $userId = $this->User->getUserIdBySub($mcjpUser['sub']);
             if (!$userId) {
                 if (!get_option('users_can_register') && !Configure::read('force_users_can_register')) {
                     wp_redirect(site_url('wp-login.php?registration=disabled'));
                     exit;
                 }
                 $password = wp_generate_password();
                 $result = wp_create_user($mcjpUser['preferred_username'] . Configure::read('username_suffix'), $password, $mcjpUser['email']);
                 if (is_wp_error($result)) {
                     $this->setFlash(__('username or email is already taken.', App::NAME), 'default', array('class' => 'error'));
                     wp_safe_redirect(site_url('wp-login.php'));
                     exit;
                 } else {
                     $userId = $result;
                     wp_update_user(array('ID' => $userId, 'user_url' => !empty($mcjpUser['website']) ? $mcjpUser['website'] : $mcjpUser['profile'], 'display_name' => $mcjpUser['preferred_username']));
                     update_user_meta($userId, 'nickname', $mcjpUser['preferred_username']);
                     update_user_meta($userId, 'minecraftjp_sub', $mcjpUser['sub']);
                     update_user_meta($userId, 'minecraftjp_uuid', $mcjpUser['uuid']);
                     // send password notification
                     wp_new_user_notification($userId, $password);
                 }
             }
             update_user_meta($userId, 'minecraftjp_username', $mcjpUser['preferred_username']);
             wp_set_auth_cookie($userId, true);
             $user = get_user_by('id', $userId);
             if (empty($redirectTo) || $redirectTo == 'wp-admin/' || $redirectTo == admin_url()) {
                 if (is_multisite() && !get_active_blog_for_user($userId) && !is_super_admin($userId)) {
                     $redirectTo = user_admin_url();
                 } else {
                     if (is_multisite() && !$user->has_cap('read')) {
                         $redirectTo = get_dashboard_url($userId);
                     } else {
                         if (!$user->has_cap('edit_posts')) {
                             $redirectTo = admin_url('profile.php');
                         }
                     }
                 }
             }
             wp_safe_redirect($redirectTo);
             exit;
         } else {
             $this->setFlash(__('Authorization denied.', App::NAME), 'default', array('class' => 'error'));
             wp_safe_redirect(site_url('wp-login.php'));
             exit;
         }
     }
 }
开发者ID:minecraftjp,项目名称:wp-minecraftjp,代码行数:84,代码来源:PublicController.php


示例17: filter_adminbar_profile_link

 /**
  * Filter the profile url.
  *
  * @since 2.1.0
  *
  *
  * @param string $profile_link Profile Link for admin bar.
  * @param string $url          Profile URL.
  * @param int    $user_id      User ID.
  * @return string
  */
 public function filter_adminbar_profile_link($profile_link = '', $url = '', $user_id = 0)
 {
     if (!is_super_admin($user_id) && is_admin()) {
         $profile_link = user_admin_url('profile.php');
     }
     return $profile_link;
 }
开发者ID:buddypress,项目名称:BuddyPress-build,代码行数:18,代码来源:class-bp-members-admin.php


示例18: function

                    ?>
				<script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php 
                    echo wp_customize_url();
                    ?>
', channel: 'login' }).send('login') }, 1000 );</script>
			<?php 
                }
                ?>
			</body></html>
<?php 
                exit;
            }
            if (empty($redirect_to) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url()) {
                // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
                if (is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin($user->ID)) {
                    $redirect_to = user_admin_url();
                } elseif (is_multisite() && !$user->has_cap('read')) {
                    $redirect_to = get_dashboard_url($user->ID);
                } elseif (!$user->has_cap('edit_posts')) {
                    $redirect_to = $user->has_cap('read') ? admin_url('profile.php') : home_url();
                }
            }
            wp_safe_redirect($redirect_to);
            exit;
        }
        $errors = $user;
        // Clear errors if loggedout is set.
        if (!empty($_GET['loggedout']) || $reauth) {
            $errors = new WP_Error();
        }
        if ($interim_login) {
开发者ID:neruub,项目名称:shop_sda,代码行数:31,代码来源:wp-login.php


示例19: action_login

 /**
  * Login hooks
  */
 function action_login()
 {
     $interim_login = isset($_REQUEST['interim-login']);
     $secure_cookie = '';
     $customize_login = isset($_REQUEST['customize-login']);
     if ($customize_login) {
         wp_enqueue_script('customize-base');
     }
     // If the user wants ssl but the session is not ssl, force a secure cookie.
     if (!empty($_POST['log']) && !force_ssl_admin()) {
         $user_name = sanitize_user($_POST['log']);
         if ($user = get_user_by('login', $user_name)) {
             if (get_user_option('use_ssl', $user->ID)) {
                 $secure_cookie = true;
                 force_ssl_admin(true);
             }
         }
     }
     if (isset($_REQUEST['redirect_to'])) {
         $redirect_to = $_REQUEST['redirect_to'];
         // Redirect to https if user wants ssl
         if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
             $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
         }
     } else {
         $redirect_to = admin_url();
     }
     $reauth = empty($_REQUEST['reauth']) ? false : true;
     $user = wp_signon('', $secure_cookie);
     if (empty($_COOKIE[LOGGED_IN_COOKIE])) {
         if (headers_sent()) {
             $user = new WP_Error('test_cookie', sprintf(__('<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.', 'colabsthemes'), 'http://codex.wordpress.org/Cookies', 'https://wordpress.org/support/'));
         } elseif (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
             // If cookies are disabled we can't log in even with a valid user+pass
             $user = new WP_Error('test_cookie', sprintf(__('<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.', 'colabsthemes'), 'http://codex.wordpress.org/Cookies'));
         }
     }
     $requested_redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
     /**
      * Filter the login redirect URL.
      *
      * @since 3.0.0
      *
      * @param string           $redirect_to           The redirect destination URL.
      * @param string           $requested_redirect_to The requested redirect destination URL passed as a parameter.
      * @param WP_User|WP_Error $user                  WP_User object if login was successful, WP_Error object otherwise.
      */
     $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
     if (!is_wp_error($user) && !$reauth) {
         if ($interim_login) {
          

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_authenticate函数代码示例发布时间:2022-05-23
下一篇:
PHP user_add_password_history函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap