本文整理汇总了PHP中wp_login_url函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_login_url函数的具体用法?PHP wp_login_url怎么用?PHP wp_login_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_login_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_new_user_notification
/**
* Notify the blog admin of a new user, normally via email.
*
* @since 2.0
*
* @param int $user_id User ID
* @param string $plaintext_pass Optional. The user's plaintext password
*/
function wp_new_user_notification($user_id, $plaintext_pass = '')
{
global $LoginWithAjax;
//Copied out of /wp-includes/pluggable.php
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$message = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
if (empty($plaintext_pass)) {
return;
}
//LWA Customizations
if ($LoginWithAjax->data['notification_override'] == true) {
//We can use our own logic here
$LoginWithAjax->new_user_notification($user_login, $plaintext_pass, $user_email, $blogname);
} else {
//Copied out of /wp-includes/pluggable.php
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
$message .= wp_login_url() . "\r\n";
wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
}
}
示例2: json_create_user
public function json_create_user()
{
$error = array("status" => 0, "msg" => __('There has been an error processing your request. Please, reload the page and try again.', Eab_EventsHub::TEXT_DOMAIN));
$data = stripslashes_deep($_POST);
$email = $data['email'];
if (empty($email)) {
$error['msg'] = __('Please, submit an email.', Eab_EventsHub::TEXT_DOMAIN);
die(json_encode($error));
}
if (!is_email($email)) {
$error['msg'] = __('Please, submit a valid email.', Eab_EventsHub::TEXT_DOMAIN);
die(json_encode($error));
}
if (email_exists($email)) {
$current_location = get_permalink();
if (!empty($data['location'])) {
// Let's make this sane first - it's coming from a POST request, so make that sane
$loc = wp_validate_redirect(wp_sanitize_redirect($data['location']));
if (!empty($loc)) {
$current_location = $loc;
}
}
$login_link = wp_login_url($current_location);
$login_message = sprintf(__('The email address already exists. Please <a href="%s">Login</a> and RSVP to the event.', Eab_EventsHub::TEXT_DOMAIN), $login_link);
$error['msg'] = $login_message;
die(json_encode($error));
}
$wordp_user = $this->_create_user($email);
if (is_object($wordp_user) && !empty($wordp_user->ID)) {
$this->_login_user($wordp_user);
} else {
die(json_encode($error));
}
die(json_encode(array("status" => 1)));
}
示例3: wp_new_user_notification_original
function wp_new_user_notification_original($user_id, $plaintext_pass = '', $include_fields = false, $activation_data = false, $welcome_email = '')
{
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
$admin_email = get_option('admin_email');
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
// Get the site domain and get rid of www.
$sitename = strtolower($_SERVER['SERVER_NAME']);
if (substr($sitename, 0, 4) == 'www.') {
$sitename = substr($sitename, 4);
}
$from_email = 'wordpress@' . $sitename;
$headers = sprintf("From: %s <%s>\r\n\\", $blogname, $from_email);
$message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
if ($include_fields) {
$message .= cimy_uef_mail_fields($user, $activation_data);
}
@wp_mail($admin_email, sprintf(__('[%s] New User Registration'), $blogname), $message, $headers);
if (empty($plaintext_pass)) {
return;
}
$welcome_email = str_replace("USERNAME", $user_login, $welcome_email);
$welcome_email = str_replace("PASSWORD", $plaintext_pass, $welcome_email);
if ($include_fields) {
$welcome_email .= cimy_uef_mail_fields($user, $activation_data);
}
$welcome_email = str_replace("LOGINLINK", wp_login_url(), $welcome_email);
wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $welcome_email, $headers);
}
示例4: bp_members_admin_bar_my_account_menu
/**
* Add the "My Account" menu and all submenus.
*
* @since 1.6.0
*
* @todo Deprecate WP 3.2 Toolbar compatibility when we drop 3.2 support
*/
function bp_members_admin_bar_my_account_menu()
{
global $wp_admin_bar;
// Bail if this is an ajax request
if (defined('DOING_AJAX')) {
return;
}
// Logged in user
if (is_user_logged_in()) {
$bp = buddypress();
// Stored in the global so we can add menus easily later on
$bp->my_account_menu_id = 'my-account-buddypress';
// Create the main 'My Account' menu
$wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'group' => true, 'title' => __('Edit My Profile', 'buddypress'), 'href' => bp_loggedin_user_domain(), 'meta' => array('class' => 'ab-sub-secondary')));
// Show login and sign-up links
} elseif (!empty($wp_admin_bar)) {
add_filter('show_admin_bar', '__return_true');
// Create the main 'My Account' menu
$wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url(bp_get_requested_url())));
// Sign up
if (bp_get_signup_allowed()) {
$wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
}
}
}
示例5: palo_filter_frontend_modal_link_atts
/**
* Sets the right href and class attributes for the modal link in menus
*/
function palo_filter_frontend_modal_link_atts($atts, $item, $args)
{
/**
* Ony apply to modal login or register
*/
if (in_array($atts['href'], array('#pa_modal_login', '#pa_modal_register'))) {
/**
* Add trigger if not logged in
*/
if (!is_user_logged_in()) {
$atts['class'] = assign_if_exists('class', $atts) . ' palo-modal-login-trigger';
}
/**
* Modify links
*/
if ('#pa_modal_login' == $atts['href']) {
if (is_user_logged_in()) {
$atts['href'] = wp_logout_url();
} else {
$atts['href'] = wp_login_url();
$atts['data-palo-modal'] = palo_append_qs(wp_login_url(), 'palo-login=1');
}
} else {
if ('#pa_modal_register' == $atts['href']) {
$atts['href'] = wp_registration_url();
$atts['data-palo-modal'] = palo_append_qs(wp_registration_url(), 'palo-login=1');
}
}
}
return $atts;
}
示例6: authenticate
/**
* Authenticates the user using SAML
*
* @return void
*/
public function authenticate()
{
if (isset($_GET['loggedout']) && $_GET['loggedout'] == 'true') {
header('Location: ' . get_option('siteurl'));
exit;
} elseif ($this->settings->get_allow_sso_bypass() == true && (isset($_GET['use_sso']) && $_GET['use_sso'] == 'false' || isset($_POST['use_sso']) && $_POST['use_sso'] == 'false')) {
// User wants native WP login, do nothing
} else {
$redirect_url = array_key_exists('redirect_to', $_GET) ? wp_login_url($_GET['redirect_to']) : get_admin_url();
$this->saml->requireAuth(array('ReturnTo' => $redirect_url));
$attrs = $this->saml->getAttributes();
if (array_key_exists($this->settings->get_attribute('username'), $attrs) && array_key_exists($this->settings->get_attribute('email'), $attrs)) {
$username = $attrs[$this->settings->get_attribute('username')][0];
$email = $attrs[$this->settings->get_attribute('email')][0];
if (get_user_by('login', $username)) {
//$this->simulate_signon($username);
// FIX https://wordpress.org/support/topic/passwords-of-existing-users-not-working-how-to-update#post-6835783
require_once ABSPATH . WPINC . '/ms-functions.php';
$user = get_user_by('login', $username);
if ($user) {
$newpass = $this->user_password($username, $this->secretsauce);
wp_set_password($newpass, $user->ID);
wp_update_user(array('ID' => $user->ID, 'user_email' => $email));
}
$this->simulate_signon($username);
} else {
$this->new_user($attrs);
}
} else {
die('A username and email was not provided. ' . $this->support_message);
}
}
}
示例7: security_check
public function security_check($template)
{
global $woocommerce, $current_user;
//var_dump( Instore_Reports::get_report_data() );
//make sure we are on console page
if (is_page(ins_set_instore_page_id())) {
//load scripts and style
$this->load_includes();
//check if user is logged in
if (is_user_logged_in()) {
//if instore login set display console
if (isset($woocommerce->session->instore_login)) {
$template = self::load_environment();
} else {
//if user locked out, logout and redirect to wp_login and display error message, otherwise prompt for instore login pin
if (!isset($settings['lockout']) || !in_array($current_user->ID, $setting['lockout'])) {
$template = self::instore_login();
} else {
ob_start();
add_filter('login_message', 'ins_login_message');
wp_redirect(wp_logout_url(get_permalink()));
}
}
//user not logged in redirect to login page
} else {
ob_start();
wp_redirect(wp_login_url(get_permalink()));
}
}
return $template;
}
示例8: csmm_plugin_init
function csmm_plugin_init()
{
// Plugin options from the database
$signals_csmm_options = get_option('signals_csmm_options');
// Localization
load_plugin_textdomain('signals', false, SIGNALS_CSMM_PATH . 'framework/langs');
// Getting custom login URL for the admin
$signals_login_url = wp_login_url();
// Checking for the server protocol status
if (isset($_SERVER['HTTPS']) === true) {
$signals_protocol = 'https';
} else {
$signals_protocol = 'http';
}
// This is the server address of the current page
$signals_server_url = $signals_protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// Checking for the custom_login_url value
if (empty($signals_csmm_options['custom_login_url'])) {
$signals_csmm_options['custom_login_url'] = NULL;
}
// Not for the backend
// Only modifies the frontend of the system
if (!is_admin()) {
if ('1' == $signals_csmm_options['status']) {
/**
* A lot of checks are going on over here.
* We are checking for admin role, crawler status, and important wordpress pages to bypass.
* If the admin decides to exclude search engine from viewing the plugin, the website will be shown.
*/
if (false === strpos($signals_server_url, '/wp-login.php') && false === strpos($signals_server_url, '/wp-admin/') && false === strpos($signals_server_url, '/async-upload.php') && false === strpos($signals_server_url, '/upgrade.php') && false === strpos($signals_server_url, '/plugins/') && false === strpos($signals_server_url, '/xmlrpc.php') && false === strpos($signals_server_url, $signals_login_url) && false === strpos($signals_server_url, $signals_csmm_options['custom_login_url'])) {
// Checking for the search engine option
if ('1' == $signals_csmm_options['exclude_se']) {
if (!csmm_check_referrer()) {
if ('1' == $signals_csmm_options['show_logged_in']) {
// Checking if the user is logged in or not
if (!is_user_logged_in()) {
// Render the maintenance mode template since the user is not logged in
csmm_render_template($signals_csmm_options);
}
} else {
// Render the maintenance mode template
csmm_render_template($signals_csmm_options);
}
}
} else {
if ('1' == $signals_csmm_options['show_logged_in']) {
// Checking if the user is logged in or not
if (!is_user_logged_in()) {
// Render the maintenance mode template since the user is not logged in
csmm_render_template($signals_csmm_options);
}
} else {
// Render the maintenance mode template.
csmm_render_template($signals_csmm_options);
}
}
}
}
}
}
示例9: wp_new_user_notification
function wp_new_user_notification($user_id, $plaintext_pass = '')
{
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
if (empty($user_login)) {
return;
}
$user_email = stripslashes($user->user_email);
$message = sprintf(__('New user registration on your site %s:'), get_option('blogname')) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
$message .= __('Thanks!');
$headers = 'From:' . get_option('blogname') . ' <' . get_option('admin_email') . '>' . "\r\n";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message, $headers);
if (empty($plaintext_pass)) {
return;
}
$message = __('Hi there,') . "\r\n\r\n";
$message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
$message .= wp_login_url() . "\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n\r\n";
$message .= sprintf(__('If you have any problems, please contact me at %s.'), get_option('admin_email')) . "\r\n\r\n";
$message .= __('Thanks!');
$headers = 'From:' . get_option('blogname') . ' <' . get_option('admin_email') . '>' . "\r\n";
wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message, $headers);
}
示例10: add_login_link
function add_login_link()
{
global $redirect_to;
$login_uri = $this->_generate_uri($this->options['login_uri'], wp_login_url($redirect_to));
$auth_label = $this->options['auth_label'];
echo "\t" . '<p id="http-authentication-link"><a class="button-primary" href="' . htmlspecialchars($login_uri) . '">Log In with ' . htmlspecialchars($auth_label) . '</a></p>' . "\n";
}
示例11: wp_new_user_notification
/**
* Notify the blog admin of a new user, normally via email.
*
* @since 2.0
*
* @param int $user_id User ID
* @param string $plaintext_pass Optional. The user's plaintext password
*/
function wp_new_user_notification($user_id, $plaintext_pass = '', $flag='') {
if(func_num_args() > 1 && $flag !== 1)
return;
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
if ( empty($plaintext_pass) )
return;
// 你可以在此修改发送给用户的注册通知Email
$message = sprintf(__('Username: %s'), $user_login) . "\r\n";
$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
$message .= '登陆网址: ' . wp_login_url() . "\r\n";
// sprintf(__('[%s] Your username and password'), $blogname) 为邮件标题
wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
}
示例12: login_url
public function login_url()
{
$app = $this->config->item('nts_app');
$return_to = isset($GLOBALS['NTS_CONFIG'][$app]['FRONTEND_WEBPAGE']) ? $GLOBALS['NTS_CONFIG'][$app]['FRONTEND_WEBPAGE'] : get_bloginfo('wpurl');
$to = wp_login_url($return_to);
return $to;
}
示例13: theme_enqueue_styles
/**
* Scripts and styles
*/
function theme_enqueue_styles()
{
global $PNAThemeOptions;
// styles
wp_enqueue_style('parent-style', PARENT_URI . '/style.css');
wp_enqueue_style('child-style', CHILD_URI . '/css/style.css');
//scripts
wp_enqueue_script('jquery');
wp_enqueue_script('flexslider', CHILD_URI . '/js/flexslider-min.js', 'jquery', 2.1);
wp_enqueue_script('scripts', CHILD_URI . '/js/script.js', '', '');
$var_pna['signup_url'] = get_bloginfo('url') . "/cadastro";
$var_pna['login_url'] = wp_login_url(get_permalink());
if (is_page()) {
$post = get_post();
$var_pna['comments_open'] = $post->comment_status == "closed" ? true : false;
}
wp_localize_script('scripts', 'pna', $var_pna);
if (is_single() || is_page()) {
wp_enqueue_script('jquery-ui-dialog');
//se o usuário ainda nao atualizou o cadastro
if (function_exists('cdbr_current_user_updated_profile')) {
if (!cdbr_current_user_updated_profile()) {
wp_enqueue_script('msg-update-register', CHILD_URI . '/js/msg-update-register.js');
wp_localize_script('msg-update-register', 'msg', array('ajaxurl' => admin_url('admin-ajax.php'), 'cadastro_url' => get_bloginfo('url') . "/cadastro"));
wp_deregister_script('terms-of-use');
} else {
if ($PNAThemeOptions->isPopupMsgAllowed()) {
wp_enqueue_script('msg-guide-1', CHILD_URI . '/js/msg-guide.js');
wp_localize_script('msg-guide-1', 'msg', array('ajaxurl' => admin_url('admin-ajax.php'), 'termos_url' => get_bloginfo('url') . "/termos-de-uso", 'comments_gerais_url' => get_permalink() . "?comments=general"));
}
}
}
}
}
示例14: __construct
function __construct()
{
$eol = "\n";
$link = wp_login_url() . '?TB_iframe=true&width=800&height=600&sandbox=""';
parent::__construct('admin', 'js', false, 'toplevel_page_clp-settings', true);
parent::$admin_scripts .= $eol . 'jQuery(document).ready(function(){jQuery(\'#prev\').attr(\'href\', \'' . $link . '\');});' . $eol;
}
示例15: widget
/**
* create the widget's public face
*/
public function widget($args, $instance)
{
if (!isset($instance['title'])) {
$instance['title'] = '';
}
$text = __('Admin', 'teaberry');
$title = $instance['title'] == '' ? $text : $instance['title'];
$title = apply_filters('widget_title', $title);
/* before and after widget args */
echo $args['before_widget'];
if (!empty($title)) {
echo $args['before_title'] . $title . $args['after_title'];
}
echo '<ul>';
echo wp_register('<li>', '</li>', false);
$redirect = is_home() ? false : get_permalink();
/* show different link based on user status */
if (is_user_logged_in()) {
$url = wp_logout_url($redirect);
$text = __('Logout', 'teaberry');
echo '<li><a href="' . $url . '" title="Logout">' . $text . '</a></li>';
} else {
$url = wp_login_url($redirect);
$text = __('Login', 'teaberry');
echo '<li><a href="' . $url . '" title="Login">' . $text . '</a></li>';
}
echo '</ul>';
echo $args['after_widget'];
}