当前位置: 首页>>代码示例>>PHP>>正文


PHP update_usermeta函数代码示例

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


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

示例1: saveNotificationsOnProfile

 public function saveNotificationsOnProfile($user_id)
 {
     if (!current_user_can("edit_user", $user_id)) {
         return false;
     }
     update_usermeta($user_id, "notify_jhufos", $_POST["notify_jhufos"]);
 }
开发者ID:johnshopkins,项目名称:wp-fos-import,代码行数:7,代码来源:wp-fos-import.php

示例2: affiliate_new_subscription

function affiliate_new_subscription($tosub_id, $tolevel_id, $to_order, $user_id)
{
    if (function_exists('get_user_meta')) {
        $aff = get_user_meta($user_id, 'affiliate_referred_by', true);
        $paid = get_user_meta($user_id, 'affiliate_paid', true);
    } else {
        $aff = get_usermeta($user_id, 'affiliate_referred_by');
        $paid = get_usermeta($user_id, 'affiliate_paid');
    }
    if (empty($aff)) {
        $aff = false;
    }
    if ($aff && $paid != 'yes') {
        $whole = get_option("membership_whole_payment_" . $tosub_id, 0);
        $partial = get_option("membership_partial_payment_" . $tosub_id, 0);
        if (!empty($whole) || !empty($partial)) {
            $amount = $whole . '.' . $partial;
        } else {
            $amount = 0;
        }
        do_action('affiliate_purchase', $aff, $amount);
        if (defined('AFFILIATE_PAYONCE') && AFFILIATE_PAYONCE == 'yes') {
            if (function_exists('update_user_meta')) {
                update_user_meta($user_id, 'affiliate_paid', 'yes');
            } else {
                update_usermeta($user_id, 'affiliate_paid', 'yes');
            }
        }
    }
}
开发者ID:hscale,项目名称:webento,代码行数:30,代码来源:membership.php

示例3: track_user_comment_posting

function track_user_comment_posting()
{
    global $current_blog;
    global $comment;
    global $post;
    global $current_user;
    global $comment_post_ID;
    $thisnewcomment = array($current_blog->blog_id, $comment_post_ID);
    $addcomment = implode(", ", $thisnewcomment);
    $LatestCommentsList = $current_user->LatestComments;
    if (!$LatestCommentsList) {
        $LatestCommentsList = array();
    } else {
        $array = explode(", ", $current_user->LatestComments);
    }
    if (!in_array($addcomment, $LatestCommentsList)) {
        array_push($LatestCommentsList, $addcomment);
        if (count($LatestCommentsList) > 30) {
            unset($LatestCommentsList[0]);
            array_unshift($LatestCommentsList, array_shift($LatestCommentsList));
            if (!isset($LatestCommentsList[0])) {
                $LatestCommentsList = array();
            }
        }
    }
    update_usermeta($current_user->ID, 'LatestComments', $LatestCommentsList);
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:27,代码来源:comments-tracker.php

示例4: Medieteknik_Save_Token

function Medieteknik_Save_Token()
{
    //assume we have been authorized and returned
    //first check if we have a logged in user
    //äckliga wordpress vill att man gör såhär
    global $user_ID;
    get_currentuserinfo();
    if (!$user_ID) {
        die('Du är inte inloggad i wordpress. LOGGA IN FFS!!!!');
    }
    //get our temporary token
    $token = $_SESSION['oauth_token'];
    $secret = $_SESSION['oauth_token_secret'];
    //kolla att vi faktiskt har en token
    if (!$token || !$secret) {
        die('Kunde inte hitta en sparad token. Gör om gör rätt!');
    }
    //request a permanent token
    $oauth = new TwitterOAuth($token, $secret);
    $new_token = $oauth->access_token();
    //check our reply
    if (!$new_token['oauth_token'] || !$new_token['oauth_token_secret']) {
        die('Du blev inte autoriserad. Prova igen?');
    }
    //insert token and secret into the usermeta database
    update_usermeta($user_ID, 'twitter_token', $new_token['oauth_token']);
    update_usermeta($user_ID, 'twitter_token_secret', $new_token['oauth_token_secret']);
    //echo 'Välkommen ' . $new_token['screen_name'];
    //istället redirecta till index
    header('location: index.php');
}
开发者ID:jakbob,项目名称:medieteknik.org,代码行数:31,代码来源:twitter_save_token.php

示例5: save_extra_profile_fields

function save_extra_profile_fields($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return false;
    }
    update_usermeta($user_id, 'wsi_profile_image', $_POST['wsi_profile_image']);
}
开发者ID:swapnilghone,项目名称:WP-codesnippets,代码行数:7,代码来源:addUserProfileImageCustomField.php

