• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP update_user_option函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中update_user_option函数的典型用法代码示例。如果您正苦于以下问题:PHP update_user_option函数的具体用法?PHP update_user_option怎么用?PHP update_user_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了update_user_option函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     if (isset($_REQUEST['shipping_module_id'])) {
         update_user_option(get_current_user_id(), 'wpsc_settings_selected_shipping_module', $_REQUEST['shipping_module_id']);
     }
 }
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:7,代码来源:shipping.php


示例2: hide

 /**
  * Stores user's preference to hide the submit message via AJAX
  */
 function hide()
 {
     check_ajax_referer($this->parent->slug_ . '_hide_submit', '_ajax_nonce-' . $this->parent->slug . '-hide-submit');
     //note: option will be global
     update_user_option(get_current_user_ID(), 'infinite-scroll-hide-submit', true, true);
     die(1);
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:10,代码来源:submit.php


示例3: wpu_check_for_action

function wpu_check_for_action()
{
    global $user_ID, $wp_version;
    if (isset($_GET['wpu_action'])) {
        if ('activate' == $_GET['wpu_action']) {
            check_admin_referer('wp-united-switch-theme_' . $_GET['template']);
            if (isset($_GET['template'])) {
                update_usermeta($user_ID, 'WPU_MyTemplate', $_GET['template']);
            }
            if (isset($_GET['stylesheet'])) {
                update_usermeta($user_ID, 'WPU_MyStylesheet', $_GET['stylesheet']);
            }
            $wpuConnSettings = get_settings('wputd_connection');
            wp_redirect('admin.php?page=' . $wpuConnSettings['full_path_to_plugin'] . '&activated=true&wputab=themes');
            exit;
        } elseif ('update-blog-profile' == $_GET['wpu_action']) {
            check_admin_referer('update-blog-profile_' . $user_ID);
            $errors = edit_user($user_ID);
            //$errors behaves differently post-WP 2.1
            if ((double) $wp_version >= 2.1) {
                //WordPress >= 2.1
                if (is_wp_error($errors)) {
                    foreach ($errors->get_error_messages() as $message) {
                        echo "<li>{$message}</li>";
                    }
                }
            } else {
                //WP 2.0x
                if (is_array($errors)) {
                    if (count($errors) != 0) {
                        foreach ($errors as $id => $error) {
                            echo $error . '<br/>';
                        }
                        exit;
                    }
                }
            }
            if (!isset($_POST['rich_editing'])) {
                $_POST['rich_editing'] = 'false';
            }
            update_user_option($current_user->id, 'rich_editing', $_POST['rich_editing'], true);
            //
            //	UPDATE BLOG DETAILS
            //
            $blog_title = __('My Blog');
            $blog_tagline = __('My description will go here');
            if (isset($_POST['blog_title'])) {
                $blog_title = wp_specialchars(trim($_POST['blog_title']));
            }
            if (isset($_POST['blog_tagline'])) {
                $blog_tagline = wp_specialchars(trim($_POST['blog_tagline']));
            }
            update_usermeta($user_ID, 'blog_title', $blog_title);
            update_usermeta($user_ID, 'blog_tagline', $blog_tagline);
            $wpuConnSettings = get_settings('wputd_connection');
            wp_redirect('admin.php?page=' . $wpuConnSettings['full_path_to_plugin'] . '&updated=true&wputab=bset');
            exit;
        }
    }
}
开发者ID:Oddsor,项目名称:lpt-forum,代码行数:60,代码来源:wpu-plugin.php


示例4: yoimg_crop_load_styles_and_scripts

function yoimg_crop_load_styles_and_scripts($hook)
{
    if (YOIMG_CROP_ENABLED) {
        if ($hook == 'post.php') {
            wp_enqueue_media();
        } else {
            if ($hook == 'upload.php') {
                // issue http://stackoverflow.com/questions/25884434/wordpress-wp-enqueue-media-causes-javascript-error-from-wp-admin-upload-phpmo
                $mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
                $modes = array('grid', 'list');
                if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) {
                    $mode = $_GET['mode'];
                    update_user_option(get_current_user_id(), 'media_library_mode', $mode);
                }
                if ('list' === $mode) {
                    $version = get_bloginfo('version');
                    // issue https://wordpress.org/support/topic/findposts-is-not-defined
                    if (version_compare($version, '4.2.2') < 0) {
                        wp_dequeue_script('media');
                    }
                    wp_enqueue_media();
                }
            } else {
                wp_enqueue_style('media-views');
            }
        }
        wp_enqueue_style('wp-pointer');
        wp_enqueue_style('yoimg-cropping-css', YOIMG_CROP_URL . '/css/yoimg-cropping.css');
        wp_enqueue_style('yoimg-cropper-css', YOIMG_CROP_URL . '/js/cropper/cropper.min.css');
        wp_enqueue_script('wp-pointer');
        wp_enqueue_script('yoimg-cropper-js', YOIMG_CROP_URL . '/js/cropper/cropper.min.js', array('jquery'), false, true);
        wp_enqueue_script('yoimg-cropping-js', YOIMG_CROP_URL . '/js/yoimg-cropping.js', array('yoimg-cropper-js'), false, true);
    }
}
开发者ID:jawngee,项目名称:yoimages-crop,代码行数:34,代码来源:init.php


