本文整理匯總了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;
}