/**
  * 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);
     }
 }
 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)));
 }
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);
}
/**
 * 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()));
        }
    }
}
Exemple #5
0
/**
 * 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;
}
 /**
  *  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);
         }
     }
 }
 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;
 }
Exemple #8
0
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);
                    }
                }
            }
        }
    }
}
 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);
 }
 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";
 }
/**
 * 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);
}
Exemple #12
0
 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;
 }
/**
 *  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"));
                }
            }
        }
    }
}
 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;
 }
Exemple #15
0
 /**
  * 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'];
 }
Exemple #16
0
function facebook_login_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('text' => 'Login / Register with Facebook', 'size' => 'medium'), $atts));
    ob_start();
    global $post;
    ?>
<a href="<?php 
    echo wp_login_url();
    ?>
?loginFacebook=1&redirect=<?php 
    echo the_permalink();
    ?>
"  class="button <?php 
    echo $size;
    ?>
 facebook-button" onclick="window.location = '<?php 
    echo wp_login_url();
    ?>
?loginFacebook=1&redirect='+window.location.href; return false;"><i class="icon-facebook"></i><?php 
    echo $text;
    ?>
</a><?php 
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
function lrl_custom_form_filters($args = array(), $post_id = null)
{
    global $id;
    $options = get_option('bootstrap_theme');
    $custom_comment_message = isset($options['comment_form_text']) ? $options['comment_form_text'] : null;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '
			<div class="comment-form-author clearfix">' . ' ' . '<input id="author" name="author" placeholder="Enter your Name..." type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' />
			</div>', 'email' => '
			<div class="comment-form-email clearfix">
			' . '<input id="email" name="email" placeholder="Enter your Email Address..." type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' />
			</div>', 'url' => '
			<div class="comment-form-url clearfix">
			' . '<input id="url" name="url" placeholder="Enter your Website..." type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" />
			</div>');
    $required_text = sprintf(' ' . __('Required fields are marked %s', 'bootstrap'), '<span class="required">*</span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>', '', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'bootstrap'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'bootstrap'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => null, 'comment_notes_after' => null, 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => sprintf(__('Have a Comment?', 'bootstrap'), apply_filters('lrl_comment_form_message', $custom_comment_message)), 'title_reply_to' => __('Leave a Reply to %s', 'bootstrap'), 'cancel_reply_link' => __('Cancel', 'bootstrap'), 'label_submit' => __('Submit Comment', 'bootstrap'));
    return $defaults;
}
 protected function response_message($data)
 {
     if (!is_user_logged_in()) {
         $data['redirect'] = esc_url($_POST['current_url']);
         $data['status'] = 'error';
         $data['notice'] = sprintf(__('You must <a href="%1$s">login</a> to be able to favorite listings.', APP_TD), wp_login_url($data['redirect']));
         return $data;
     }
     $p2p = p2p_type(APP_FAVORITES_CONNECTION);
     $user_id = get_current_user_id();
     $post_id = (int) $_POST['item_id'];
     if ('add' == $_POST[$this->action_var]) {
         $date = current_time('mysql');
         $data['status'] = $p2p->connect($post_id, $user_id, array('date' => $date));
         $message = __("Added '%s' to your favorites.", APP_TD);
         $data['notice'] = sprintf($message, get_the_title($post_id));
     } else {
         $data['status'] = $p2p->disconnect($post_id, $user_id);
         $message = __("Removed '%s' from your favorites.", APP_TD);
         $data['notice'] = sprintf($message, get_the_title($post_id));
     }
     if (is_wp_error($p2p)) {
         $data['status'] = 'error';
         $message = __("Could not add '%s' to favorites at this time.", APP_TD);
         $data['notice'] = sprintf($message, get_the_title($post_id));
     }
     return $data;
 }
Exemple #19
0
    function rtmedia_login_register_modal_popup()
    {
        if (!is_user_logged_in()) {
            $uri = '';
            if (isset($_REQUEST['REQUEST_URI'])) {
                $uri = esc_url_raw(wp_unslash($_REQUEST['REQUEST_URI']));
            }
            ?>
			<div class="rtmedia-popup mfp-hide rtm-modal" id="rtmedia-login-register-modal">
				<div id="rtm-modal-container">
					<h2 class="rtm-modal-title"><?php 
            esc_html_e('Please login', 'buddypress-media');
            ?>
</h2>

					<p><?php 
            esc_html_e('You need to be logged in to upload Media or to create Album.', 'buddypress-media');
            ?>
</p>

					<p>
						<?php 
            echo esc_html__('Click', 'buddypress-media') . ' <a href="' . esc_url(wp_login_url($uri)) . '" title="' . esc_attr__('Login', 'buddypress-media') . '">' . esc_html__('HERE', 'buddypress-media') . '</a>' . esc_html__(' to login.', 'buddypress-media');
            ?>
					</p>
				</div>
			</div>
			<?php 
        }
    }
/**
 * Add the "My Account" menu and all submenus.
 *
 * @since BuddyPress (r4151)
 */
