本文整理汇总了PHP中delete_user_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_user_setting函数的具体用法?PHP delete_user_setting怎么用?PHP delete_user_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_user_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Remove_password_nag_if_browserid_registration
public function Remove_password_nag_if_browserid_registration()
{
global $user_ID;
$registered_with_browserid = get_user_meta($user_ID, 'browserid_registration', true);
if ($registered_with_browserid === true) {
delete_user_setting('default_password_nag', $user_ID);
update_user_option($user_ID, 'default_password_nag', false, true);
}
}
示例2: wp_new_user_notification
function wp_new_user_notification($user_id, $plaintext_pass = '')
{
global $wpdb, $mySabre;
$user = new WP_User($user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
$message = sprintf(__('New user registration on your site %s:', 'sabre'), get_option('blogname')) . "\r\n\r\n";
$message .= sprintf(__('Username: %s', 'sabre'), $user_login) . "\r\n\r\n";
$message .= sprintf(__('E-mail: %s', 'sabre'), $user_email) . "\r\n";
$sabre_opt = $mySabre->get_option('sabre_opt');
$mail_from = "From: ";
$mail_from .= (!empty($sabre_opt['mail_from_name']) ? $sabre_opt['mail_from_name'] : get_option('blogname')) . " <";
$mail_from .= (!empty($sabre_opt['mail_from_mail']) ? $sabre_opt['mail_from_mail'] : get_option('admin_email')) . ">";
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration', 'sabre'), get_option('blogname')), $message, $mail_from);
if (empty($plaintext_pass)) {
return;
}
if ($sabre_opt['user_pwd'] == 'true') {
$plaintext_pass = $_POST['user_pwd1'];
wp_set_password($plaintext_pass, $user_id);
delete_user_setting('default_password_nag', $user_id);
update_user_option($user_id, 'default_password_nag', false, true);
}
$message = sprintf(__('Thank you for registering on %s', 'sabre'), get_option('blogname')) . "\r\n\r\n";
$message .= sprintf(__('Username: %s', 'sabre'), $user_login) . "\r\n";
if ($sabre_opt['user_pwd'] == 'true') {
$message .= __('Use the password defined during your registration', 'sabre') . "\r\n\r\n";
} else {
$message .= sprintf(__('Password: %s', 'sabre'), $plaintext_pass) . "\r\n\r\n";
}
if ($sabre_opt['enable_confirm'] == 'user') {
$message .= sprintf(__ngettext('You must confirm your registration within %s day by following the link below', 'You must confirm your registration within %s days by following the link below', $sabre_opt['period'], 'sabre'), $sabre_opt['period']) . "\r\n\r\n";
$message .= get_option('siteurl') . "/wp-login.php?sabre_confirm=" . md5($_POST['sabre_id']) . "\r\n";
} elseif ($sabre_opt['enable_confirm'] == 'admin') {
$message .= __('Your registration has to be validated by the administrator before you can sign on the site. You will be advised by e-mail upon completion.', 'sabre') . "\r\n\r\n";
$message .= get_option('siteurl') . "/wp-login.php\r\n";
} else {
$message .= get_option('siteurl') . "/wp-login.php\r\n";
}
wp_mail($user_email, sprintf(__('[%s] - Your registration information', 'sabre'), get_option('blogname')), $message, $mail_from);
}
示例3: login_redirect
/**
* Handles login redirections.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @attaches-to ``add_action('wp_login');``
*
* @param string $username Expects Username.
* @param WP_User $user Expects a WP_User object instance.
*
* @return null Or exits script execution after a redirection takes place.
*/
public static function login_redirect($username = '', $user = NULL)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_login_redirect', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
$ci = $GLOBALS['WS_PLUGIN__']['s2member']['o']['ruris_case_sensitive'] ? '' : 'i';
if (is_string($username) && $username && is_object($user) && !empty($user->ID) && ($user_id = $user->ID)) {
update_user_option($user_id, 's2member_last_login_time', time());
$logins = (int) get_user_option('s2member_login_counter', $user_id) + 1;
update_user_option($user_id, 's2member_login_counter', $logins);
if (!get_user_option('s2member_registration_ip', $user_id)) {
update_user_option($user_id, 's2member_registration_ip', $_SERVER['REMOTE_ADDR']);
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password']) {
delete_user_setting('default_password_nag');
update_user_option($user_id, 'default_password_nag', FALSE, TRUE);
}
$ok = TRUE;
// Initialize IP restriction being OK here. This is for filters.
if ($username !== 'demo' && !is_super_admin($user_id) && !apply_filters('ws_plugin__s2member_disable_login_ip_restrictions', $user->has_cap('edit_posts') ? TRUE : FALSE, get_defined_vars())) {
$ok = c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok($_SERVER['REMOTE_ADDR'], strtolower($username));
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_always_http']) {
// Alter value of `redirect_to`?
if (!empty($_REQUEST['redirect_to']) && is_string($_REQUEST['redirect_to']) && strpos($_REQUEST['redirect_to'], 'wp-admin') === FALSE) {
$_REQUEST['redirect_to'] = preg_replace('/^https\\:\\/\\//i', 'http://', $_REQUEST['redirect_to']);
if (stripos($_REQUEST['redirect_to'], 'http://') !== 0) {
$redirect_uri = $_REQUEST['redirect_to'];
// e.g., `/path/with/?query=args`
$home_path = trim((string) @parse_url(home_url('/'), PHP_URL_PATH), '/');
$http_home_base = trim(preg_replace('/\\/' . preg_quote($home_path, '/') . '\\/$/' . $ci, '', home_url('/', 'http')), '/');
$_REQUEST['redirect_to'] = $http_home_base . '/' . ltrim($redirect_uri, '/');
}
}
}
if ($redirect = apply_filters('ws_plugin__s2member_login_redirect', $user->has_cap('edit_posts') ? FALSE : TRUE, get_defined_vars())) {
$obey_redirect_to = apply_filters('ws_plugin__s2member_obey_login_redirect_to', TRUE, get_defined_vars());
if ($obey_redirect_to && (empty($_REQUEST['redirect_to']) || !is_string($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] === admin_url() || preg_match('/^\\/?wp-admin\\/?$/' . $ci, $_REQUEST['redirect_to']))) {
$obey_redirect_to = FALSE;
} else {
if ($obey_redirect_to && !empty($_REQUEST['redirect_to_automatic']) && is_string($redirect)) {
$obey_redirect_to = FALSE;
}
}
// Do not obey automatic redirects when a custom redirection filter applies.
// ↑ NOTE: this will apply to s2Member Pro's One-Time-Offers (Upon Login) also.
if (!$obey_redirect_to) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_login_redirect', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
$is_lwp = FALSE;
// Initialize LWP detection flag.
if ($redirect && is_string($redirect)) {
$redirect = $redirect;
} else {
if ($login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user)) {
$is_lwp = TRUE;
// Flag as being a hard-coded LWP URL in this case.
$redirect = $login_redirection_url;
// Special redirection URL.
} else {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']) {
$is_lwp = TRUE;
// Flag as being a hard-coded LWP URL in this case.
$redirect = get_page_link($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']);
} else {
$redirect = home_url('/');
}
}
}
// Default to the home page.
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_always_http']) {
$redirect = preg_replace('/^https\\:\\/\\//i', 'http://', $redirect);
if (stripos($redirect, 'http://') !== 0) {
$redirect_uri = $redirect;
// e.g., `/path/with/?query=args`
$home_path = trim((string) @parse_url(home_url('/'), PHP_URL_PATH), '/');
$http_home_base = trim(preg_replace('/\\/' . preg_quote($home_path, '/') . '\\/$/' . $ci, '', home_url('/', 'http')), '/');
$redirect = $http_home_base . '/' . ltrim($redirect_uri, '/');
}
}
//.........这里部分代码省略.........
示例4: default_password_nag_edit_user
function default_password_nag_edit_user($user_ID, $old_data)
{
if (!get_user_option('default_password_nag', $user_ID)) {
//Short circuit it.
return;
}
$new_data = get_userdata($user_ID);
if ($new_data->user_pass != $old_data->user_pass) {
//Remove the nag if the password has been changed.
delete_user_setting('default_password_nag', $user_ID);
update_user_option($user_ID, 'default_password_nag', false, true);
}
}
示例5: wp_menu_unfold
function wp_menu_unfold() {
if ( isset($_GET['unfoldmenu']) ) {
delete_user_setting('mfold');
wp_redirect( remove_query_arg( 'unfoldmenu', stripslashes($_SERVER['REQUEST_URI']) ) );
exit;
}
}
示例6: xt_register_remove_default_password_nag
function xt_register_remove_default_password_nag()
{
global $user_ID;
delete_user_setting('default_password_nag', $user_ID);
update_user_option($user_ID, 'default_password_nag', false, true);
}
示例7: login_redirect
/**
* Handles login redirections.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @attaches-to ``add_action("wp_login");``
*
* @param str $username Expects Username.
* @param WP_User $user Expects a WP_User object instance.
* @return null Or exits script execution after a redirection takes place.
*/
public static function login_redirect($username = FALSE, $user = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_login_redirect", get_defined_vars());
unset($__refs, $__v);
if (is_string($username) && $username && is_object($user) && !empty($user->ID) && ($user_id = $user->ID)) {
update_user_option($user_id, "s2member_last_login_time", time());
if (!get_user_option("s2member_registration_ip", $user_id)) {
update_user_option($user_id, "s2member_registration_ip", $_SERVER["REMOTE_ADDR"]);
}
if (($logins = (int) get_user_option("s2member_login_counter", $user_id) + 1) >= 1 || ($logins = 1)) {
update_user_option($user_id, "s2member_login_counter", $logins);
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) {
delete_user_setting("default_password_nag") . update_user_option($user_id, "default_password_nag", false, true);
}
$disable_login_ip_restrictions = apply_filters("ws_plugin__s2member_disable_login_ip_restrictions", false, get_defined_vars());
if (($ok = true) && !is_super_admin($user_id) && $username !== "demo" && !$disable_login_ip_restrictions) {
$ok = c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok($_SERVER["REMOTE_ADDR"], $username);
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_always_http"]) {
// Alter value of `redirect_to`?
if (!empty($_REQUEST["redirect_to"]) && is_string($_REQUEST["redirect_to"]) && strpos($_REQUEST["redirect_to"], "wp-admin") === FALSE) {
$_REQUEST["redirect_to"] = preg_replace("/^https\\:\\/\\//i", "http://", $_REQUEST["redirect_to"]);
if (stripos($_REQUEST["redirect_to"], "http://") !== 0) {
// Force an absolute URL in this case.
$_REQUEST["redirect_to"] = home_url($_REQUEST["redirect_to"], "http");
}
}
}
if ($redirect = apply_filters("ws_plugin__s2member_login_redirect", $user->has_cap("edit_posts") ? false : true, get_defined_vars())) {
$obey_redirect_to = apply_filters("ws_plugin__s2member_obey_login_redirect_to", true, get_defined_vars());
if (!$obey_redirect_to || empty($_REQUEST["redirect_to"]) || !is_string($_REQUEST["redirect_to"]) || $_REQUEST["redirect_to"] === admin_url() || preg_match("/^\\/?wp-admin\\/?\$/", $_REQUEST["redirect_to"])) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_during_login_redirect", get_defined_vars());
unset($__refs, $__v);
if ($redirect && is_string($redirect)) {
$redirect = $redirect;
} else {
if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user)) {
$redirect = $redirection_url;
} else {
// Else we use the Login Welcome Page configured for s2Member.
$redirect = get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]);
}
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_always_http"]) {
$redirect = preg_replace("/^https\\:\\/\\//i", "http://", $redirect);
if (stripos($redirect, "http://") !== 0) {
// Force an absolute URL in this case.
$redirect = home_url($redirect, "http");
}
}
wp_redirect($redirect) . exit;
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_after_login_redirect", get_defined_vars());
unset($__refs, $__v);
return;
}
示例8: configure_user_registration
//.........这里部分代码省略.........
}
if (!($lname = $user->last_name)) {
if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_last_name"])) {
$lname = (string) $_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
}
}
if (!$lname) {
// Also try BuddyPress.
if (!empty($_pmr["field_1"]) && preg_match("/^(.+?) (.+)\$/", (string) $_pmr["field_1"])) {
$lname = trim(preg_replace("/^(.+?) (.+)\$/", "\$2", (string) $_pmr["field_1"]));
}
}
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname && $login) {
$fname = trim($login);
$lname = "";
}
// Username and empty Last Name.
$name = trim($fname . " " . $lname);
// Both names.
if (!($pass = $password)) {
// Try s2Member's generator.
if (!empty($GLOBALS["ws_plugin__s2member_generate_password_return"])) {
$pass = (string) $GLOBALS["ws_plugin__s2member_generate_password_return"];
}
}
if (!$pass) {
// Also try BuddyPress Password.
if (!empty($_pmr["signup_password"])) {
// BuddyPress?
$pass = (string) $_pmr["signup_password"];
}
}
if ($pass) {
!headers_sent() ? delete_user_setting("default_password_nag", $user_id) : null;
update_user_option($user_id, "default_password_nag", false, true);
}
update_user_option($user_id, "s2member_registration_ip", $ip);
update_user_option($user_id, "s2member_auto_eot_time", $auto_eot_time);
update_user_option($user_id, "s2member_subscr_gateway", $subscr_gateway);
update_user_option($user_id, "s2member_subscr_id", $subscr_id);
update_user_option($user_id, "s2member_custom", $custom);
update_user_option($user_id, "s2member_notes", $notes);
if (!$user->first_name && $fname) {
update_user_meta($user_id, "first_name", $fname);
}
if (!$user->last_name && $lname) {
update_user_meta($user_id, "last_name", $lname);
}
if (!$user->display_name || $user->display_name === $user->user_login) {
if ($custom_reg_display_name === "full" && $name) {
wp_update_user(array("ID" => $user_id, "display_name" => $name));
} else {
if ($custom_reg_display_name === "first" && $fname) {
wp_update_user(array("ID" => $user_id, "display_name" => $fname));
} else {
if ($custom_reg_display_name === "last" && $lname) {
wp_update_user(array("ID" => $user_id, "display_name" => $lname));
} else {
if ($custom_reg_display_name === "login" && $login) {
wp_update_user(array("ID" => $user_id, "display_name" => $login));
}
}
}
}
}
if (is_multisite()) {
示例9: upgrade_450
/**
* Executes changes made in WordPress 4.5.0.
*
* @ignore
* @since 4.5.0
*
* @global int $wp_current_db_version Current database version.
* @global wpdb $wpdb WordPress database abstraction object.
*/
function upgrade_450()
{
global $wp_current_db_version, $wpdb;
if ($wp_current_db_version < 36180) {
wp_clear_scheduled_hook('wp_maybe_auto_update');
}
// Remove unused email confirmation options, moved to usermeta.
if ($wp_current_db_version < 36679 && is_multisite()) {
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name REGEXP '^[0-9]+_new_email\$'");
}
// Remove unused user setting for wpLink.
delete_user_setting('wplink');
}
示例10: configure_user_registration
//.........这里部分代码省略.........
}
if (!($lname = $user->last_name)) {
if (!empty($_pmr['ws_plugin__s2member_custom_reg_field_last_name'])) {
$lname = (string) $_pmr['ws_plugin__s2member_custom_reg_field_last_name'];
}
}
if (!$lname) {
// Also try BuddyPress.
if (!empty($_pmr['field_1']) && preg_match('/^(.+?) (.+)$/', (string) $_pmr['field_1'])) {
$lname = trim(preg_replace('/^(.+?) (.+)$/', '$2', (string) $_pmr['field_1']));
}
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_names'] && !$fname && $login) {
$fname = trim($login);
$lname = '';
// Username and empty Last Name.
}
$name = trim($fname . ' ' . $lname);
// Both names.
if (!($pass = $password)) {
// Try s2Member's generator.
if (!empty($GLOBALS['ws_plugin__s2member_plain_text_pass'])) {
$pass = (string) $GLOBALS['ws_plugin__s2member_plain_text_pass'];
}
}
if (!$pass) {
// Also try BuddyPress Password.
if (!empty($_pmr['signup_password'])) {
// BuddyPress?
$pass = (string) $_pmr['signup_password'];
}
}
if ($pass) {
!headers_sent() ? delete_user_setting('default_password_nag', $user_id) : NULL;
update_user_option($user_id, 'default_password_nag', FALSE, TRUE);
}
update_user_option($user_id, 's2member_registration_ip', $ip);
update_user_option($user_id, 's2member_auto_eot_time', $auto_eot_time);
update_user_option($user_id, 's2member_subscr_gateway', $subscr_gateway);
update_user_option($user_id, 's2member_subscr_id', $subscr_id);
update_user_option($user_id, 's2member_subscr_baid', $subscr_baid);
update_user_option($user_id, 's2member_subscr_cid', $subscr_cid);
update_user_option($user_id, 's2member_custom', $custom);
update_user_option($user_id, 's2member_notes', $notes);
if (!$user->first_name && $fname) {
update_user_meta($user_id, 'first_name', $fname);
}
if (!$user->last_name && $lname) {
update_user_meta($user_id, 'last_name', $lname);
}
if (!$user->display_name || $user->display_name === $user->user_login) {
if ($custom_reg_display_name === 'full' && $name) {
wp_update_user(wp_slash(array('ID' => $user_id, 'display_name' => $name)));
} else {
if ($custom_reg_display_name === 'first' && $fname) {
wp_update_user(wp_slash(array('ID' => $user_id, 'display_name' => $fname)));
} else {
if ($custom_reg_display_name === 'last' && $lname) {
wp_update_user(wp_slash(array('ID' => $user_id, 'display_name' => $lname)));
} else {
if ($custom_reg_display_name === 'login' && $login) {
wp_update_user(wp_slash(array('ID' => $user_id, 'display_name' => $login)));
}
}
}
}
示例11: login_redirect
/**
* Handles login redirections.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @attaches-to ``add_action("wp_login");``
*
* @param str $username Expects Username to be passed in by the Action Hook.
* @return null Or exits script execution after a redirection takes place.
*/
public static function login_redirect($username = FALSE)
{
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_before_login_redirect", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
$username = !$username && is_object($user = wp_get_current_user()) && !empty($user->user_login) ? strtolower($user->user_login) : strtolower($username);
/**/
if ($username && (isset($user) && is_object($user) || is_object($user = new WP_User($username))) && !empty($user->ID) && ($user_id = $user->ID)) {
if (!get_user_option("s2member_registration_ip", $user_id)) {
/* Have we got this yet? */
update_user_option($user_id, "s2member_registration_ip", $_SERVER["REMOTE_ADDR"]);
}
/**/
if (($logins = (int) get_user_option("s2member_login_counter", $user_id) + 1) >= 1 || ($logins = 1)) {
update_user_option($user_id, "s2member_login_counter", $logins);
}
/**/
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) {
/* Nag em? */
delete_user_setting("default_password_nag") . update_user_option($user_id, "default_password_nag", false, true);
}
/**/
$disable_login_ip_restrictions = apply_filters("ws_plugin__s2member_disable_login_ip_restrictions", false, get_defined_vars());
/**/
if (($ok = true) && !is_super_admin($user_id) && $username !== "demo" && !$disable_login_ip_restrictions) {
$ok = c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok($_SERVER["REMOTE_ADDR"], $username);
}
/**/
if ($redirect = apply_filters("ws_plugin__s2member_login_redirect", $user->has_cap("edit_posts") ? false : true, get_defined_vars())) {
$obey_redirect_to = apply_filters("ws_plugin__s2member_obey_login_redirect_to", true, get_defined_vars());
/**/
if (!$obey_redirect_to || empty($_REQUEST["redirect_to"]) || !is_string($_REQUEST["redirect_to"]) || $_REQUEST["redirect_to"] === admin_url() || preg_match("/^\\/?wp-admin\\/?\$/", $_REQUEST["redirect_to"])) {
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_during_login_redirect", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
if ($redirect && is_string($redirect)) {
/* Is this a string? */
wp_redirect($redirect);
} else {
if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user)) {
wp_redirect($redirection_url);
} else {
/* Else we use the Login Welcome Page configured for s2Member. */
wp_redirect(get_page_link($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
}
}
/**/
exit;
/* Clean exit. */
}
}
}
/**/
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
do_action("ws_plugin__s2member_after_login_redirect", get_defined_vars());
unset($__refs, $__v);
/* Unset defined __refs, __v. */
/**/
return;
/* Return for uniformity. */
}
示例12: login_redirect
/**
* Handles login redirections.
*
* @package s2Member\Login_Redirects
* @since 3.5
*
* @attaches-to ``add_action('wp_login');``
*
* @param string $username Expects Username.
* @param WP_User $user Expects a WP_User object instance.
*
* @return null Or exits script execution after a redirection takes place.
*/
public static function login_redirect($username = '', $user = NULL)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_login_redirect', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
if (is_string($username) && $username && is_object($user) && !empty($user->ID) && ($user_id = $user->ID)) {
update_user_option($user_id, 's2member_last_login_time', time());
if (!get_user_option('s2member_registration_ip', $user_id)) {
update_user_option($user_id, 's2member_registration_ip', $_SERVER['REMOTE_ADDR']);
}
if (($logins = (int) get_user_option('s2member_login_counter', $user_id) + 1) >= 1 || ($logins = 1)) {
update_user_option($user_id, 's2member_login_counter', $logins);
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password']) {
delete_user_setting('default_password_nag') . update_user_option($user_id, 'default_password_nag', FALSE, TRUE);
}
if (($ok = TRUE) && !is_super_admin($user_id) && $username !== 'demo' && !apply_filters('ws_plugin__s2member_disable_login_ip_restrictions', $user->has_cap('edit_posts') ? TRUE : FALSE, get_defined_vars())) {
$ok = c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok($_SERVER['REMOTE_ADDR'], strtolower($username));
}
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_always_http']) {
// Alter value of `redirect_to`?
if (!empty($_REQUEST['redirect_to']) && is_string($_REQUEST['redirect_to']) && strpos($_REQUEST['redirect_to'], 'wp-admin') === FALSE) {
$_REQUEST['redirect_to'] = preg_replace('/^https\\:\\/\\//i', 'http://', $_REQUEST['redirect_to']);
if (stripos($_REQUEST['redirect_to'], 'http://') !== 0) {
$home_path = trim((string) @parse_url(home_url('/'), PHP_URL_PATH), '/');
$http_home_base = trim(preg_replace('/\\/' . preg_quote($home_path, '/') . '\\/$/', '', home_url('/', 'http')), '/');
$_REQUEST['redirect_to'] = $http_home_base . '/' . ltrim($_REQUEST['redirect_to'], '/');
}
}
}
if ($redirect = apply_filters('ws_plugin__s2member_login_redirect', $user->has_cap('edit_posts') ? FALSE : TRUE, get_defined_vars())) {
$obey_redirect_to = apply_filters('ws_plugin__s2member_obey_login_redirect_to', TRUE, get_defined_vars());
if ($obey_redirect_to && (empty($_REQUEST['redirect_to']) || !is_string($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] === admin_url() || preg_match('/^\\/?wp-admin\\/?$/', $_REQUEST['redirect_to']))) {
$obey_redirect_to = FALSE;
} else {
if ($obey_redirect_to && !empty($_REQUEST['redirect_to_automatic']) && is_string($redirect)) {
$obey_redirect_to = FALSE;
}
}
// Do not obey automatic redirects when a custom redirection filter applies.
// ↑ NOTE: this will apply to s2Member Pro's One-Time-Offers (Upon Login) also.
if (!$obey_redirect_to) {
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_during_login_redirect', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
if ($redirect && is_string($redirect)) {
$redirect = $redirect;
} else {
if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url($user)) {
$redirect = $redirection_url;
} else {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']) {
// Else we use the Login Welcome Page configured for s2Member.
$redirect = get_page_link($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']);
} else {
$redirect = home_url('/');
}
}
}
// Default to the home page.
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_redirection_always_http']) {
$redirect = preg_replace('/^https\\:\\/\\//i', 'http://', $redirect);
if (stripos($redirect, 'http://') !== 0) {
$home_path = trim((string) @parse_url(home_url('/'), PHP_URL_PATH), '/');
$http_home_base = trim(preg_replace('/\\/' . preg_quote($home_path, '/') . '\\/$/', '', home_url('/', 'http')), '/');
$redirect = $http_home_base . '/' . ltrim($redirect, '/');
}
}
wp_redirect($redirect) . exit;
}
}
}
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_after_login_redirect', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
}
示例13: bizzthemes_default_layouts
function bizzthemes_default_layouts($default_action = '')
{
global $wpdb, $default_layouts_array, $themeid;
if (isset($default_action) && $default_action == 'reset') {
# RESET ALL
// reset sidebars
// update_option( 'sidebars_widgets', NULL );
delete_option($themeid . '_sidebars_widgets');
// updated defaults option
delete_option('bizz_defaults_' . $themeid);
// reset all option
update_option('bizz_reset_' . $themeid, true);
// delete pointer notice removal
delete_user_setting('p_empty_widgets_' . str_replace('-', '', $themeid));
// reset widgets & grids
$query = "DELETE FROM {$wpdb->posts} WHERE post_type LIKE 'bizz_widget' OR post_type LIKE 'bizz_grid' AND post_content_filtered = '{$themeid}' ";
$wpdb->query($query);
} elseif (isset($default_action) && $default_action == 'set_defaults') {
# SET DEFAULT GRIDS and WIDGETS
// read options
$new_options = $default_layouts_array;
// remove BOM
$new_options = mb_convert_encoding($new_options, 'UTF-8', 'ASCII,UTF-8,ISO-8859-1');
if (substr($new_options, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
$new_options = substr($new_options, 3);
}
// decode
$new_options = json_decode($new_options, true);
$new_all_widgets = $new_options['options_value']['all_widgets'];
$new_sidebars_widgets = $new_options['options_value']['sidebars_widgets'];
// $new_sidebars_widgets = $new_options['options_value']['sidebars_widgets'][0]['option_value'];
$new_widget_posts = isset($new_options['options_value']['widget_posts']) ? $new_options['options_value']['widget_posts'] : array();
$new_grid_posts = isset($new_options['options_value']['grid_posts']) ? $new_options['options_value']['grid_posts'] : array();
// reset old grids
$query = "DELETE FROM {$wpdb->posts} WHERE post_type LIKE 'bizz_grid' OR post_type LIKE 'bizz_widget' AND post_content_filtered = '{$themeid}' ";
$wpdb->query($query);
// reset backed up widgets
delete_option($themeid . '_sidebars_widgets');
// update defaults option
update_option('bizz_defaults_' . $themeid, true);
// update widgets
// bizz_update_widgets($new_sidebars_widgets, $new_all_widgets);
// update posts
bizzthemes_update_options('set_new', $new_all_widgets);
bizzthemes_update_options('set_new', $new_sidebars_widgets);
bizzthemes_insert_posts('set_new', array_merge($new_widget_posts, $new_grid_posts));
// update posts
bizzthemes_insert_posts('set_new', array_merge($new_widget_posts, $new_grid_posts));
}
}
示例14: pie_register_user_notification
function pie_register_user_notification($user_id)
{
$user = new WP_User($user_id);
#-- PIE REGESTER --#
global $wpdb, $pie_register;
$piereg = get_option('pie_register');
$piereg_custom = get_option('pie_register_custom');
$ref = explode('?', $_SERVER['HTTP_REFERER']);
$ref = $ref[0];
$admin = trailingslashit(get_option('siteurl')) . 'wp-admin/user-new.php';
if (!is_array($piereg_custom)) {
$piereg_custom = array();
}
if ($piereg['password'] && !empty($_POST['user_pw'])) {
$plaintext_pass = $_POST['user_pw'];
} else {
// otherwise use the supplied password
$plaintext_pass = $pie_register->RanPass(6);
}
if ($piereg['firstname'] && $_POST['firstname']) {
update_usermeta($user_id, 'first_name', $_POST['firstname']);
}
if ($piereg['lastname'] && $_POST['lastname']) {
update_usermeta($user_id, 'last_name', $_POST['lastname']);
}
if ($piereg['website'] && $_POST['website']) {
update_usermeta($user_id, 'user_url', $_POST['website']);
}
if ($piereg['aim'] && $_POST['aim']) {
update_usermeta($user_id, 'aim', $_POST['aim']);
}
if ($piereg['yahoo'] && $_POST['yahoo']) {
update_usermeta($user_id, 'yim', $_POST['yahoo']);
}
if ($piereg['jabber'] && $_POST['jabber']) {
update_usermeta($user_id, 'jabber', $_POST['jabber']);
}
if ($piereg['phone'] && $_POST['phone']) {
update_usermeta($user_id, 'phone', $_POST['phone']);
}
if ($piereg['about'] && $_POST['about']) {
update_usermeta($user_id, 'description', $_POST['about']);
}
if ($piereg['code'] && $_POST['regcode']) {
update_usermeta($user_id, 'invite_code', $_POST['regcode']);
}
if ($ref != $admin && $piereg['admin_verify']) {
update_usermeta($user_id, 'admin_verify_user', $user->user_login);
update_usermeta($user_id, 'email_verify_user_pwd', $user->user_pass);
update_usermeta($user_id, 'email_verify_email', $user->user_email);
$temp_id = 'unverified__' . $pie_register->RanPass(7);
$notice = __('Your account requires activation by an administrator before you will be able to login.', 'piereg') . "\r\n";
} else {
if ($ref != $admin && $piereg['email_verify']) {
$code = $pie_register->RanPass(25);
update_usermeta($user_id, 'email_verify', $code);
update_usermeta($user_id, 'email_verify_date', date('Ymd'));
update_usermeta($user_id, 'email_verify_user', $user->user_login);
update_usermeta($user_id, 'email_verify_user_pwd', $user->user_pass);
update_usermeta($user_id, 'email_verify_email', $user->user_email);
$email_code = '?piereg_verification=' . $code . '&';
$prelink = __('Verification URL: ', 'piereg');
$notice = __('Please use the link above to verify and activate your account', 'piereg') . "\r\n";
$temp_id = 'unverified__' . $pie_register->RanPass(7);
delete_user_setting('default_password_nag', $user_id);
update_user_option($user_id, 'default_password_nag', false, true);
} else {
if ($ref != $admin && $piereg['paypal_option']) {
$code = $pie_register->RanPass(25);
update_usermeta($user_id, 'email_verify', $code);
update_usermeta($user_id, 'pending_payment', 'yes');
update_usermeta($user_id, 'email_verify_user', $user->user_login);
update_usermeta($user_id, 'email_verify_user_pwd', $user->user_pass);
update_usermeta($user_id, 'email_verify_email', $user->user_email);
$temp_id = 'unverified__' . $pie_register->RanPass(7);
$email_code = '?piereg_verification=' . $code . '&';
$prelink = __('Verification URL: ', 'piereg');
$notice = __('Please click on the above link to verify your email', 'piereg') . "\r\n";
}
}
}
if (!empty($piereg_custom)) {
foreach ($piereg_custom as $k => $v) {
$id = $pie_register->Label_ID($v['label']);
if ($v['reg'] && $_POST[$id]) {
if (is_array($_POST[$id])) {
$_POST[$id] = implode(', ', $_POST[$id]);
}
update_usermeta($user_id, $id, $_POST[$id]);
}
}
}
#-- END Pie Rgister --#
wp_set_password($plaintext_pass, $user_id);
$user_login = stripslashes($user->user_login);
$user_email = stripslashes($user->user_email);
#-- Pie-Register --#
if (!$piereg['custom_adminmsg'] && !$piereg['disable_admin']) {
#-- END Pie-Register --#
$message = sprintf(__('New user Register on your blog %s:', 'piereg'), get_option('blogname')) . "\r\n\r\n";
//.........这里部分代码省略.........
示例15: delete_user_setting
/**
* Deleting settings would reset them to the defaults.
* This function has to be used before any output has started as it calls setcookie()
*
* @return void
*/
function delete_user_setting()
{
if (isset($_GET['ngg_restart_tour'])) {
delete_user_setting('nextgen_tour_pointer');
}
}