示例5: registrar_usuario

function registrar_usuario($parametros)
{
    $errors = new WP_Error();
    if ($parametros['email'] == NULL) {
        $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.'));
        return $errors;
    }
    if (!es_email($parametros['email'])) {
        $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.'));
        return $errors;
    }
    if (email_exists($parametros['email'])) {
        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'));
        return $errors;
    }
    if ($parametros['nombre'] == NULL) {
        $errors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username.'));
        return $errors;
    }
    $user_pass = $parametros['clave'] == NULL ? wp_generate_password(12, false) : $parametros['clave'];
    $user_id = wp_create_user($parametros['email'], $user_pass, $parametros['email']);
    if (!$user_id) {
        $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !'), get_option('admin_email')));
        return $errors;
    }
    update_user_option($user_id, 'default_password_nag', true, true);
    //Set up the Password change nag.
    wp_new_user_notification($user_id, $user_pass);
    // Actualización de tabla clientes...
    return $user_id;
}
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:31,代码来源:acciones.php


示例6: save_metabox

 /**
  * Save the meta box data.
  */
 public function save_metabox($post_id)
 {
     /*
     Verify using the nonce that the data was submitted from our meta box on our site.
     If it wasn't, return the post ID and be on our way.
     */
     // If no nonce was provided or the nonce does not match
     if (!isset($_POST[CCFIC_KEY . '_nonce']) || !wp_verify_nonce($_POST[CCFIC_KEY . '_nonce'], CCFIC_ID)) {
         return $post_id;
     }
     // Make sure the user has valid permissions
     // If we're editing a page and the user isn't allowed to do that, return the post ID
     if ('page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return $post_id;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return $post_id;
         }
     }
     // Now that we've validated nonce and permissions, let's save the caption data
     // Sanitize the caption
     $caption = array('caption_text' => $_POST[CCFIC_KEY . '_caption_text'], 'source_text' => $_POST[CCFIC_KEY . '_source_text'], 'source_url' => esc_url($_POST[CCFIC_KEY . '_source_url']), 'new_window' => !empty($_POST[CCFIC_KEY . '_new_window']) ? true : false);
     // Update the caption meta field
     update_post_meta($post_id, '_' . CCFIC_KEY, $caption);
     // Update the user default for the "new window" checkbox
     update_user_option(get_current_user_id(), CCFIC_KEY . '_new_window', $caption['new_window']);
 }
开发者ID:robalford,项目名称:alfordhomesinc,代码行数:32,代码来源:MetaBox.php


