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

PHP update_user_meta函数代码示例

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

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



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

示例1: wpmudev_chat_settings_screen_chat_proc

function wpmudev_chat_settings_screen_chat_proc()
{
    global $wpmudev_chat, $current_user, $bp;
    if (isset($_POST['wpmudev_chat_user_settings'])) {
        //echo "_POST<pre>"; print_r($_POST); echo "</pre>";
        //die();
        if (isset($_POST['wpmudev_chat_user_settings']['chat_user_status'])) {
            $chat_user_status = esc_attr($_POST['wpmudev_chat_user_settings']['chat_user_status']);
            if (isset($wpmudev_chat->_chat_options['user-statuses'][$chat_user_status])) {
                wpmudev_chat_update_user_status($bp->displayed_user->id, $chat_user_status);
            }
            unset($_POST['wpmudev_chat_user_settings']['chat_user_status']);
        }
        $user_meta = get_user_meta($bp->displayed_user->id, 'wpmudev-chat-user', true);
        if (!$user_meta) {
            $user_meta = array();
        }
        $user_meta = wp_parse_args($_POST['wpmudev_chat_user_settings'], $user_meta);
        update_user_meta($bp->displayed_user->id, 'wpmudev-chat-user', $user_meta);
        $wpmudev_chat->user_meta = $user_meta;
        // Show the standard BP green success message
        bp_core_add_message(__('Changes saved.', $wpmudev_chat->translation_domain));
    }
    add_action('bp_template_title', 'wpmudev_chat_settings_show_screen_title');
    add_action('bp_template_content', 'wpmudev_chat_settings_show_screen_content');
    bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
    return;
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:28,代码来源:wpmudev_chat_buddypress.php


示例2: hide

 /**
  * When the user decides to not have this show again save user meta to make it so.
  *
  * @param array $data Sanitized data to use for saving.
  *
  * @returns bool Always returns true
  */
 public function hide($data)
 {
     $user_id = get_current_user_ID();
     update_user_meta($user_id, 'lasso_hide_tour', true);
     do_action('lasso_tour_hidden', $user_id);
     return true;
 }
开发者ID:rhurling,项目名称:lasso,代码行数:14,代码来源:tour.php


示例3: restrict_save_data

function restrict_save_data($user_id)
{
    if (!current_user_can('add_users')) {
        return false;
    }
    update_user_meta($user_id, '_access', $_POST['allow']);
}
开发者ID:sholex,项目名称:-Wordpress-Restrict-Author-Posting-by-Custom-Taxonomy,代码行数:7,代码来源:Restrict+Author+Posting.php


示例4: upmeta

function upmeta($i)
{
    if (is_user_logged_in()) {
        global $f;
        update_user_meta($f, 'like-posts', serialize($i));
    }
}
开发者ID:yszar,项目名称:linuxwp,代码行数:7,代码来源:index.php


示例5: tie_like_post

function tie_like_post()
{
    global $user_ID;
    $postID = $_REQUEST['post'];
    if (is_numeric($postID)) {
        $count = get_post_meta($postID, 'tie_likes', true);
        if (empty($count) || $count == '') {
            $count = 0;
        }
        $count++;
        if ($user_ID) {
            $user_liked = get_the_author_meta('liked', $user_ID);
            $user_liked_posts = explode(',', $user_liked);
            if (empty($user_liked)) {
                update_user_meta($user_ID, 'liked', $postID);
                update_post_meta($postID, 'tie_likes', $count);
            } else {
                if (!in_array($postID, $user_liked_posts)) {
                    update_post_meta($postID, 'tie_likes', $count);
                    $postID = $user_liked . ',' . $postID;
                    update_user_meta($user_ID, 'liked', $postID);
                }
            }
        } else {
            $user_liked = $_COOKIE["tie_likes_" . $postID];
            if (empty($user_liked)) {
                setcookie('tie_likes_' . $postID, $postID, time() + 7776000, '/');
                update_post_meta($postID, 'tie_likes', $count);
            }
        }
        echo $count;
    }
    die;
}
开发者ID:proj-2014,项目名称:vlan247-test-wp,代码行数:34,代码来源:tie-likes.php


示例6: usersExist

 /**
  * @Given /^Users exist:$/
  */
 public function usersExist(TableNode $table)
 {
     $usersData = $table->getHash();
     add_filter('send_password_change_email', '__return_false');
     add_filter('send_email_change_email', '__return_false');
     foreach ($usersData as $userData) {
         if (empty($userData['login'])) {
             throw new \InvalidArgumentException('You must provide a user login!');
         }
         $user = get_user_by('login', $userData['login']);
         $data = $this->getUserDataFromTable($userData);
         if ($user) {
             $data['ID'] = $user->ID;
         }
         $result = $user ? wp_update_user($data) : wp_insert_user($data);
         if (is_wp_error($result)) {
             throw new \UnexpectedValueException('User could not be created: ' . $result->get_error_message());
         }
         foreach ($this->getUserMetaDataFromTable($userData) as $key => $value) {
             update_user_meta($user->ID, $key, $value);
         }
     }
     remove_filter('send_password_change_email', '__return_false');
     remove_filter('send_email_change_email', '__return_false');
 }
开发者ID:johnpbloch,项目名称:WpBehatExtension,代码行数:28,代码来源:UserContext.php


示例7: jr_handle_resume_subscriptions_ipn

function jr_handle_resume_subscriptions_ipn($posted)
{
    global $jr_log;
    $jr_log->write_log('Valid IPN response detected: ' . print_r($posted, true));
    // Custom holds post ID
    if (!empty($posted['txn_type']) && !empty($posted['custom']) && is_numeric($posted['custom']) && $posted['custom'] > 0) {
        $user_id = (int) $posted['custom'];
        switch (strtolower($posted['txn_type'])) {
            case "subscr_signup":
                update_user_meta($user_id, '_valid_resume_subscription', '1');
                do_action('user_resume_subscription_started', $user_id);
                exit;
                break;
            case "subscr_payment":
                exit;
                break;
            case "subscr_cancel":
            case "subscr_failed":
            case "subscr_eot":
                update_user_meta($user_id, '_valid_resume_subscription', '0');
                do_action('user_resume_subscription_ended', $user_id);
                exit;
                break;
        }
    }
}
开发者ID:besimhu,项目名称:legacy,代码行数:26,代码来源:paypal.php


示例8: update_user_meta_values

function update_user_meta_values($my_id = '', $metakey = '', $metavalue = '')
{
    global $bp;
    $my_id = $bp->displayed_user->id;
    $update_user_meta_values = update_user_meta($my_id, $metakey, $metavalue);
    return $get_user_meta_values;
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:7,代码来源:bp-component-functions.php


示例9: memberful_private_rss_feed_link

/**
 * @param string $success_message - '', if present, will return an clickable link
 * @param string $error_message - "You don’t have access to this RSS feed."
 * @param bool $return
 * @return string
 */
function memberful_private_rss_feed_link($success_message = '', $error_message = "You don’t have access to this RSS feed.", $return = false)
{
    $error_message = apply_filters('memberful_private_rss_feed_error_message', $error_message);
    if (!is_user_logged_in()) {
        return memberful_private_rss_feed_link_response_helper($error_message, $return);
    }
    $requiredPlan = memberful_private_user_feed_settings_get_required_plan();
    // We want to allow the private user feed only if the admin has configured it.
    if ($requiredPlan == false) {
        return memberful_private_rss_feed_link_response_helper($error_message, $return);
    }
    $current_user_id = get_current_user_id();
    if (!is_subscribed_to_memberful_plan($requiredPlan, $current_user_id)) {
        return memberful_private_rss_feed_link_response_helper($error_message, $return);
    }
    $feedToken = get_user_meta($current_user_id, 'memberful_private_user_feed_token', true);
    if ($feedToken == false || $feedToken == '') {
        $feedToken = substr(md5(uniqid(rand(1, 10000))), 2, 30);
        update_user_meta($current_user_id, 'memberful_private_user_feed_token', $feedToken);
    }
    $link = get_home_url() . '/' . memberful_private_user_feed_get_url_identifier($feedToken);
    if ($success_message != '') {
        $link = '<a href="' . $link . '">' . do_shortcode($success_message) . '</a>';
    }
    return memberful_private_rss_feed_link_response_helper($link, $return);
}
开发者ID:andrewkhunn,项目名称:lancero,代码行数:32,代码来源:private_user_feed.php


示例10: save_profile_admin

 /**
  *
  * @TODO document
  *
  */
 function save_profile_admin($user_ID)
 {
     if (!isset($this->tabs) || empty($this->tabs)) {
         return;
     }
     // Loop through tabs
     foreach ($this->tabs as $tab => $t) {
         // Loop through tab options
         foreach ($t->options as $oid => $o) {
             // Note: If the value is null, then test to see if the option is already set to something
             // create and overwrite the option to null in that case (i.e. it is being set to empty)
             if (isset($o['selectvalues']) && pagelines_is_multi_option($oid, $o)) {
                 foreach ($o['selectvalues'] as $sid => $s) {
                     $option_value = isset($_POST[$sid]) ? $_POST[$sid] : null;
                     if (!empty($option_value) || pl_um($sid, $user_ID)) {
                         update_post_meta($user_ID, $sid, $option_value);
                     }
                 }
             } else {
                 $option_value = isset($_POST[$oid]) ? $_POST[$oid] : null;
                 if (!empty($option_value) || pl_um($oid, $user_ID)) {
                     update_user_meta($user_ID, $oid, $option_value);
                 }
             }
         }
     }
 }
开发者ID:climo,项目名称:PageLines-Framework,代码行数:32,代码来源:class.profiles.php


示例11: __construct

 function __construct($par = null)
 {
     $this->par = $par;
     /* excel  */
     if ($_GET['action'] == 'xls') {
         $this->excel = true;
     }
     /* search query */
     if ($_GET['src']) {
         $this->search_query = $_GET['src'];
     }
     /* filter by month */
     if ($_GET['mth'] && $_GET['yr']) {
         $this->mth = $_GET['mth'];
         $this->yr = $_GET['yr'];
     }
     /* determine max row per page */
     if ($_GET['max'] > 0) {
         $this->set_max($_GET['max']);
         update_user_meta(get_current_user_id(), get_query_var('pagename') . '_max', $_GET['max']);
     } else {
         $val = (int) get_user_meta(get_current_user_id(), get_query_var('pagename') . '_max', true);
         if ($val > 0) {
             $this->set_max($val);
         }
     }
     /* mysql limit start, max */
     $this->paged = $_GET['paged'] ? $_GET['paged'] - 1 : 0;
     $this->start = $this->paged * $this->get_max();
     if (method_exists($this, 'query')) {
         $this->data = $this->query();
         wp_enqueue_script('list-table');
     }
 }
开发者ID:xflash8,项目名称:staff-2016,代码行数:34,代码来源:list-table.class.php


示例12: qq_oauth

function qq_oauth()
{
    $code = $_GET['code'];
    $token_url = "https://graph.qq.com/oauth2.0/token?client_id=" . QQ_APPID . "&client_secret=" . QQ_APPSECRET . "&grant_type=authorization_code&redirect_uri=" . urlencode(home_url()) . "&code=" . $code;
    $response = wp_remote_get($token_url);
    $response = $response['body'];
    if (strpos($response, "callback") !== false) {
        wp_redirect(home_url());
    }
    $params = array();
    parse_str($response, $params);
    $qq_access_token = $params["access_token"];
    $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $qq_access_token;
    $str = wp_remote_get($graph_url);
    $str = $str['body'];
    if (strpos($str, "callback") !== false) {
        $lpos = strpos($str, "(");
        $rpos = strrpos($str, ")");
        $str = substr($str, $lpos + 1, $rpos - $lpos - 1);
    }
    $user = json_decode($str, true);
    if (isset($user->error)) {
        echo "<h3>错误代码:</h3>" . $user->error;
        echo "<h3>信息  :</h3>" . $user->error_description;
        exit;
    }
    $qq_openid = $user['openid'];
    if (!$qq_openid) {
        wp_redirect(home_url());
        exit;
    }
    $get_user_info = "https://graph.qq.com/user/get_user_info?" . "access_token=" . $qq_access_token . "&oauth_consumer_key=" . QQ_APPID . "&openid=" . $qq_openid . "&format=json";
    $data = wp_remote_get($get_user_info);
    $data = $data['body'];
    $data = json_decode($data, true);
    $username = $data['nickname'];
    $avatar = $data['figureurl_2'];
    if (is_user_logged_in()) {
        $this_user = wp_get_current_user();
        update_user_meta($this_user->ID, "qq_openid", $qq_openid);
        update_user_meta($this_user->ID, "qq_avatar", $avatar);
        fa_qq_oauth_redirect();
    } else {
        $user_qq = get_users(array("meta_key " => "qq_openid", "meta_value" => $qq_openid));
        if (is_wp_error($user_qq) || !count($user_qq)) {
            $login_name = wp_create_nonce($qq_openid);
            $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
            $userdata = array('user_login' => $login_name, 'display_name' => $username, 'user_pass' => $random_password, 'nick_name' => $username);
            $user_id = wp_insert_user($userdata);
            wp_signon(array("user_login" => $login_name, "user_password" => $random_password), false);
            update_user_meta($user_id, "qq_openid", $qq_openid);
            update_user_meta($user_id, "qq_avatar", $avatar);
            fa_qq_oauth_redirect();
        } else {
            wp_set_auth_cookie($user_qq[0]->ID);
            update_user_meta($user_qq[0]->ID, "qq_avatar", $avatar);
            fa_qq_oauth_redirect();
        }
    }
}
开发者ID:yarec,项目名称:wp-oauth,代码行数:60,代码来源:auth-qq.php


示例13: tt_save_custom_user_profile_fields

 function tt_save_custom_user_profile_fields($user_id)
 {
     if (!current_user_can('edit_user', $user_id)) {
         return FALSE;
     }
     update_user_meta($user_id, 'enable_auto_publish', isset($_POST['enable_auto_publish']) ? $_POST['enable_auto_publish'] : 'false');
 }
开发者ID:earthshakira,项目名称:rachanasansad-portfolio,代码行数:7,代码来源:pressgrid.php


示例14: um_admin_addon_hook

 function um_admin_addon_hook($hook)
 {
     global $ultimatemember;
     switch ($hook) {
         case 'bp_avatar_transfer':
             if (class_exists('BuddyPress')) {
                 $path = bp_core_avatar_upload_path() . '/avatars';
                 $files = glob($path . '/*');
                 $i = 0;
                 foreach ($files as $key) {
                     $q = count(glob("{$key}/*")) === 0 ? 0 : 1;
                     if ($q == 1) {
                         $photo = glob($key . '/*');
                         foreach ($photo as $file) {
                             if (strstr($file, 'bpfull')) {
                                 $get_user_id = explode('/', $file);
                                 array_pop($get_user_id);
                                 $user_id = end($get_user_id);
                                 if (!file_exists($ultimatemember->files->upload_basedir . $user_id . '/profile_photo.jpg')) {
                                     $ultimatemember->files->new_user($user_id);
                                     copy($file, $ultimatemember->files->upload_basedir . $user_id . '/profile_photo.jpg');
                                     update_user_meta($user_id, 'profile_photo', 'profile_photo.jpg');
                                     $i++;
                                 }
                             }
                         }
                     }
                 }
                 $this->content = '<p><strong>Done. Process completed!</p>';
                 $this->content .= $i . ' user(s) changed.</strong></p>';
             }
             break;
     }
 }
开发者ID:dracudakid,项目名称:WP_TrungTamTinHoc,代码行数:34,代码来源:bp_avatar_transfer.php


示例15: wpas_upgrade_321

/**
 * Upgrade routine for 3.2.1
 *
 * @since 3.2.1
 * @return void
 */
function wpas_upgrade_321()
{
    $agents = wpas_list_users('edit_ticket');
    foreach ($agents as $agent_id => $agent_name) {
        update_user_meta($agent_id, 'wpas_can_be_assigned', 'yes');
    }
}
开发者ID:vicky081,项目名称:Awesome-Support,代码行数:13,代码来源:functions-upgrade.php


示例16: iul_get_time_data

function iul_get_time_data($type = "")
{
    $return_data = "";
    if (is_user_logged_in()) {
        $user = wp_get_current_user();
        $roles = $user->roles[0];
        $current_time = date('H:i:s');
        $last_active_time = get_user_meta(get_current_user_id(), 'last_active_time', true);
        update_user_meta(get_current_user_id(), 'last_active_time', date('H:i:s'));
        if ($last_active_time) {
            $iul_data = get_option('iul_data');
            $iul_behavior = get_option('iul_behavior');
            $timer = empty($iul_behavior[$roles]['idle_timer']) ? $iul_data['iul_idleTimeDuration'] : $iul_behavior[$roles]['idle_timer'];
            $diff = strtotime($current_time) - strtotime($last_active_time);
            $return_data = array('timer' => $timer, 'diff' => intval($diff), 'last_active_time' => strtotime($last_active_time), 'current_time' => strtotime($current_time));
        }
        if ($type) {
            if ($type == 'active') {
                update_user_meta(get_current_user_id(), 'last_active_time', $current_time);
                $return_data['last_active_time'] = strtotime($last_active_time);
                $return_data['diff'] = strtotime($current_time) - strtotime($last_active_time);
            }
        }
        return $return_data;
    }
    return false;
}
开发者ID:abiralneupane,项目名称:Idle-User-Logout,代码行数:27,代码来源:iul_functions.php


示例17: q_create_profilepage

function q_create_profilepage($userid)
{
    $quser = get_userdata($userid);
    $userpost = array('post_title' => $quser->display_name, 'post_content' => $quser->user_description, 'post_status' => 'publish', 'post_author' => $quser->ID, 'post_date' => $quser->registered, 'post_type' => 'quser');
    $postid = wp_insert_post($userpost);
    update_user_meta($userid, 'q_profilepage_id', $postid);
}
开发者ID:rongandat,项目名称:cyarevfoods,代码行数:7,代码来源:qusers.php


示例18: wskl_set_user_deactivated

/**
 * @param int      $user_id
 * @param bool|int $timestamp
 */
function wskl_set_user_deactivated($user_id, $timestamp = FALSE)
{
    if (FALSE === $timestamp) {
        $timestamp = time();
    }
    update_user_meta($user_id, wskl_get_option_name('inactive-accounts_deactivated'), $timestamp);
}
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:11,代码来源:functions.php


示例19: saveConfig

 /**
  * {@inheritdoc }
  */
 public function saveConfig()
 {
     $options = (object) array('menu' => $this->getMenu(), 'metaboxes' => $this->getMetaboxes(), 'capabilities' => $this->getCapabilities(), 'menu_order' => $this->getMenuOrder(), 'restrictions' => $this->getRestrictions(), 'excludes' => $this->getExcludes());
     update_user_meta($this->getID(), WPACCESS_PREFIX . 'config', $options);
     mvb_Model_Cache::clearCache();
     do_action(WPACCESS_PREFIX . 'do_save');
 }
开发者ID:rosshettel,项目名称:Northern-Star-Blogs,代码行数:10,代码来源:mvb_model_userconfig.php


示例20: hide

 public function hide()
 {
     if (isset($_GET['wpurp_hide_getting_started'])) {
         check_admin_referer('wpurp_hide_getting_started', 'wpurp_hide_getting_started');
         update_user_meta(get_current_user_id(), '_wpurp_hide_getting_started', get_option(WPUltimateRecipe::get()->pluginName . '_version'));
     }
 }
开发者ID:robertoperata,项目名称:bbqverona.com,代码行数:7,代码来源:getting_started.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP update_user_option函数代码示例发布时间:2022-05-23
下一篇:
PHP update_user_login_times函数代码示例发布时间: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