function bp_members_admin_bar_my_account_menu()
{
    global $bp, $wp_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        // User avatar
        $avatar = bp_core_fetch_avatar(array('item_id' => $bp->loggedin_user->id, 'email' => $bp->loggedin_user->userdata->user_email, 'width' => 16, 'height' => 16));
        // Unique ID for the 'My Account' menu
        $bp->my_account_menu_id = !empty($avatar) ? 'my-account-with-avatar' : 'my-account';
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'title' => $avatar . bp_get_loggedin_user_fullname(), 'href' => $bp->loggedin_user->domain));
        // 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()));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
function wp_new_user_notification_original($user_id, $plaintext_pass = '', $include_fields = false)
{
    $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";
    if ($include_fields) {
        $message .= cimy_uef_mail_fields($user);
    }
    @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
    if (empty($plaintext_pass)) {
        return;
    }
    $message = sprintf(__('Username: %s'), $user_login) . "\r\n";
    $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
    if ($include_fields) {
        $message .= cimy_uef_mail_fields($user);
    }
    $message .= wp_login_url() . "\r\n";
    wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
}
function enp_update_button_count_not_logged_in()
{
    // check if logged in is set
    $require_logged_in = enp_require_logged_in();
    if ($require_logged_in === true) {
        // throw an error
        $btn_slug = $_REQUEST['slug'];
        $pid = $_REQUEST['pid'];
        $btn_type = $_REQUEST['type'];
        // redirect url
        if ($btn_type == 'post') {
            $redirect = get_permalink($pid) . '/#enp-btns-wrap-' . $btn_type . '-' . $pid;
        } elseif ($btn_type == 'comment') {
            $redirect = get_comment_link($pid);
        } else {
            // what kind are we on then?
            $redirect = site_url();
        }
        $login_url = wp_login_url($redirect);
        // return response
        die(json_encode(array('response_status' => 'error', 'pid' => $pid, 'btn_type' => $btn_type, 'btn_slug' => $btn_slug, 'message' => 'You must be <a href="' . $login_url . '">logged in</a> to click this button. Please <a href="' . $login_url . '">Log In</a> and try again.')));
    } elseif ($require_logged_in === false) {
        // they're not logged in, and we're not requiring logged in, so we can run this
        enp_update_button_count();
    }
}
Exemple #23
0
function wc_cvo_forgot_password_link($atts, $content = '')
{
    if (is_null($content) || empty($content)) {
        $content = __('Forgot Your Password');
    }
    return '<a href="' . wp_login_url(get_permalink()) . '&action=lostpassword' . '>">' . $content . '</a>';
}
Exemple #24
0
 function enqueue_assets($output)
 {
     if (!empty($output) && !apply_filters('jp_carousel_force_enable', false)) {
         // Bail because someone is overriding the [gallery] shortcode.
         remove_filter('gallery_style', array($this, 'add_data_to_container'));
         remove_filter('wp_get_attachment_image_attributes', array($this, 'add_data_to_images'));
         return $output;
     }
     do_action('jp_carousel_thumbnails_shown');
     // Note: using  home_url() instead of admin_url() for ajaxurl to be sure  to get same domain on wpcom when using mapped domains (also works on self-hosted)
     // Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
     $is_logged_in = is_user_logged_in();
     $current_user = wp_get_current_user();
     $comment_registration = intval(get_option('comment_registration'));
     $require_name_email = intval(get_option('require_name_email'));
     $localize_strings = array('widths' => $this->prebuilt_widths, 'is_logged_in' => $is_logged_in, 'lang' => strtolower(substr(get_locale(), 0, 2)), 'ajaxurl' => set_url_scheme(admin_url('admin-ajax.php')), 'nonce' => wp_create_nonce('carousel_nonce'), 'display_exif' => true, 'display_geo' => false, 'background_color' => 'white', 'download_original' => sprintf(__('View full size <span class="photo-size">%1$s<span class="photo-size-times">&times;</span>%2$s</span>', 'jetpack'), '{0}', '{1}'), 'camera' => __('Camera', 'jetpack'), 'aperture' => __('Aperture', 'jetpack'), 'shutter_speed' => __('Shutter Speed', 'jetpack'), 'focal_length' => __('Focal Length', 'jetpack'), 'require_name_email' => $require_name_email, 'login_url' => wp_login_url(apply_filters('the_permalink', get_permalink())));
     $localize_strings = apply_filters('jp_carousel_localize_strings', $localize_strings);
     wp_localize_script('site', 'jetpackCarouselStrings', $localize_strings);
     // global $is_IE;
     // if( $is_IE )
     // {
     //   $msie = strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) + 4;
     //   $version = (float) substr( $_SERVER['HTTP_USER_AGENT'], $msie, strpos( $_SERVER['HTTP_USER_AGENT'], ';', $msie ) - $msie );
     //   if( $version < 9 )
     //     wp_enqueue_style( 'jetpack-carousel-ie8fix', plugins_url( 'jetpack-carousel-ie8fix.css', __FILE__ ), array(), $this->asset_version( '20121024' ) );
     // }
     do_action('jp_carousel_enqueue_assets', $this->first_run, $localize_strings);
     $this->first_run = false;
     return $output;
 }