示例7: enqueueTheGoods

 /**
  * Enqueue the CSS and JS needed to make the magic happen
  * @param $hook
  */
 public function enqueueTheGoods($hook)
 {
     add_thickbox();
     if ($hook == 'post.php') {
         wp_enqueue_media();
     } else {
         if ($hook == 'upload.php') {
             $mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
             if (isset($_GET['mode']) && in_array($_GET['mode'], ['grid', 'list'])) {
                 $mode = $_GET['mode'];
                 update_user_option(get_current_user_id(), 'media_library_mode', $mode);
             }
             if ($mode == 'list') {
                 $version = get_bloginfo('version');
                 if (version_compare($version, '4.2.2') < 0) {
                     wp_dequeue_script('media');
                 }
                 wp_enqueue_media();
             }
         } else {
             wp_enqueue_style('media-views');
         }
     }
     wp_enqueue_style('wp-pointer');
     wp_enqueue_style('ilab-modal-css', ILAB_PUB_CSS_URL . '/ilab-modal.min.css');
     wp_enqueue_style('ilab-media-tools-css', ILAB_PUB_CSS_URL . '/ilab-media-tools.min.css');
     wp_enqueue_script('wp-pointer');
     wp_enqueue_script('ilab-modal-js', ILAB_PUB_JS_URL . '/ilab-modal.js', ['jquery'], false, true);
     wp_enqueue_script('ilab-media-tools-js', ILAB_PUB_JS_URL . '/ilab-media-tools.js', ['jquery'], false, true);
 }
开发者ID:Air-Craft,项目名称:air-craft-www,代码行数:34,代码来源:ilab-media-crop-tool.php


示例8: wr_contactform_ajax_hidden_columns

 function wr_contactform_ajax_hidden_columns()
 {
     // Set custom error reporting level
     error_reporting(E_ALL ^ E_NOTICE);
     if (!empty($_POST)) {
         $form = !empty($_POST['form_id']) ? $_POST['form_id'] : '';
         $postColumns = !empty($_POST['columns']) ? $_POST['columns'] : '';
         if (!empty($form)) {
             if (!($user = wp_get_current_user())) {
                 wp_die(-1);
             }
             $columns = array();
             $getColumns = get_user_option('wr_cfsb_post_type_column', $user->ID);
             if (!empty($getColumns)) {
                 $columns = $getColumns;
                 $columns[$form] = $postColumns;
             } else {
                 $columns[$form] = $postColumns;
             }
             update_user_option($user->ID, 'wr_cfsb_post_type_column', $columns, true);
         }
     } else {
         if (!empty($_GET)) {
             $form = !empty($_GET['form_id']) ? $_GET['form_id'] : '';
             if (!($user = wp_get_current_user())) {
                 wp_die(-1);
             }
             $columns = get_user_option('wr_cfsb_post_type_column', $user->ID);
             $data = !empty($columns[$form]) ? json_encode($columns[$form]) : '';
             echo '' . $data;
         }
     }
     exit;
 }
开发者ID:webeau,项目名称:WR-ContactForm,代码行数:34,代码来源:ajax.php


