本文整理汇总了PHP中SwpmUtils::get_free_level方法的典型用法代码示例。如果您正苦于以下问题:PHP SwpmUtils::get_free_level方法的具体用法?PHP SwpmUtils::get_free_level怎么用?PHP SwpmUtils::get_free_level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SwpmUtils
的用法示例。
在下文中一共展示了SwpmUtils::get_free_level方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_swpm_user
private function create_swpm_user()
{
global $wpdb;
$member = SwpmTransfer::$default_fields;
$form = new SwpmFrontForm($member);
if (!$form->is_valid()) {
$message = array('succeeded' => false, 'message' => SwpmUtils::_('Please correct the following'), 'extra' => $form->get_errors());
SwpmTransfer::get_instance()->set('status', $message);
return false;
}
$member_info = $form->get_sanitized();
$free_level = SwpmUtils::get_free_level();
$account_status = SwpmSettings::get_instance()->get_value('default-account-status', 'active');
$member_info['last_accessed_from_ip'] = SwpmUtils::get_user_ip_address();
$member_info['member_since'] = date("Y-m-d");
$member_info['subscription_starts'] = date("Y-m-d");
$member_info['account_state'] = $account_status;
$plain_password = $member_info['plain_password'];
unset($member_info['plain_password']);
if (SwpmUtils::is_paid_registration()) {
$member_info['reg_code'] = '';
$member_id = filter_input(INPUT_GET, 'member_id', FILTER_SANITIZE_NUMBER_INT);
$code = filter_input(INPUT_GET, 'code', FILTER_SANITIZE_STRING);
$wpdb->update($wpdb->prefix . "swpm_members_tbl", $member_info, array('member_id' => $member_id, 'reg_code' => $code));
$query = $wpdb->prepare('SELECT membership_level FROM ' . $wpdb->prefix . 'swpm_members_tbl WHERE member_id=%d', $member_id);
$member_info['membership_level'] = $wpdb->get_var($query);
$last_insert_id = $member_id;
} else {
if (!empty($free_level)) {
$member_info['membership_level'] = $free_level;
$wpdb->insert($wpdb->prefix . "swpm_members_tbl", $member_info);
$last_insert_id = $wpdb->insert_id;
} else {
$message = array('succeeded' => false, 'message' => SwpmUtils::_('Membership Level Couldn\'t be found.'));
SwpmTransfer::get_instance()->set('status', $message);
return false;
}
}
$member_info['plain_password'] = $plain_password;
$this->member_info = $member_info;
return true;
}