예제 #1
0
 /**
  * Email login credentials to a newly-registered user.
  *
  * A new user registration notification is also sent to admin email.
  *
  * @since 0.0.1
  * @since 0.0.1
  * @since 0.0.1
  *
  * @global hqdb         $hqdb      HiveQueen database object for queries.
  * @global PasswordHash $hq_hasher Portable PHP password hashing framework instance.
  *
  * @param int    $user_id    User ID.
  * @param null   $deprecated Not used (argument deprecated).
  * @param string $notify     Optional. Type of notification that should happen. Accepts 'admin' or an empty
  *                           string (admin only), or 'both' (admin and user). The empty string value was kept
  *                           for backward-compatibility purposes with the renamed parameter. Default empty.
  */
 function hq_new_user_notification($user_id, $deprecated = null, $notify = '')
 {
     if ($deprecated !== null) {
         _deprecated_argument(__FUNCTION__, '4.3.1');
     }
     global $hqdb, $hq_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 = hq_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->user_login) . "\r\n\r\n";
     $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n";
     @hq_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     if ('admin' === $notify || empty($notify)) {
         return;
     }
     // Generate something random for a password reset key.
     $key = hq_generate_password(20, false);
     /** This action is documented in hq-login.php */
     do_action('retrieve_password_key', $user->user_login, $key);
     // Now insert the key, hashed, into the DB.
     if (empty($hq_hasher)) {
         require_once ABSPATH . HQINC . '/class-phpass.php';
         $hq_hasher = new PasswordHash(8, true);
     }
     $hashed = time() . ':' . $hq_hasher->HashPassword($key);
     $hqdb->update($hqdb->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("hq-login.php?action=rp&key={$key}&login="******">\r\n\r\n";
     $message .= hq_login_url() . "\r\n";
     hq_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
 }
예제 #2
0
/**
 * Display the Log In/Out link.
 *
 * Displays a link, which allows users to navigate to the Log In page to log in
 * or log out depending on whether they are currently logged in.
 *
 * @since 0.0.1
 *
 * @param string $redirect Optional path to redirect to on login/logout.
 * @param bool   $echo     Default to echo and not return the link.
 * @return string|void String when retrieving.
 */
function hq_loginout($redirect = '', $echo = true)
{
    if (!is_user_logged_in()) {
        $link = '<a href="' . esc_url(hq_login_url($redirect)) . '">' . __('Log in') . '</a>';
    } else {
        $link = '<a href="' . esc_url(hq_logout_url($redirect)) . '">' . __('Log out') . '</a>';
    }
    if ($echo) {
        /**
         * Filter the HTML output for the Log In/Log Out link.
         *
         * @since 0.0.1
         *
         * @param string $link The HTML link content.
         */
        echo apply_filters('loginout', $link);
    } else {
        /** This filter is documented in hq-includes/general-template.php */
        return apply_filters('loginout', $link);
    }
}
예제 #3
0
 /**
  * Notifies the site admin that the setup is complete.
  *
  * Sends an email with hq_mail to the new administrator that the site setup is complete,
  * and provides them with a record of their login credentials.
  *
  * @since 0.0.1
  *
  * @param string $blog_title Blog title.
  * @param string $blog_url   Blog url.
  * @param int    $user_id    User ID.
  * @param string $password   User's Password.
  */
 function hq_new_blog_notification($blog_title, $blog_url, $user_id, $password)
 {
     $user = new HQ_User($user_id);
     $email = $user->user_email;
     $name = $user->user_login;
     $login_url = hq_login_url();
     $message = sprintf(__("Your new HiveQueen site has been successfully set up at:\n\n%1\$s\n\nYou can log in to the administrator account with the following information:\n\nUsername: %2\$s\nPassword: %3\$s\nLog in here: %4\$s\n\nWe hope you enjoy your new site. Thanks!\n\n--The HiveQueen Team\nhttps://github.com/gcorral/hivequeen\n"), $blog_url, $name, $password, $login_url);
     @hq_mail($email, __('New HiveQueen Site'), $message);
 }
예제 #4
0
        ?>
</p>
	<br class="clear" />
	<input type="hidden" name="redirect_to" value="<?php 
        echo esc_attr($redirect_to);
        ?>
" />
	<p class="submit"><input type="submit" name="hq-submit" id="hq-submit" class="button button-primary button-large" value="<?php 
        esc_attr_e('Register');
        ?>
" /></p>
</form>

<p id="nav">
<a href="<?php 
        echo esc_url(hq_login_url());
        ?>
"><?php 
        _e('Log in');
        ?>
</a> |
<a href="<?php 
        echo esc_url(hq_lostpassword_url());
        ?>
" title="<?php 
        esc_attr_e('Password Lost and Found');
        ?>
"><?php 
        _e('Lost your password?');
        ?>
</a>