示例9: wp_new_user_notification

 function wp_new_user_notification($user_id, $plaintext_pass = '')
 {
     global $pagenow;
     global $register_plus_redux;
     //trigger_error( sprintf( __( 'Register Plus Redux DEBUG: wp_new_user_notification($user_id=%s, $plaintext_pass=%s) from %s', 'register-plus-redux' ), $user_id, $plaintext_pass, $pagenow ) );
     if ('1' === $register_plus_redux->rpr_get_option('user_set_password') && !empty($_POST['pass1'])) {
         $plaintext_pass = stripslashes((string) $_POST['pass1']);
     }
     if ('user-new.php' === $pagenow && !empty($_POST['pass1'])) {
         $plaintext_pass = stripslashes((string) $_POST['pass1']);
     }
     if ('1' === $register_plus_redux->rpr_get_option('user_set_password')) {
         update_user_option($user_id, 'default_password_nag', false, true);
     }
     // turn off the Password change nag.
     do_action('rpr_new_user', $user_id, $plaintext_pass);
     //TODO: Code now only forces users registering to verify email, may want to add settings to have admin created users verify email too
     $verification_code = '';
     $user_registering = 'wp-login.php' === $pagenow || $register_plus_redux->rpr_wp_modal_registration();
     if ($user_registering && '1' === $register_plus_redux->rpr_get_option('verify_user_email')) {
         $verification_code = wp_generate_password(20, FALSE);
         update_user_meta($user_id, 'email_verification_code', $verification_code);
         update_user_meta($user_id, 'email_verification_sent', gmdate('Y-m-d H:i:s'));
         $register_plus_redux->send_verification_mail($user_id, $verification_code);
     }
     if ($user_registering && '1' !== $register_plus_redux->rpr_get_option('disable_user_message_registered') || !$user_registering && '1' !== $register_plus_redux->rpr_get_option('disable_user_message_created')) {
         if ('1' !== $register_plus_redux->rpr_get_option('verify_user_email') && '1' !== $register_plus_redux->rpr_get_option('verify_user_admin')) {
             $register_plus_redux->send_welcome_user_mail($user_id, $plaintext_pass);
         }
     }
     if ($user_registering && '1' !== $register_plus_redux->rpr_get_option('disable_admin_message_registered') || !$user_registering && '1' !== $register_plus_redux->rpr_get_option('disable_admin_message_created')) {
         $register_plus_redux->send_admin_mail($user_id, $plaintext_pass, $verification_code);
     }
 }
开发者ID:HarryBosh,项目名称:Register-Plus-Redux,代码行数:34,代码来源:rpr-new-user-notification.php


示例10: process_registration

 public function process_registration()
 {
     do_action('popmake_alm_ajax_override_registration');
     $user_login = $_POST['user_login'];
     $user_email = $_POST['user_email'];
     $user_pass = isset($_POST['user_pass']) ? $_POST['user_pass'] : wp_generate_password(12, false);
     $userdata = compact('user_login', 'user_email', 'user_pass');
     $user = wp_insert_user($userdata);
     if (!isset($_POST['user_pass'])) {
         update_user_option($user, 'default_password_nag', true, true);
         // Set up the Password change nag.
         wp_new_user_notification($user, $user_pass);
     }
     if (is_wp_error($user)) {
         $response = array('success' => false, 'message' => $user->get_error_message());
     } else {
         if (popmake_get_popup_ajax_registration($_POST['popup_id'], 'enable_autologin')) {
             $creds = array('user_login' => $user_login, 'user_password' => $user_pass, 'remember' => true);
             $user = wp_signon($creds);
         }
         $message = __('Registration complete.', 'popup-maker-ajax-login-modals');
         if (!isset($_POST['user_pass'])) {
             $message .= ' ' . __('Please check your e-mail.', 'popup-maker-ajax-login-modals');
         }
         $response = array('success' => true, 'message' => $message);
     }
     echo json_encode($response);
     die;
 }
开发者ID:eugene-gromky-co,项目名称:mindfulnesssummit,代码行数:29,代码来源:class-ajax.php


示例11: run

 public function run($arguments)
 {
     global $itsec_globals;
     if (!isset($arguments['id'])) {
         return false;
         //User not provided
     }
     $user = get_user_by('id', intval($arguments['id']));
     if ($user === false) {
         return false;
         //user doesn't exist
     }
     $direction = isset($arguments['direction']) ? $arguments['direction'] : 'add';
     $enabled = trim(get_user_option('itsec_two_factor_enabled', $user->ID));
     $override = intval(get_user_option('itsec_two_factor_override', $user->ID)) === 1 ? true : false;
     $override_expires = intval(get_user_option('itsec_two_factor_override_expires', $user->ID));
     if ($direction === 'add') {
         if ($enabled != 'on' || $override !== 1 && $itsec_globals['current_time'] < $override_expires) {
             return false;
             //Override already active
         }
         $override = true;
         $override_expires = $itsec_globals['current_time'] + 600;
         $response = array('ID' => $user->ID, 'user_login' => $user->user_login, 'override' => $override, 'override_expires' => $override_expires);
         update_user_option($user->ID, 'itsec_two_factor_override', $override, true);
         update_user_option($user->ID, 'itsec_two_factor_override_expires', $override_expires, true);
         return $response;
     } elseif ($direction === 'remove') {
         delete_user_option($user->ID, 'itsec_two_factor_override', true);
         delete_user_option($user->ID, 'itsec_two_factor_override_expires', true);
         return true;
     }
     return false;
 }