Exemple #25
0
function eps_pass_protected_form()
{
    global $post;
    $input_id = 'pwbox-' . (empty($post->ID) ? rand() : $post->ID);
    $form = '<form class="form-inline" action="' . esc_url(wp_login_url() . '?action=postpass') . '" method="post">' . '	<p>' . __('This content is password protected. To view it please enter your password below:', 'epsilon') . '</p>' . '	<div class="form-group">' . '		<label for="' . $input_id . '">' . __('Password:'******'epsilon') . '</label>' . '		<div class="input-group">' . '			<input type="password" class="form-control" id="' . $input_id . '" name="post_password">' . '			<span class="input-group-btn">' . '				<button class="btn btn-primary" type="submit" name="Submit">' . esc_attr__('Submit', 'epsilon') . '</button>' . '			</span>' . '		</div>' . '	</div>' . '</form>';
    return $form;
}
 function wp_new_user_notification($user_id, $deprecated = null, $notify = '')
 {
     if ($deprecated !== null) {
         _deprecated_argument(__FUNCTION__, '4.3.1');
     }
     // `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation.
     if ('admin' === $notify || empty($deprecated) && empty($notify)) {
         return;
     }
     global $wpdb, $wp_hasher;
     $user = get_userdata($user_id);
     // 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);
     // Generate something random for a password reset key.
     $key = wp_generate_password(20, false);
     /** This action is documented in wp-login.php */
     do_action('retrieve_password_key', $user->user_login, $key);
     // Now insert the key, hashed, into the DB.
     if (empty($wp_hasher)) {
         require_once ABSPATH . WPINC . '/class-phpass.php';
         $wp_hasher = new PasswordHash(8, true);
     }
     $hashed = time() . ':' . $wp_hasher->HashPassword($key);
     $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user->user_login));
     $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
     $message .= __('To set your password, visit the following address:') . "\r\n\r\n";
     $message .= '<' . network_site_url("wp-login.php?action=rp&key={$key}&login="******">\r\n\r\n";
     $message .= wp_login_url() . "\r\n";
     wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
 }
    function rtmedia_login_register_modal_popup()
    {
        if (!is_user_logged_in()) {
            ?>
            <div class="rtmedia-popup mfp-hide rtm-modal" id="rtmedia-login-register-modal">
                <div id="rtm-modal-container">
                    <h2 class="rtm-modal-title"><?php 
            _e('Please login', 'buddypress-media');
            ?>
</h2>

                    <p><?php 
            _e("You need to be logged in to upload Media or to create Album.", 'buddypress-media');
            ?>
</p>

                    <p>
                        <?php 
            echo __('Click', 'buddypress-media') . ' <a href="' . wp_login_url($_SERVER['REQUEST_URI']) . '" title="' . __('Login', 'buddypress-media') . '">' . __('HERE', 'buddypress-media') . '</a>' . __(' to login.', 'buddypress-media');
            ?>
                    </p>
                </div>
            </div>
            <?php 
        }
    }