示例6: frankly_save_custom_user_profile_fields

function frankly_save_custom_user_profile_fields($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return FALSE;
    }
    update_usermeta($user_id, 'frankly', $_POST['frankly']);
}
开发者ID:kakul232,项目名称:wordpress_video_tools,代码行数:7,代码来源:profile-frankly.php

示例7: casestudy_save_extra_profile_fields

 function casestudy_save_extra_profile_fields($user_id)
 {
     if (!current_user_can('edit_user', $user_id)) {
         return false;
     }
     update_usermeta($user_id, 'jobtitle', $_POST['jobtitle']);
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:7,代码来源:case-studies.php

示例8: pmpromd_save_extra_profile_fields

function pmpromd_save_extra_profile_fields($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return false;
    }
    update_usermeta($user_id, 'pmpromd_hide_directory', $_POST['hide_directory']);
}
开发者ID:greathmaster,项目名称:pmpro-member-directory,代码行数:7,代码来源:pmpro-member-directory.php

示例9: retrieve_password

/**
 * Handles sending password retrieval email to user.
 *
 * @uses $wpdb WordPress Database object
 *
 * @return bool|WP_Error True: when finish. WP_Error on error
 */
function retrieve_password()
{
    global $wpdb;
    $errors = new WP_Error();
    if (empty($_POST['user_login']) && empty($_POST['user_email'])) {
        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
    }
    if (strpos($_POST['user_login'], '@')) {
        $user_data = get_user_by_email(trim($_POST['user_login']));
        if (empty($user_data)) {
            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
        }
    } else {
        $login = trim($_POST['user_login']);
        $user_data = get_userdatabylogin($login);
    }
    do_action('lostpassword_post');
    if ($errors->get_error_code()) {
        return $errors;
    }
    if (!$user_data) {
        $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
        return $errors;
    }
    // redefining user_login ensures we return the right case in the email
    $user_login = $user_data->user_login;
    $user_email = $user_data->user_email;
    do_action('retreive_password', $user_login);
    // Misspelled and deprecated
    do_action('retrieve_password', $user_login);
    $allow = apply_filters('allow_password_reset', true, $user_data->ID);
    if (!$allow) {
        return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
    } else {
        if (is_wp_error($allow)) {
            return $allow;
        }
    }
    $user_email = $_POST['user_email'];
    $user_login = $_POST['user_login'];
    $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_login = %s", $user_login));
    if (empty($user)) {
        return new WP_Error('invalid_key', __('Invalid key'));
    }
    $new_pass = wp_generate_password(12, false);
    do_action('password_reset', $user, $new_pass);
    wp_set_password($new_pass, $user->ID);
    update_usermeta($user->ID, 'default_password_nag', true);
    //Set up the Password change nag.
    $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
    $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
    $message .= site_url() . '/?ptype=affiliate' . "\r\n";
    $title = sprintf(__('[%s] Your new password'), get_option('blogname'));
    $title = apply_filters('password_reset_title', $title);
    $message = apply_filters('password_reset_message', $message, $new_pass);
    if ($message && !wp_mail($user_email, $title, $message)) {
        die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
    }
    return true;
}
开发者ID:annguyenit,项目名称:getdeal,代码行数:67,代码来源:affiliate_login.php

示例10: activation

 /**
  * Plugin activation
  *
  * @access public
  * @return void
  * @author Ralf Hortt
  **/
 public function activation()
 {
     // First time installation
     if ($this->is_first_time()) {
         $users = get_users();
         if ($users) {
             foreach ($users as $user) {
                 update_usermeta($user->ID, 'authentication', '1');
             }
         }
         add_option('confirm-user-registration', array('administrator' => get_bloginfo('admin_email'), 'error' => __('<strong>ERROR:</strong> Your account has to be confirmed by an administrator before you can login', 'confirm-user-registration'), 'from' => get_bloginfo('name') . ' <' . get_bloginfo('admin_email') . ">\n", 'subject' => __('Account Confirmation: ' . get_bloginfo('name'), 'confirm-user-registration'), 'message' => __("You account has been approved by an administrator!\nLogin @ " . get_bloginfo('url') . "/wp-login.php\n\nThis message is auto generated\n", 'confirm-user-registration')));
         // Upgrade
     } else {
         if ($this->is_upgrade()) {
             // Create new option array
             add_option('confirm-user-registration', array('administrator' => get_option('cur_administrator'), 'error' => get_option('cur_error'), 'from' => get_option('cur_from'), 'subject' => get_option('cur_subject'), 'message' => get_option('cur_message')));
             // Cleanup
             delete_option('cur_administrator');
             delete_option('cur_error');
             delete_option('cur_from');
             delete_option('cur_subject');
             delete_option('cur_message');
         }
     }
 }