开发者ID:femgineer,项目名称:website,代码行数:34,代码来源:class-ithemes-sync-verb-itsec-override-two-factor-user.php


示例12: dashboard_widget_controls

 /**
  * Display the dashboard widget controls content.
  */
 public static function dashboard_widget_controls()
 {
     $number_of_days = self::get_number_of_days();
     $current_filter = self::get_current_filter();
     $available_filters = activity_heat_map_get_filters();
     if (isset($_REQUEST['activity_heat_map_filter'])) {
         $current_filter = sanitize_text_field($_REQUEST['activity_heat_map_filter']);
         if (!array_key_exists($current_filter, $available_filters)) {
             $current_filter = 'posts';
         }
         update_user_option(get_current_user_id(), 'activity_heat_map_filter', $current_filter);
     }
     if (isset($_REQUEST['activity_heat_map_days'])) {
         $number_of_days = absint($_REQUEST['activity_heat_map_days']);
         $number_of_days = $number_of_days <= 366 ? $number_of_days : 366;
         update_user_option(get_current_user_id(), 'activity_heat_map_days', $number_of_days);
     }
     echo '<p>';
     printf('<label for="activity_heat_map_filter">%s</label>', esc_html__('Show activity: ', 'activity-heat-map'));
     echo '<select name="activity_heat_map_filter" id="activity_heat_map_filter">';
     foreach ($available_filters as $filter => $data) {
         printf('<option value="%s" %s>%s</option>', esc_attr($filter), selected($current_filter, $filter), esc_html($data['title']));
     }
     echo '</select>';
     echo '</p>';
     echo '<p>';
     printf('<label for="activity_heat_map_days">%s</label>', esc_html__('Number of days: ', 'activity-heat-map'));
     printf('<input type="number" min="7" max="366" name="activity_heat_map_days" id="activity_heat_map_days" value="%s" />', absint($number_of_days));
     echo '</p>';
 }
开发者ID:swissspidy,项目名称:activity-heat-map,代码行数:33,代码来源:class-dashboard-widget.php


示例13: wp_edit

 function wp_edit()
 {
     global $post_type, $wp_query;
     if ($post_type != GALLERY_POST_TYPE_SLUG) {
         return;
     }
     if (!current_user_can('edit_others_pages') || !post_type_supports($post_type, 'page-attributes') && !is_post_type_hierarchical($post_type)) {
         // check permission
         return;
     }
     add_action('restrict_manage_posts', array($this, 'restrict_manage_posts'));
     // posts per page drop down UI
     if (isset($_GET['per_page']) && ($_GET['per_page'] == 99999 || $_GET['per_page'] % 10 == 0)) {
         update_user_option(get_current_user_id(), 'edit_' . $post_type . '_per_page', (int) $_GET['per_page']);
     }
     add_filter('views_' . get_current_screen()->id, array($this, 'sort_by_order_link'));
     // add view by menu order to views
     add_filter('contextual_help', array($this, 'contextual_help'));
     // add contextual help to hierarchical post screens
     #if ( $wp_query->query['orderby'] == 'menu_order title' ) {	// we can only sort if we're organized by menu order; WP 3.2 and 3.1 versions
     wp_enqueue_script('simple-page-ordering', THEMEURL . 'inc/gallery-ordering/simple-page-ordering.js', array('jquery-ui-sortable'), '0.9.7', true);
     $js_trans = array('RepositionTree' => __("Items can only be repositioned within their current branch in the page tree / hierarchy (next to pages with the same parent).\n\nIf you want to move this item into a different part of the page tree, use the Quick Edit feature to change the parent before continuing.", TD));
     #wp_localize_script( 'simple-page-ordering', 'simple_page_ordering_l10n', $js_trans );
     #}
 }
