コード例 #1
0
ファイル: header.php プロジェクト: nacheal/V2Press
        ?>
          <li><a href="<?php 
        echo admin_url();
        ?>
" title="<?php 
        _ex('Admin', 'menu', 'v2press');
        ?>
"><?php 
        _ex('Admin', 'menu', 'v2press');
        ?>
</a></li>
          <?php 
    }
    ?>
          <li><a href="<?php 
    echo wp_logout_url(vp_current_url());
    ?>
" title="<?php 
    _ex('Signout', 'menu', 'v2press');
    ?>
"><?php 
    _ex('Signout', 'menu', 'v2press');
    ?>
</a></li>
        </ul>
      <?php 
}
// END if is_user_logged_in
?>
      </nav>
      
コード例 #2
0
ファイル: member.php プロジェクト: nacheal/V2Press
/**
 * Do the change password form process.
 *
 * @since 0.0.1
 */
function vp_do_change_password()
{
    if (isset($_POST['vp_current_password']) && wp_verify_nonce($_POST['vp_change_password_nonce'], 'vp-change-password-nonce')) {
        $current_pwd = $_POST['vp_current_password'];
        $new_pwd = $_POST['vp_new_password'];
        $new_pwd_confirm = $_POST['vp_new_password_confirmation'];
        // Current password empty
        if (empty($current_pwd)) {
            vp_errors()->add('current_password_empty', __('Please enter your current password', 'v2press'));
        }
        // New password empty
        if (empty($new_pwd)) {
            vp_errors()->add('new_password_empty', __('Please enter your new password.', 'v2press'));
        }
        // Password confirmation empty
        if (empty($new_pwd_confirm)) {
            vp_errors()->add('new_password_confirmation_empty', __('Please retype your new password.', 'v2press'));
        }
        // Not use your current password again
        if (!empty($current_pwd) && !empty($new_pwd) && $new_pwd == $current_pwd) {
            vp_errors()->add('password_used', __('Please user a password different from current one.', 'v2press'));
        }
        // Password confirmation incorrect
        if (!empty($new_pwd) && !empty($new_pwd_confirm) && $new_pwd !== $new_pwd_confirm) {
            vp_errors()->add('password_mismatch', __('Passwords do not match', 'v2press'));
        }
        $errors = vp_errors()->get_error_messages();
        if (empty($errors)) {
            $user_data = array('ID' => wp_get_current_user()->ID, 'user_pass' => $new_pwd);
            wp_update_user($user_data);
            wp_redirect(add_query_arg('cp', 'true', vp_current_url() . '#change-password-box'));
            exit;
        }
    }
    // END if isset( $_POST['vp_current_password'] )
}