如果用户没有选中记住我,他们会保持登录多长时间?

时间:2015-05-21 作者:Pete

正如标题所述,我想知道如果用户不选中“记住我”选项,他们会登录多久。我听说,如果他们确实检查了它,它可以让他们登录14天。

但如果他们没有呢?我已尝试关闭浏览器并重新打开,但用户仍保持登录状态。。。所以这看起来不像是一个单独的会议。

1 个回复
最合适的回答,由SO网友:s_ha_dum 整理而成

Take a look at the source:

832         if ( $remember ) {
833                 /**
834                  * Filter the duration of the authentication cookie expiration period.
835                  *
836                  * @since 2.8.0
837                  *
838                  * @param int  $length   Duration of the expiration period in seconds.
839                  * @param int  $user_id  User ID.
840                  * @param bool $remember Whether to remember the user login. Default false.
841                  */
842                 $expiration = time() + apply_filters( \'auth_cookie_expiration\', 14 * DAY_IN_SECONDS, $user_id, $remember );
843 
844                 /*
845                  * Ensure the browser will continue to send the cookie after the expiration time is reached.
846                  * Needed for the login grace period in wp_validate_auth_cookie().
847                  */
848                 $expire = $expiration + ( 12 * HOUR_IN_SECONDS );
849         } else {
850                 /** This filter is documented in wp-includes/pluggable.php */
851                 $expiration = time() + apply_filters( \'auth_cookie_expiration\', 2 * DAY_IN_SECONDS, $user_id, $remember );
852                 $expire = 0;
853         }
Ir“;记住;是否已检查14 * DAY_IN_SECONDS, 第842行。如果没有,你有2 * DAY_IN_SECONDS, 第851行。

请注意,该函数是可插入的auth_cookie_expiration 过滤器可用于更改这两个值。

结束

相关推荐

深度定制wp-login.php

我正在开发一个intranet平台(因此没有外部web访问),并使用Password only login 插件。我需要对wp-login.php 页码:我链接的插件只允许选定用户使用密码登录。为此,它提供了pol_showform() 将函数放置在您希望显示自定义登录表单(仅限密码)的位置</由于并非所有用户都只允许使用密码登录,我需要保留“经典登录表单”。为此,我想转换“经典登录表单”,添加一个jQuery选项卡:在第一个选项卡中将出现“仅密码登录”(由pol_showform() 函数),在第