开发者ID:w392807287,项目名称:FirstRepository,代码行数:25,代码来源:simple-page-ordering.php


示例14: bogo_update_user_option

function bogo_update_user_option($user_id)
{
    global $wpdb;
    $meta_key = $wpdb->get_blog_prefix() . 'accessible_locale';
    if (!empty($_POST['setting_bogo_accessible_locales'])) {
        delete_user_meta($user_id, $meta_key);
        if (isset($_POST['bogo_accessible_locales'])) {
            $locales = (array) $_POST['bogo_accessible_locales'];
            $locales = bogo_filter_locales($locales);
            foreach ($locales as $locale) {
                add_user_meta($user_id, $meta_key, $locale);
            }
        }
        if (!metadata_exists('user', $user_id, $meta_key)) {
            add_user_meta($user_id, $meta_key, 'zxx');
            // zxx is a special code in ISO 639-2
        }
    }
    if (isset($_POST['bogo_own_locale'])) {
        $locale = trim($_POST['bogo_own_locale']);
        if (bogo_is_available_locale($locale)) {
            update_user_option($user_id, 'locale', $locale, true);
        }
    }
}
开发者ID:karthikakamalanathan,项目名称:wp-cookieLawInfo,代码行数:25,代码来源:user.php


示例15: addAuthenticatorCheckCode

 /**
  * Function for checking authorization to add as
  * a primary filter to control user and password
  */
 function addAuthenticatorCheckCode($userobj, $username, $password)
 {
     // If option at the user level is off I go out from the procedure
     // without other controls on the verification code twice
     if (!isset($userobj->ID) or trim(get_user_option('sz_google_authenticator_enabled', $userobj->ID)) != '1') {
         return $userobj;
     }
     // Checking and setting variables and secret code entered
     // A profile is stored in the master and the other is passed by login
     if (empty($_POST['googleauthotp'])) {
         $authenticator = '';
     } else {
         $authenticator = trim($_POST['googleauthotp']);
     }
     $options = $this->getModuleOptions('SZGoogleModuleAuthenticator');
     $secrets = trim(get_user_option('sz_google_authenticator_secret', $userobj->ID));
     // Control code inserted into the login form
     // with those in the table of secret codes Emergency
     if ($options['authenticator_emergency_codes'] == '1') {
         $em = unserialize(trim(get_user_option('sz_google_authenticator_codes', $userobj->ID)));
         if (is_array($em) and isset($em[$authenticator]) and $em[$authenticator] == false) {
             $em[$authenticator] = time();
             update_user_option($userobj->ID, 'sz_google_authenticator_codes', serialize($em), true);
             return $userobj;
         }
     }
     // Control code inserted into the login form with
     // that calculated routine internal authenticator class
     if ($this->checkAuthenticatorCode($secrets, $authenticator, $options['authenticator_discrepancy']) === true) {
         return $userobj;
     } else {
         return new WP_Error('invalid_google_authenticator_password', SZGoogleCommon::getTranslate('<strong>ERROR</strong>: Authenticator code is incorrect.', 'sz-google'));
     }
 }
开发者ID:omaharry,项目名称:stmaryomaha,代码行数:38,代码来源:SZGoogleActionAuthenticatorLogin.php


示例16: setUserValue

 function setUserValue($name, $value, $userID = 0)
 {
     if (empty($userID)) {
         $userID = $GLOBALS['user_ID'];
     }
     update_user_option($userID, $this->userOptionName($name), $value);
 }
开发者ID:rvenable,项目名称:bfox-core-wp,代码行数:7,代码来源:bfox_options.php