Exemple #28
0
 /**
  * Add front-end notices.
  */
 public function ticket_form_message()
 {
     /** @var $camptix CampTix_Plugin */
     global $camptix;
     // Warn users that they will need to login to purchase a ticket
     if (!is_user_logged_in()) {
         $camptix->notice(apply_filters('camptix_require_login_please_login_message', sprintf(__('Please <a href="%s">log in</a> or <a href="%s">create an account</a> to purchase your tickets.', 'camptix'), wp_login_url(add_query_arg($_REQUEST, $this->get_redirect_return_url())), wp_registration_url())));
     }
     // Inform a user registering multiple attendees that other attendees will enter their own info
     if (isset($_REQUEST['tix_action']) && 'attendee_info' == $_REQUEST['tix_action'] && $this->registering_multiple_attendees($_REQUEST['tix_tickets_selected'])) {
         $notice = __('<p>Please enter your own information for the first ticket, and then enter the names and e-mail addresses of other attendees in the subsequent ticket fields.</p>', 'camptix');
         if ($this->tickets_have_questions($_REQUEST['tix_tickets_selected'])) {
             $notice .= __('<p>The other attendees will receive an e-mail asking them to confirm their registration and enter their additional information.</p>', 'camptix');
         }
         $camptix->notice($notice);
     }
     // Ask the attendee to confirm their registration
     if (isset($_REQUEST['tix_action']) && 'edit_attendee' == $_REQUEST['tix_action'] && self::UNCONFIRMED_USERNAME == get_post_meta($_REQUEST['tix_attendee_id'], 'tix_username', true)) {
         $tickets_selected = array(get_post_meta($_REQUEST['tix_attendee_id'], 'tix_ticket_id', true) => 1);
         // mimic $_REQUEST['tix_tickets_selected']
         if ($this->tickets_have_questions($tickets_selected)) {
             $notice = __('To complete your registration, please fill out the fields below, and then click on the Confirm Registration button.', 'camptix');
         } else {
             $notice = __('To complete your registration, please verify that all of the information below is correct, and then click on the Confirm Registration button.', 'camptix');
         }
         $camptix->notice($notice);
     }
 }
Exemple #29
0
/**
 * Shortcode hook to display output HTML from CubePM
 * 
 * @todo Add support for blogs without permalink enabled
 * 
 * @param array $atts An associative array of attributes
 * @return string HTML output of CubePM
 */
function cpm_shortcode($atts)
{
    $html = '<div class="cubepm">';
    if (is_user_logged_in()) {
        $html .= cpm_header();
        $cpm_action = $_GET['cpm_action'];
        switch ($cpm_action) {
            default:
            case 'inbox':
                $html .= cpm_page_inbox();
                break;
            case 'new':
                $html .= cpm_page_new();
                break;
            case 'read':
                $html .= cpm_page_read();
                break;
            case 'admin-inbox':
                if (current_user_can('administrator')) {
                    $html .= cpm_page_admin_inbox();
                } else {
                    $html .= cpm_page_inbox();
                }
        }
    } else {
        $html .= '<p>' . __('You have to be logged in to use Private Messaging.', 'cubepm') . '<br /><a href="' . wp_login_url(site_url($_SERVER["REQUEST_URI"])) . '">' . __('Click here to login', 'cubepm') . ' &raquo;</a></p>';
    }
    $html .= '</div>';
    return $html;
}
    function sso_determine_script_to_head()
    {
        $options = get_option('wp_auth0_settings');
        $array_key_exists = array_key_exists("client_id", $options);
        if ($array_key_exists) {
            $client_id = $options[client_id];
            $domain = $options[domain];
            $cdn = $options[cdn_url];
            ?>
			<script id="auth0" src=" <?php 
            echo $cdn;
            ?>
 "></script>
			<script type='text/javascript'>
				document.addEventListener("DOMContentLoaded", function(event) {
					var lock = new Auth0Lock('<?php 
            echo $client_id;
            ?>
', '<?php 
            echo $domain;
            ?>
');
					lock.$auth0.getSSOData(function(err, data) {
						if (!err && data.sso) {
							<?php 
            echo 'window.location = "' . wp_login_url($_SERVER['REQUEST_URI']) . '&reauth=1"';
            ?>
						}
					});
				});
			</script>
			<?php 
        }
    }