开发者ID:astrit,项目名称:confirm-user-registration,代码行数:32,代码来源:confirm-user-registration.php

示例11: wp_insert_user

function wp_insert_user($userdata)
{
    global $wpdb;
    extract($userdata);
    // Are we updating or creating?
    if (!empty($ID)) {
        $update = true;
    } else {
        $update = false;
        // Password is not hashed when creating new user.
        $user_pass = md5($user_pass);
    }
    if (empty($user_nicename)) {
        $user_nicename = sanitize_title($user_login);
    }
    if (empty($display_name)) {
        $display_name = $user_login;
    }
    if (empty($nickname)) {
        $nickname = $user_login;
    }
    if (empty($user_registered)) {
        $user_registered = gmdate('Y-m-d H:i:s');
    }
    if ($update) {
        $query = "UPDATE {$wpdb->users} SET user_pass='{$user_pass}', user_email='{$user_email}', user_url='{$user_url}', user_nicename = '{$user_nicename}', display_name = '{$display_name}' WHERE ID = '{$ID}'";
        $query = apply_filters('update_user_query', $query);
        $wpdb->query($query);
        $user_id = $ID;
    } else {
        $query = "INSERT INTO {$wpdb->users} \n\t\t(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)\n\tVALUES \n\t\t('{$user_login}', '{$user_pass}', '{$user_email}', '{$user_url}', '{$user_registered}', '{$user_nicename}', '{$display_name}')";
        $query = apply_filters('create_user_query', $query);
        $wpdb->query($query);
        $user_id = $wpdb->insert_id;
    }
    update_usermeta($user_id, 'first_name', $first_name);
    update_usermeta($user_id, 'last_name', $last_name);
    update_usermeta($user_id, 'nickname', $nickname);
    update_usermeta($user_id, 'description', $description);
    update_usermeta($user_id, 'jabber', $jabber);
    update_usermeta($user_id, 'aim', $aim);
    update_usermeta($user_id, 'yim', $yim);
    if ($update && !empty($role)) {
        $user = new WP_User($user_id);
        $user->set_role($role);
    }
    if (!$update) {
        $user = new WP_User($user_id);
        $user->set_role(get_settings('default_role'));
    }
    wp_cache_delete($user_id, 'users');
    wp_cache_delete($user_login, 'userlogins');
    if ($update) {
        do_action('profile_update', $user_id);
    } else {
        do_action('user_register', $user_id);
    }
    return $user_id;
}
开发者ID:robertlange81,项目名称:Website,代码行数:59,代码来源:registration-functions.php

示例12: save_admin_check_off

function save_admin_check_off($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return false;
    }
    /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
    update_usermeta($user_id, '_super_user', $_POST['_super_user']);
}
开发者ID:mikeyfrecks,项目名称:greenoak,代码行数:8,代码来源:super-admin.php

示例13: update_user_meta

 function update_user_meta($uid, $key, $val)
 {
     if (function_exists('update_usermeta')) {
         return update_usermeta($uid, $key, $val);
     } else {
         return update_user_meta($uid, $key, $val);
     }
 }
开发者ID:rhlee,项目名称:live-admin-warning,代码行数:8,代码来源:live-admin-warning.php

示例14: update_user_option

function update_user_option($user_id, $option_name, $newvalue, $global = false)
{
    global $wpdb;
    if (!$global) {
        $option_name = $wpdb->prefix . $option_name;
    }
    return update_usermeta($user_id, $option_name, $newvalue);
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:8,代码来源:user.php

示例15: fb_save_custom_user_profile_fields

function fb_save_custom_user_profile_fields($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return FALSE;
    }
    update_usermeta($user_id, 'flattr-id', $_POST['flattr-id']);
    update_usermeta($user_id, 'paypal', $_POST['paypal']);
}
开发者ID:cptpike,项目名称:linuxhardwareguide,代码行数:8,代码来源:functions.php


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