示例17: wp_install

 /**
  * Installs the blog
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.1.0
  *
  * @param string $blog_title Blog title.
  * @param string $user_name User's username.
  * @param string $user_email User's email.
  * @param bool $public Whether blog is public.
  * @param string $deprecated Optional. Not used.
  * @param string $user_password Optional. User's chosen password. Will default to a random password.
  * @param string $language Optional. Language chosen.
  * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
  */
 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '')
 {
     if (!empty($deprecated)) {
         _deprecated_argument(__FUNCTION__, '2.6');
     }
     wp_check_mysql_version();
     wp_cache_flush();
     make_db_current_silent();
     populate_options();
     populate_roles();
     update_option('blogname', $blog_title);
     update_option('admin_email', $user_email);
     update_option('blog_public', $public);
     if ($language) {
         update_option('WPLANG', $language);
     }
     $guessurl = wp_guess_url();
     update_option('siteurl', $guessurl);
     // If not a public blog, don't ping.
     if (!$public) {
         update_option('default_pingback_flag', 0);
     }
     /*
      * Create default user. If the user already exists, the user tables are
      * being shared among blogs. Just set the role in that case.
      */
     $user_id = username_exists($user_name);
     $user_password = trim($user_password);
     $email_password = false;
     if (!$user_id && empty($user_password)) {
         $user_password = wp_generate_password(12, false);
         $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
         $user_id = wp_create_user($user_name, $user_password, $user_email);
         update_user_option($user_id, 'default_password_nag', true, true);
         $email_password = true;
     } else {
         if (!$user_id) {
             // Password has been provided
             $message = '<em>' . __('Your chosen password.') . '</em>';
             $user_id = wp_create_user($user_name, $user_password, $user_email);
         } else {
             $message = __('User already exists. Password inherited.');
         }
     }
     $user = new WP_User($user_id);
     $user->set_role('administrator');
     wp_install_defaults($user_id);
     flush_rewrite_rules();
     wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
     wp_cache_flush();
     /**
      * Fires after a site is fully installed.
      *
      * @since 3.9.0
      *
      * @param WP_User $user The site owner.
      */
     do_action('wp_install', $user);
     return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
 }
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:76,代码来源:upgrade.php


示例18: step

 public function step()
 {
     $exported_subs = get_user_option(get_current_user_id(), 'nf_download_all_subs_ids');
     if (!is_array($exported_subs)) {
         $exported_subs = array();
     }
     $previous_name = get_user_option(get_current_user_id(), 'nf_download_all_subs_filename');
     if ($previous_name) {
         $this->args['filename'] = $previous_name;
     }
     $args = array('posts_per_page' => 250, 'paged' => $this->step, 'post_type' => 'nf_sub', 'meta_query' => array(array('key' => '_form_id', 'value' => $this->args['form_id'])));
     $subs_results = get_posts($args);
     if (is_array($subs_results) && !empty($subs_results)) {
         $upload_dir = wp_upload_dir();
         $file_path = trailingslashit($upload_dir['path']) . $this->args['filename'] . '.csv';
         $myfile = fopen($file_path, 'a') or die('Unable to open file!');
         $x = 0;
         $export = '';
         foreach ($subs_results as $sub) {
             $sub_export = Ninja_Forms()->sub($sub->ID)->export(true);
             if ($x > 0 || $this->step > 1) {
                 $sub_export = substr($sub_export, strpos($sub_export, "\n") + 1);
             }
             if (!in_array($sub->ID, $exported_subs)) {
                 $export .= $sub_export;
                 $exported_subs[] = $sub->ID;
             }
             $x++;
         }
         fwrite($myfile, $export);
         fclose($myfile);
     }
     update_user_option(get_current_user_id(), 'nf_download_all_subs_ids', $exported_subs);
 }
开发者ID:umairakhtar123,项目名称:hova,代码行数:34,代码来源:download-all-subs.php


