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


PHP bb_update_usermeta函数代码示例

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


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

示例1: enable_for_new_members

function enable_for_new_members()
{
    global $bb_current_user;
    if (!isset($bb_current_user->data->auto_add_favorit)) {
        bb_update_usermeta($bb_current_user->ID, "auto_add_favorit", 1);
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:7,代码来源:auto_add_favorites.php

示例2: bb_new_user

 function bb_new_user($user_login, $user_email, $user_url, $user_status = 0)
 {
     global $wp_users_object, $bbdb;
     // is_email check + dns
     if (!($user_email = bb_verify_email($user_email))) {
         return new WP_Error('user_email', __('Invalid email address'), $user_email);
     }
     if (!($user_login = sanitize_user($user_login, true))) {
         return new WP_Error('user_login', __('Invalid username'), $user_login);
     }
     // user_status = 1 means the user has not yet been verified
     $user_status = is_numeric($user_status) ? (int) $user_status : 0;
     $user_nicename = $_user_nicename = bb_user_nicename_sanitize($user_login);
     if (strlen($_user_nicename) < 1) {
         return new WP_Error('user_login', __('Invalid username'), $user_login);
     }
     while (is_numeric($user_nicename) || ($existing_user = bb_get_user_by_nicename($user_nicename))) {
         $user_nicename = bb_slug_increment($_user_nicename, $existing_user->user_nicename, 50);
     }
     $user_url = bb_fix_link($user_url);
     $user_registered = bb_current_time('mysql');
     $password = wp_generate_password();
     $user_pass = wp_hash_password($password);
     $user = $wp_users_object->new_user(compact('user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass'));
     if (is_wp_error($user)) {
         if ('user_nicename' == $user->get_error_code()) {
             return new WP_Error('user_login', $user->get_error_message());
         }
         return $user;
     }
     $user_id = $bbdb->insert_id;
     $options = bb_get_option('approve_user_registration_options');
     bb_update_usermeta($user_id, $bbdb->prefix . 'capabilities', array('waitingapproval' => true, 'member' => true));
     approve_user_registration_send_pass($user_id, $password);
     do_action('bb_new_user', $user['ID'], $user['plain_pass']);
     return $user['ID'];
 }
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:37,代码来源:approve-user-registration.php

示例3: bb_manage_user_fields

function bb_manage_user_fields($edit_user = '')
{
    global $nxt_roles, $nxt_users_object, $bbdb;
    // Cap checks
    $user_roles = $nxt_roles->role_names;
    $can_keep_gate = bb_current_user_can('keep_gate');
    if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
        bb_check_admin_referer('user-manage');
        // Instantiate required vars
        $_POST = stripslashes_deep($_POST);
        $create_user_errors = new nxt_Error();
        // User login
        $trimmed_user_login = str_replace(' ', '', $_POST['user_login']);
        $user_login = sanitize_user($_POST['user_login'], true);
        $user_meta['first_name'] = $_POST['first_name'];
        $user_meta['last_name'] = $_POST['last_name'];
        $user_display_name = $_POST['display_name'];
        $user_email = $_POST['user_email'];
        $user_url = $_POST['user_url'];
        $user_meta['from'] = $_POST['from'];
        $user_meta['occ'] = $_POST['occ'];
        $user_meta['interest'] = $_POST['interest'];
        $user_role = $_POST['userrole'];
        $user_meta['throttle'] = $_POST['throttle'];
        $user_pass1 = $_POST['pass1'];
        $user_pass2 = $_POST['pass2'];
        $user_status = 0;
        $user_pass = false;
        $user_url = $user_url ? bb_fix_link($user_url) : '';
        // Check user_login
        if (!isset($_GET['action']) && empty($user_login)) {
            $create_user_errors->add('user_login', __('Username is a required field.'));
        } else {
            if ($user_login !== $trimmed_user_login) {
                $create_user_errors->add('user_login', sprintf(__('%s is an invalid username. How\'s this one?'), esc_html($_POST['user_login'])));
                $user_login = $trimmed_user_login;
            }
        }
        // Check email
        if (isset($user_email) && empty($user_email)) {
            $create_user_errors->add('user_email', __('Email address is a required field.'));
        }
        // Password Sanity Check
        if ((!empty($user_pass1) || !empty($user_pass2)) && $user_pass1 !== $user_pass2) {
            $create_user_errors->add('pass', __('You must enter the same password twice.'));
        } elseif (!isset($_GET['action']) && (empty($user_pass1) && empty($user_pass2))) {
            $create_user_errors->add('pass', __('You must enter a password.'));
        } elseif (isset($_GET['action']) && (empty($user_pass1) && empty($user_pass2))) {
            $user_pass = '';
        } else {
            $user_pass = $user_pass1;
        }
        // No errors
        if (!$create_user_errors->get_error_messages()) {
            // Create or udpate
            switch ($_POST['action']) {
                case 'create':
                    $goback = bb_get_uri('bb-admin/users.php', array('created' => 'true'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
                    $user = $nxt_users_object->new_user(compact('user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass'));
                    // Error handler
                    if (is_nxt_error($user)) {
                        bb_admin_notice($user);
                        unset($goback);
                        // Update additional user data
                    } else {
                        // Update caps
                        bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array($user_role => true));
                        // Update all user meta
                        foreach ($user_meta as $key => $value) {
                            bb_update_usermeta($user['ID'], $key, $value);
                        }
                        // Don't send email if empty
                        if (!empty($user_pass)) {
                            bb_send_pass($user['ID'], $user_pass);
                        }
                        do_action('bb_new_user', $user['ID'], $user_pass);
                    }
                    break;
                case 'update':
                    $goback = bb_get_uri('bb-admin/users.php', array('updated' => 'true'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
                    $user = $nxt_users_object->get_user($_GET['user_id'], array('output' => ARRAY_A));
                    bb_update_user($user['ID'], $user_email, $user_url, $user_display_name);
                    // Don't change PW if empty
                    if (!empty($user_pass)) {
                        bb_update_user_password($user['ID'], $user_pass);
                    }
                    // Error handler
                    if (is_nxt_error($user)) {
                        bb_admin_notice($user);
                        unset($goback);
                        // Update additional user data
                    } else {
                        // Update caps
                        bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array($user_role => true));
                        // Update all user meta
                        foreach ($user_meta as $key => $value) {
                            bb_update_usermeta($user['ID'], $key, $value);
                        }
                        // Don't send email if empty
                        if (!empty($user_pass)) {
//.........这里部分代码省略.........
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:101,代码来源:functions.bb-admin.php

示例4: bb_break_password

         }
     }
 }
 if (bb_current_user_can('edit_users')) {
     if (!array_key_exists($role, $user->capabilities)) {
         $user_obj->set_role($role);
         // Only support one role for now
         if ('blocked' == $role && 'blocked' != $old_role) {
             bb_break_password($user->ID);
         } elseif ('blocked' != $role && array_key_exists('blocked', $user->capabilities)) {
             bb_fix_password($user->ID);
         }
     }
     foreach ($profile_admin_keys as $key => $label) {
         if (${$key} != '' || isset($user->{$key})) {
             bb_update_usermeta($user->ID, $key, ${$key});
         }
     }
     foreach ($assignable_caps as $cap => $label) {
         if (!($already = array_key_exists($cap, $user->capabilities)) && ${$cap}) {
             $user_obj->add_cap($cap);
         } elseif (!${$cap} && $already) {
             $user_obj->remove_cap($cap);
         }
     }
 }
 if (bb_current_user_can('change_user_password', $user->ID) && !empty($_POST['pass1'])) {
     $_POST['pass1'] = addslashes($_POST['pass1']);
     bb_update_user_password($user->ID, $_POST['pass1']);
     if (bb_get_current_user_info('ID') == $user->ID) {
         bb_clear_auth_cookie();
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:profile-edit.php

示例5: bb_new_user

 function bb_new_user($user_login, $user_email, $user_url, $user_status = 1)
 {
     global $wp_users_object, $bbdb;
     // is_email check + dns
     if (!($user_email = is_email($user_email))) {
         return new WP_Error('user_email', __('Invalid email address'), $user_email);
     }
     if (!($user_login = sanitize_user($user_login, true))) {
         return new WP_Error('user_login', __('Invalid username'), $user_login);
     }
     // user_status = 1 means the user has not yet been verified
     $user_status = is_numeric($user_status) ? (int) $user_status : 1;
     if (defined('BB_INSTALLING')) {
         $user_status = 0;
     }
     $user_nicename = $_user_nicename = bb_user_nicename_sanitize($user_login);
     if (strlen($_user_nicename) < 1) {
         return new WP_Error('user_login', __('Invalid username'), $user_login);
     }
     while (is_numeric($user_nicename) || ($existing_user = bb_get_user_by_nicename($user_nicename))) {
         $user_nicename = bb_slug_increment($_user_nicename, $existing_user->user_nicename, 50);
     }
     $user_url = $user_url ? bb_fix_link($user_url) : '';
     $user_pass = bb_generate_password();
     $user = $wp_users_object->new_user(compact('user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass'));
     if (is_wp_error($user)) {
         if ('user_nicename' == $user->get_error_code()) {
             return new WP_Error('user_login', $user->get_error_message());
         }
         return $user;
     }
     if (BB_INSTALLING) {
         bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array('keymaster' => true));
     } else {
         bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array('member' => true));
         bb_send_pass($user['ID'], $user['plain_pass']);
     }
     do_action('bb_new_user', $user['ID'], $user['plain_pass']);
     return $user['ID'];
 }
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:40,代码来源:functions.bb-pluggable.php

示例6: bb_delete_user_setting

/**
 * Delete user interface settings.
 *
 * Deleting settings would reset them to the defaults.
 *
 * @package bbPress
 * @subpackage Meta
 * @since 1.0
 *
 * @param mixed $names The name or array of names of the setting to be deleted.
 */
function bb_delete_user_setting($names)
{
    $arr = bb_get_all_user_settings();
    $names = (array) $names;
    if (!($user = bb_get_current_user())) {
        return;
    }
    foreach ($names as $name) {
        if (isset($arr[$name])) {
            unset($arr[$name]);
            $settings = '';
        }
    }
    if (isset($settings)) {
        foreach ($arr as $k => $v) {
            $settings .= $k . '=' . $v . '&';
        }
        $settings = rtrim($settings, '&');
        bb_update_usermeta($user->ID, 'bb_user_settings', $settings);
        setcookie('bb-user-settings-' . $user->ID, $settings, time() + 31536000, $bb->cookiepath);
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:33,代码来源:functions.bb-meta.php

示例7: bb_fermion

function bb_fermion($user_id, $topic_id = 0)
{
    global $bbdb;
    $user_id = (int) $user_id;
    $topic_id = (int) $topic_id;
    if (!$topic_id) {
        bb_delete_usermeta($user_id, 'is_bozo');
    } else {
        $topic = get_topic($topic_id);
        $user = bb_get_user($user_id);
        if (--$topic->bozos[$user_id] < 1) {
            unset($topic->bozos[$user_id]);
        }
        bb_update_topicmeta($topic_id, 'bozos', $topic->bozos);
        if (--$user->bozo_topics[$topic_id] < 1) {
            unset($user->bozo_topics[$topic_id]);
        }
        bb_update_usermeta($user_id, $bbdb->prefix . 'bozo_topics', $user->bozo_topics);
    }
}
开发者ID:laiello,项目名称:cartonbank,代码行数:20,代码来源:bozo.php

示例8: mod_notification_profile_edit

function mod_notification_profile_edit()
{
    global $user_id;
    if (is_moderator($user_id)) {
        bb_update_usermeta($user_id, "mod_notification", $_POST['mod_notification']);
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:7,代码来源:moderator_notification.php

示例9: bb_li_connect

function bb_li_connect()
{
    global $wp_users_object, $li_attr;
    //li authorization
    if (!$_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
        try_li_connect();
    }
    $me = get_li_profile();
    if (!$me) {
        bb_die("Linkedin Connect failed");
        exit;
    }
    $li_id = trim($me->{$li_attr}['id']);
    //bb_die($li_id);
    if (!$li_id) {
        bb_die("LinkedIn Connect failed, no user id found.");
        exit;
    }
    // Check if the user has already connected before
    $user_id = li_get_userid_by_linkedin_id($li_id);
    if (!$user_id) {
        // User did not exist yet, lets create the local account
        // First order of business is to find a unused usable account name
        for ($i = 1;; $i++) {
            $user_login = strtolower(sanitize_user(li_get_user_displayname($me), true));
            $user_login = str_replace(' ', '_', $user_login);
            $user_login = str_replace('__', '_', $user_login);
            if (strlen($user_login) < 2) {
                $user_login = "user";
            }
            if (strlen($user_login) > 50 - strlen($i)) {
                $user_login = substr($user_login, 0, 50 - strlen($i));
            }
            if ($i > 1) {
                $user_login .= $i;
            }
            // A very rare potential race condition exists here, if two users with the same name
            // happen to register at the same time. One of them would fail, and have to retry.
            if (bb_get_user($user_login, array('by' => 'login')) === false) {
                break;
            }
        }
        $user_nicename = $user_login;
        $user_email = $user_login . "@none.local";
        $user_url = trim($me->{$li_attr}['public-profile-url']);
        $user_url = $user_url ? bb_fix_link($user_url) : '';
        $user_status = 0;
        $user_pass = bb_generate_password();
        // User may have given permission to use his/her real email. Lets use it if so.
        /*if (isset($me['email']) && $me['email'] != '' && is_email($me['email'])) {
        			$user_email = trim($me['email']);
        			if (bb_get_user($user_email, array ('by' => 'email')) !== false) {
        				// Uh oh. A user with this email already exists. This does not work out for us.
        				bb_die("Error: an user account with the email address '$user_email' already exists.");
        			}	
        		}*/
        $user = $wp_users_object->new_user(compact('user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass'));
        if (!$user || is_wp_error($user)) {
            bb_die("Creating new user failed");
            exit;
        }
        $user_id = $user['ID'];
        //bb_die($user_id);
        bb_update_usermeta($user_id, $bbdb->prefix . 'capabilities', array('member' => true));
        bb_update_usermeta($user_id, 'linkedin_id', $li_id);
        bb_update_usermeta($user_id, 'prompt_email', '1');
        // will prompt user for email until set false. 1=true 0=false
        bb_update_usermeta($user_id, 'li_avatar', trim($me->{$li_attr}['picture-url']));
        // user avatar
        bb_update_user($user_id, $user_email, $user_url, li_get_user_displayname($me));
        bb_update_usermeta($user_id, 'first_name', trim($me->{$li_attr}['first-name']));
        bb_update_usermeta($user_id, 'last_name', trim($me->{$li_attr}['last-name']));
        bb_update_usermeta($user_id, 'occ', trim($me->{$li_attr}['headline']));
        bb_update_usermeta($user_id, 'interest', trim($me->{$li_attr}['industry']));
        do_action('bb_new_user', $user_id, $user_pass);
        do_action('register_user', $user_id);
    } else {
        bb_update_usermeta($user_id, 'prompt_email', '1');
        bb_update_usermeta($user_id, 'li_avatar', trim($me->{$li_attr}['picture-url']));
        if (!bb_get_option('li_allow_useredit')) {
            // enforce first name, last name and display name if the users are not allowed to change them
            bb_update_user($user_id, bb_get_user_email($user_id), get_user_link($user_id), li_get_user_displayname($me));
            bb_update_usermeta($user_id, 'first_name', trim($me->{$li_attr}['first-name']));
            bb_update_usermeta($user_id, 'last_name', trim($me->{$li_attr}['last-name']));
            bb_update_usermeta($user_id, 'occ', trim($me->{$li_attr}['headline']));
            bb_update_usermeta($user_id, 'interest', trim($me->{$li_attr}['industry']));
        }
    }
    bb_set_auth_cookie($user_id, true);
    do_action('bb_user_login', $user_id);
    $redirect_url = $_REQUEST['li_bb_connect'];
    if (strpos($redirect_url, bb_get_option('uri')) !== 0) {
        $redirect_url = bb_get_option('uri');
    }
    bb_safe_redirect($redirect_url);
    exit;
}
开发者ID:nma,项目名称:linkedin-connect,代码行数:97,代码来源:connect.php

示例10: oip_login_success

function oip_login_success($uID = false, $oip_redir = false)
{
    if (!$uID) {
        return false;
    } else {
        if (is_object($uID)) {
            $uID = (int) $uID->ID;
        }
        //echo "loading userID" . $uID;
        wp_set_auth_cookie($uID, 0);
        bb_update_usermeta($uID, 'openid_debug', $_GET);
        if ($_GET['openid_op_endpoint']) {
            bb_update_usermeta($uID, 'oip_openid_url', $_GET['openid_op_endpoint']);
        }
    }
    //update_user_meta	//if user tries with a new openid provider and we get the same email address, we should add it to the user's profile
    //do_action('oip_register_success');
    if ($oip_redir) {
        bb_safe_redirect($oip_redir);
        exit;
    } else {
        bb_safe_redirect(bb_get_option('uri'));
        exit;
    }
    exit;
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:26,代码来源:openidplus.php

示例11: bb_topics_replied_on_undelete_post

function bb_topics_replied_on_undelete_post($post_id)
{
    global $bbdb;
    $bb_post = bb_get_post($post_id);
    $topic = get_topic($bb_post->topic_id);
    $user_posts = new BB_Query('post', array('post_author_id' => $bb_post->poster_id, 'topic_id' => $topic->topic_id));
    if (1 == count($user_posts) && ($user = bb_get_user($bb_post->poster_id))) {
        $topics_replied_key = $bbdb->prefix . 'topics_replied';
        bb_update_usermeta($user->ID, $topics_replied_key, $user->{$topics_replied_key} + 1);
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:11,代码来源:functions.bb-posts.php

示例12: bb_new_user

    }
    if (!$bad_input) {
        $user_id = bb_new_user($user_login, $_POST['user_email'], $_POST['user_url']);
        if (is_wp_error($user_id)) {
            // error
            foreach ($user_id->get_error_codes() as $code) {
                $bb_register_error->add($code, $user_id->get_error_message($code));
            }
            if ($bb_register_error->get_error_message('user_login')) {
                $user_safe = false;
            }
        } elseif ($user_id) {
            // success
            foreach ($profile_info_keys as $key => $label) {
                if (strpos($key, 'user_') !== 0 && ${$key} !== '') {
                    bb_update_usermeta($user_id, $key, ${$key});
                }
            }
            do_action('register_user', $user_id);
            bb_load_template('register-success.php', $_globals);
            exit;
        }
        // else failure
    }
}
if (isset($_GET['user'])) {
    $user_login = sanitize_user($_GET['user'], true);
} elseif (isset($_POST['user_login']) && !is_string($user_login)) {
    $user_login = '';
}
bb_load_template('register.php', $_globals);
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:register.php

示例13: notification_profile_edit

function notification_profile_edit()
{
    global $user_id;
    bb_update_usermeta($user_id, "favorite_notification", $_POST['favorite_notification']);
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:5,代码来源:notification.php

示例14: update_user_twitter

function update_user_twitter()
{
    global $user_id, $bb_twitter;
    $twitter = $_POST['twitter'];
    if ($_POST['show_tweets']) {
        $tweets_on = "yes";
    } else {
        $tweets_on = "no";
    }
    if ($_POST['show_tweets_post']) {
        $tweets_on_post = "yes";
    } else {
        $tweets_on_post = "no";
    }
    bb_update_usermeta($user_id, "twitter", $twitter);
    bb_update_usermeta($user_id, "twitter_on", $tweets_on);
    bb_update_usermeta($user_id, "twitter_on_post", $tweets_on_post);
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:18,代码来源:bb-twitter.php

示例15: bb_upgrade_170

function bb_upgrade_170()
{
    if (($dbv = bb_get_option_from_db('bb_db_version')) && $dbv >= 536) {
        return;
    }
    global $bbdb;
    foreach ((array) $bbdb->get_results("SELECT * FROM {$bbdb->usermeta} WHERE meta_value LIKE '%&quot;%' OR meta_value LIKE '%&#039;%'") as $meta) {
        $value = str_replace(array('&quot;', '&#039;'), array('"', "'"), $meta->meta_value);
        $value = stripslashes($value);
        bb_update_usermeta($meta->user_id, $meta->meta_key, $value);
    }
    bb_update_option('bb_db_version', 536);
    return 'Done updating usermeta: ' . __FUNCTION__;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:14,代码来源:functions.bb-upgrade.php


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