本文整理汇总了PHP中SwpmUtils::is_subscription_expired方法的典型用法代码示例。如果您正苦于以下问题:PHP SwpmUtils::is_subscription_expired方法的具体用法?PHP SwpmUtils::is_subscription_expired怎么用?PHP SwpmUtils::is_subscription_expired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SwpmUtils
的用法示例。
在下文中一共展示了SwpmUtils::is_subscription_expired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_constraints
private function check_constraints()
{
if (empty($this->userData)) {
return false;
}
$enable_expired_login = SwpmSettings::get_instance()->get_value('enable-expired-account-login', '');
$can_login = true;
if ($this->userData->account_state == 'inactive') {
$this->lastStatusMsg = SwpmUtils::_('Account is inactive.');
$can_login = false;
} else {
if ($this->userData->account_state == 'pending') {
$this->lastStatusMsg = SwpmUtils::_('Account is pending.');
$can_login = false;
} else {
if ($this->userData->account_state == 'expired' && empty($enable_expired_login)) {
$this->lastStatusMsg = SwpmUtils::_('Account has expired.');
$can_login = false;
}
}
}
if (!$can_login) {
$this->isLoggedIn = false;
$this->userData = null;
return false;
}
if (SwpmUtils::is_subscription_expired($this->userData)) {
if ($this->userData->account_state == 'active') {
global $wpdb;
$wpdb->update($wpdb->prefix . 'swpm_members_tbl', array('account_state' => 'expired'), array('member_id' => $this->userData->member_id), array('%s'), array('%d'));
}
if (empty($enable_expired_login)) {
$this->lastStatusMsg = SwpmUtils::_('Account has expired.');
$this->isLoggedIn = false;
$this->userData = null;
return false;
}
}
$this->permitted = SwpmPermission::get_instance($this->userData->membership_level);
$this->lastStatusMsg = SwpmUtils::_("You are logged in as:") . $this->userData->user_name;
$this->isLoggedIn = true;
return true;
}
示例2: check_constraints
private function check_constraints()
{
if (empty($this->userData)) {
return false;
}
global $wpdb;
$enable_expired_login = SwpmSettings::get_instance()->get_value('enable-expired-account-login', '');
//Update the last accessed date and IP address for this login attempt. $wpdb->update(table, data, where, format, where format)
$last_accessed_date = current_time('mysql');
$last_accessed_ip = SwpmUtils::get_user_ip_address();
$wpdb->update($wpdb->prefix . 'swpm_members_tbl', array('last_accessed' => $last_accessed_date, 'last_accessed_from_ip' => $last_accessed_ip), array('member_id' => $this->userData->member_id), array('%s', '%s'), array('%d'));
//Check the member's account status.
$can_login = true;
if ($this->userData->account_state == 'inactive' && empty($enable_expired_login)) {
$this->lastStatusMsg = SwpmUtils::_('Account is inactive.');
$can_login = false;
} else {
if ($this->userData->account_state == 'expired' && empty($enable_expired_login)) {
$this->lastStatusMsg = SwpmUtils::_('Account has expired.');
$can_login = false;
} else {
if ($this->userData->account_state == 'pending') {
$this->lastStatusMsg = SwpmUtils::_('Account is pending.');
$can_login = false;
}
}
}
if (!$can_login) {
$this->isLoggedIn = false;
$this->userData = null;
return false;
}
if (SwpmUtils::is_subscription_expired($this->userData)) {
if ($this->userData->account_state == 'active') {
$wpdb->update($wpdb->prefix . 'swpm_members_tbl', array('account_state' => 'expired'), array('member_id' => $this->userData->member_id), array('%s'), array('%d'));
}
if (empty($enable_expired_login)) {
$this->lastStatusMsg = SwpmUtils::_('Account has expired.');
$this->isLoggedIn = false;
$this->userData = null;
return false;
}
}
$this->permitted = SwpmPermission::get_instance($this->userData->membership_level);
$this->lastStatusMsg = SwpmUtils::_("You are logged in as:") . $this->userData->user_name;
$this->isLoggedIn = true;
return true;
}