示例19: __construct

 public function __construct()
 {
     parent::__construct();
     global $cb_post_id;
     $this->settings = clearbase_get_folder_settings();
     $this->is_parent_settings = $cb_post_id != clearbase_get_value('_folder_id', 0, $this->settings);
     $this->show_folders = clearbase_get_value($this->is_parent_settings ? 'allow_child_nesting' : 'allow_nesting', true, $this->settings);
     $this->show_add_folders = !$this->show_folders ? false : apply_filters("clearbase_allow_new_folders", true, $cb_post_id);
     $this->show_media = !clearbase_is_root() || clearbase_is_root() && clearbase_get_value('allow_root_media', true, $this->settings);
     $this->show_media = apply_filters('clearbase_show_media', $this->show_media, $cb_post_id);
     $this->show_add_media = !$this->show_media ? false : apply_filters("clearbase_allow_new_media", true, $cb_post_id);
     $this->is_trash = false;
     //TODO
     if (clearbase_is_root(false)) {
         //enforce Clearbase root rules
         $this->show_folders = $this->show_add_folders = true;
         $this->show_media = $this->show_add_media = false;
     }
     $modes = array('grid', 'list');
     if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) {
         $this->mode = clearbase_empty_default($_GET, 'mode', '');
         update_user_option(get_current_user_id(), 'clearbase_media_mode', $this->mode);
     } else {
         $this->mode = get_user_option('clearbase_media_mode', get_current_user_id());
         if (!in_array($this->mode, $modes)) {
             $this->mode = 'list';
         }
     }
     if ($this->show_media && 'list' == $this->mode) {
         require_once CLEARBASE_DIR . '/includes/class-cb-media-list-table.php';
         $this->media_table = new CB_Media_List_Table();
     }
 }
开发者ID:unity3software,项目名称:clearbase,代码行数:33,代码来源:class-view-folder.php


示例20: wp_install

 /**
  * Installs the blog
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.1.0
  *
  * @param string $blog_title Blog title.
  * @param string $user_name User's username.
  * @param string $user_email User's email.
  * @param bool $public Whether blog is public.
  * @param null $deprecated Optional. Not used.
  * @param string $user_password Optional. User's chosen password. Will default to a random password.
  * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
  */
 function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
 {
     if (!empty($deprecated)) {
         _deprecated_argument(__FUNCTION__, '2.6');
     }
     wp_check_mysql_version();
     wp_cache_flush();
     make_db_current_silent();
     if (!is_file(ABSPATH . 'wp-admin/install.sql')) {
         //[ysd]如果有install.sql不设置默认options数据
         populate_options();
     } else {
         validate_active_plugins();
         //[ysd] 禁用 不可用的插件
     }
     populate_roles();
     update_option('blogname', $blog_title);
     update_option('admin_email', $user_email);
     update_option('blog_public', $public);
     $guessurl = isset($_SERVER['HTTP_APPNAME']) ? 'http://' . substr($_SERVER['HTTP_APPNAME'], 5) . '.1kapp.com' : wp_guess_url();
     //[ysd] 固定了guessurl
     update_option('siteurl', $guessurl);
     update_option('home', $guessurl);
     get_option('siteurl');
     // If not a public blog, don't ping.
     if (!$public) {
         update_option('default_pingback_flag', 0);
     }
     // Create default user. If the user already exists, the user tables are
     // being shared among blogs. Just set the role in that case.
     $user_id = username_exists($user_name);
     $user_password = trim($user_password);
     $email_password = false;
     if (!$user_id && empty($user_password)) {
         $user_password = wp_generate_password(12, false);
         $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
         $user_id = wp_create_user($user_name, $user_password, $user_email);
         update_user_option($user_id, 'default_password_nag', true, true);
         $email_password = true;
     } else {
         if (!$user_id) {
             // Password has been provided
             $message = '<em>' . __('Your chosen password.') . '</em>';
             $user_id = wp_create_user($user_name, $user_password, $user_email);
         } else {
             $message = __('User already exists. Password inherited.');
         }
     }
     $user = new WP_User($user_id);
     $user->set_role('administrator');
     if (!file_exists(ABSPATH . 'wp-admin/without_default')) {
         wp_install_defaults($user_id);
     }
     //[ysd],如果打包时设置了默认数据,才会设置默认数据
     flush_rewrite_rules();
     wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
     wp_cache_flush();
     return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
 }
开发者ID:ramo01,项目名称:1kapp,代码行数:74,代码来源:upgrade.php



注:本文中的update_user_option函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP update_user_record函数代码示例发布时间:2022-05-23
下一篇:
PHP update_user_meta函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap