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


PHP sp_update_member_item函数代码示例

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


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

示例1: sp_admin_bar_do_install

function sp_admin_bar_do_install()
{
    global $spThisUser;
    $oldOptions = sp_get_option('sfadminsettings');
    $newOptions = sp_get_option('spAdminBar');
    if (!isset($oldOptions['sfqueue']) && empty($newOptions)) {
        $newOptions = array();
        $newOptions['dashboardposts'] = false;
        $newOptions['dbversion'] = SPABDBVERSION;
        sp_add_option('spAdminBar', $newOptions);
        $options = sp_get_member_item($spThisUser->ID, 'admin_options');
        $options['sfadminbar'] = true;
        sp_update_member_item($spThisUser->ID, 'admin_options', $options);
    } else {
        if (empty($newOptions)) {
            $newOptions = array();
            $newOptions['dashboardposts'] = $oldOptions['sfdashboardposts'];
            $newOptions['dbversion'] = SPABDBVERSION;
            sp_add_option('spAdminBar', $newOptions);
            $options = sp_get_member_item($spThisUser->ID, 'admin_options');
            $options['sfadminbar'] = true;
            sp_update_member_item($spThisUser->ID, 'admin_options', $options);
            unset($oldOptions['sfqueue']);
            unset($oldOptions['sfmodasadmin']);
            unset($oldOptions['sfshowmodposts']);
            unset($oldOptions['sfbaronly']);
            unset($oldOptions['sfdashboardposts']);
            sp_update_option('sfadminsettings', $oldOptions);
        }
    }
    # permission for bypassing akismet checks
    sp_add_auth('bypass_akismet', __('Can bypass akismet check on posts', 'spab'), 1, 0, 0, 0, 3);
    sp_activate_auth('bypass_akismet');
    # create new Akismet setting
    $akismet = sp_get_option('spAkismet');
    if (empty($akismet)) {
        sp_add_option('spAkismet', 1);
    }
    # get auto update running
    $autoup = array('spabupdate', 'sp_ahah=admin-bar-update&target=newposts');
    sp_add_sfmeta('autoupdate', 'admin', $autoup, 1);
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:42,代码来源:sp-admin-bar-install.php

示例2: while

    while (false !== ($file = readdir($dlist))) {
        if ($file != "." && $file != "..") {
            echo '<img class="spAvatarPool" src="' . esc_url(SFAVATARPOOLURL . '/' . $file) . '" alt="" onclick="spjSelAvatar(\'' . $file . '\', \'' . esc_js("<p class=\\'spCenter\\'>" . sp_text('Avatar selected. Please save pool avatar') . "</p>") . '\'); return jQuery(\'#dialog\').dialog(\'close\');" />&nbsp;&nbsp;';
        }
    }
    echo '</p>';
    closedir($dlist);
    die;
}
if (isset($_GET['poolremove']) && ($spThisUser->ID == $userid || $spThisUser->admin)) {
    if (empty($userid)) {
        die;
    }
    $avatar = sp_get_member_item($userid, 'avatar');
    $avatar['pool'] = '';
    sp_update_member_item($userid, 'avatar', $avatar);
    echo '<strong>' . sp_text('No pool avatar currently selected') . '</strong>';
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=profile&sfnonce=' . wp_create_nonce('forum-ahah') . "&action=update-display-avatar&user={$userid}";
    ?>
	<script type="text/javascript">
	jQuery(document).ready(function() {
        jQuery('#spProfileDisplayAvatar').load('<?php 
    echo $ahahURL;
    ?>
');
	})
	</script>
<?php 
    die;
}
die;
开发者ID:bself,项目名称:nuimage-wp,代码行数:31,代码来源:sp-ahah-profile.php

示例3: sp_convert_ranks

function sp_convert_ranks()
{
    spdb_query('ALTER TABLE ' . SFMEMBERS . ' ADD (special_ranks text default NULL)');
    # convert special rank users to new column in sfmembers
    $special_rankings = sp_get_sfmeta('special_rank');
    if ($special_rankings) {
        foreach ($special_rankings as $rank) {
            if (empty($rank['meta_value']['users'])) {
                continue;
            }
            $users = $rank['meta_value']['users'];
            foreach ($users as $user) {
                $memberData = sp_get_member_item($user, 'special_ranks');
                $memberData[] = $rank['meta_key'];
                sp_update_member_item($user, 'special_ranks', $memberData);
            }
            unset($rank['meta_value']['users']);
            sp_update_sfmeta('special_rank', $rank['meta_key'], $rank['meta_value'], $rank['meta_id'], 1);
        }
    }
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:21,代码来源:sp-upgrade-support.php

示例4: sp_destroy_users_newposts

function sp_destroy_users_newposts($forumid = '')
{
    global $spThisUser;
    if (empty($forumid) || empty($spThisUser->newposts['topics'])) {
        $newPostList = array();
        $newPostList['topics'] = array();
        $newPostList['forums'] = array();
        $spThisUser->newposts = '';
    } else {
        $newPostList = $spThisUser->newposts;
        foreach ($spThisUser->newposts['forums'] as $index => $forum) {
            if ($forum == $forumid) {
                unset($newPostList['topics'][$index]);
                unset($newPostList['forums'][$index]);
            }
        }
        $newPostList['topics'] = array_values($newPostList['topics']);
        $newPostList['forums'] = array_values($newPostList['forums']);
        $spThisUser->newposts = $newPostList;
    }
    sp_update_member_item($spThisUser->ID, 'newposts', $newPostList);
    sp_update_member_item($spThisUser->ID, 'checktime', 0);
    sp_set_server_timezone();
    $spThisUser->checktime = sp_apply_timezone(time(), 'mysql');
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:25,代码来源:sp-db-newposts.php

示例5: sp_UpdateProfile


//.........这里部分代码省略.........
            break;
        case 'edit-profile':
            # update profile settings
            # validate any username change
            $update = apply_filters('sph_ProfileUserDisplayNameUpdate', true);
            if ($update) {
                $spProfile = sp_get_option('sfprofile');
                if ($spProfile['nameformat'] || $spThisUser->admin) {
                    $display_name = !empty($_POST['display_name']) ? trim($_POST['display_name']) : spdb_table(SFUSERS, "ID={$thisUser}", 'user_login');
                    $display_name = sp_filter_name_save($display_name);
                    # make sure display name isnt already used
                    if ($_POST['oldname'] != $display_name) {
                        $records = spdb_table(SFMEMBERS, "display_name='{$display_name}'");
                        if ($records) {
                            foreach ($records as $record) {
                                if ($record->user_id != $thisUser) {
                                    $message['type'] = 'error';
                                    $message['text'] = $display_name . ' ' . sp_text('is already in use - please choose a different display name');
                                    return $message;
                                }
                            }
                        }
                        # validate display name
                        $errors = new WP_Error();
                        $user = new stdClass();
                        $user->display_name = $display_name;
                        sp_validate_display_name($errors, true, $user);
                        if ($errors->get_error_codes()) {
                            $message['type'] = 'error';
                            $message['text'] = sp_text('The display name you have chosen is not allowed on this site');
                            return $message;
                        }
                        # now save the display name
                        sp_update_member_item($thisUser, 'display_name', $display_name);
                        # Update new users list with changed display name
                        sp_update_newuser_name(sp_filter_name_save($_POST['oldname']), $display_name);
                        # do we need to sync display name with wp?
                        $options = sp_get_member_item($thisUser, 'user_options');
                        if ($options['namesync']) {
                            spdb_query('UPDATE ' . SFUSERS . ' SET display_name="' . $display_name . '" WHERE ID=' . $thisUser);
                        }
                    }
                }
            }
            # save the url
            $update = apply_filters('sph_ProfileUserWebsiteUpdate', true);
            if ($update) {
                $url = sp_filter_url_save($_POST['website']);
                $sql = 'UPDATE ' . SFUSERS . ' SET user_url="' . $url . '" WHERE ID=' . $thisUser;
                spdb_query($sql);
            }
            # update first name, last name, location and biorgraphy
            $update = apply_filters('sph_ProfileUserFirstNameUpdate', true);
            if ($update) {
                update_user_meta($thisUser, 'first_name', sp_filter_name_save(trim($_POST['first_name'])));
            }
            $update = apply_filters('sph_ProfileUserLastNameUpdate', true);
            if ($update) {
                update_user_meta($thisUser, 'last_name', sp_filter_name_save(trim($_POST['last_name'])));
            }
            $update = apply_filters('sph_ProfileUserLocationUpdate', true);
            if ($update) {
                update_user_meta($thisUser, 'location', sp_filter_title_save(trim($_POST['location'])));
            }
            $update = apply_filters('sph_ProfileUserBiographyUpdate', true);
            if ($update) {
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:67,代码来源:sp-ahah-profile-save.php

示例6: sp_setup_page_type

function sp_setup_page_type()
{
    global $spVars, $spGlobals, $spThisUser, $spBootCache, $spStatus;
    if ($spStatus != 'ok') {
        return;
    }
    if (isset($spGlobals['pagetypedone']) && $spGlobals['pagetypedone'] == true) {
        return;
    }
    $spGlobals['pagetypedone'] = true;
    # If user has made no posts yet optionaly load the profile form
    $pageview = '';
    $goProfile = false;
    if ($spThisUser->member && $spThisUser->posts == -1) {
        sp_update_member_item($spThisUser->ID, 'posts', 0);
        # reset posts to 0 on first visit
        # do new users need to visit profile first?
        $sfprofile = sp_get_option('sfprofile');
        $goProfile = $sfprofile['firstvisit'];
    }
    # do we need to redirec to profile for pw change or first visit?
    if ($spThisUser->member && ($goProfile || isset($spThisUser->sp_change_pw) && $spThisUser->sp_change_pw)) {
        $spVars['member'] = (int) $spThisUser->ID;
        $pageview = 'profileedit';
        $spVars['forumslug'] = '';
        $spVars['topicslug'] = '';
    }
    if ($pageview == '') {
        if (!empty($spVars['feed'])) {
            $pageview = 'feed';
        } else {
            if (!empty($spVars['forumslug'])) {
                $pageview = 'forum';
            } else {
                if (!empty($spVars['profile'])) {
                    if ($spVars['profile'] == 'edit') {
                        $pageview = 'profileedit';
                    }
                    if ($spVars['profile'] == 'show') {
                        $pageview = 'profileshow';
                    }
                } else {
                    if (!empty($spVars['newposts'])) {
                        $pageview = 'newposts';
                    } else {
                        if (!empty($spVars['members'])) {
                            $pageview = 'members';
                        } else {
                            $pageview = 'group';
                            # and if a single group id is passed load ot ointo spVars
                            if (isset($_GET['group'])) {
                                $spVars['singlegroupid'] = sp_esc_int($_GET['group']);
                            }
                            # Check if single forum only is on
                            if (isset($spGlobals['display']['forums']['singleforum']) && $spGlobals['display']['forums']['singleforum']) {
                                $fid = sp_single_forum_user();
                                if ($fid) {
                                    $cforum = spdb_table(SFFORUMS, "forum_id={$fid}", 'row');
                                    $spVars['forumid'] = $fid;
                                    $spVars['forumslug'] = $cforum->forum_slug;
                                    $spVars['forumname'] = $cforum->forum_name;
                                    $spBootCache = '';
                                    $pageview = 'forum';
                                }
                            }
                        }
                    }
                }
            }
        }
        if (!empty($spVars['topicslug'])) {
            $pageview = 'topic';
        }
        if (isset($_GET['search']) && !empty($spVars['searchvalue'])) {
            $pageview = 'search';
        }
    }
    # profile via ssl if doing ssl logins
    if ($pageview == 'profileedit' && force_ssl_admin() && !is_ssl()) {
        if (sp_profile_tab_active('profile') && sp_profile_menu_active('account-settings')) {
            if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
                wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
                exit;
            } else {
                wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
                exit;
            }
        }
    }
    $spVars['pageview'] = apply_filters('sph_pageview', $pageview);
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:91,代码来源:sp-forum-support-functions.php

示例7: saveData

 function saveData()
 {
     global $spVars, $spGlobals;
     $this->abort = false;
     $this->newpost['action'] = $this->action;
     # make the entire class object available for modification before saving
     # warning:  note the passing by reference.  other end could wreak havoc
     do_action_ref_array('sph_new_post_pre_save', array(&$this));
     # Write the topic if needed
     if ($this->action == 'topic') {
         $this->newpost = apply_filters('sph_new_topic_pre_data_saved', $this->newpost);
         $spdb = new spdbComplex();
         $spdb->table = SFTOPICS;
         $spdb->fields = array('topic_name', 'topic_slug', 'topic_date', 'forum_id', 'topic_status', 'topic_pinned', 'user_id');
         $spdb->data = array($this->newpost['topicname'], $this->newpost['topicslug'], $this->newpost['postdate'], $this->newpost['forumid'], $this->newpost['topicstatus'], $this->newpost['topicpinned'], $this->newpost['userid']);
         $spdb = apply_filters('sph_new_topic_data', $spdb);
         $this->newpost['db'] = $spdb->insert();
         if ($this->newpost['db'] == true) {
             $this->newpost['topicid'] = $spVars['insertid'];
             $this->newpost = apply_filters('sph_new_topic_data_saved', $this->newpost);
         } else {
             $this->abort = true;
             $this->message = sp_text('Unable to save new topic record');
             return;
         }
         # failsafe: check the topic slug and if empty use the topic id
         if (empty($this->newpost['topicslug'])) {
             $this->newpost['topicslug'] = 'topic-' . $this->newpost['topicid'];
             spdb_query('UPDATE ' . SFTOPICS . " SET topic_slug='" . $this->newpost['topicslug'] . "' WHERE topic_id=" . $this->newpost['topicid']);
         }
     }
     # Write the post
     # Double check forum id is correct - it has been known for a topic to have just been moved!
     $this->newpost['forumid'] = spdb_table(SFTOPICS, 'topic_id=' . $this->newpost['topicid'], 'forum_id');
     # Get post count in topic to enable post index setting
     $index = spdb_count(SFPOSTS, 'topic_id = ' . $this->newpost['topicid']);
     $index++;
     $this->newpost['postindex'] = $index;
     # if topic lock set in post reply update topic (post only)
     if ($this->action == 'post' && $this->newpost['topicstatus']) {
         spdb_query('UPDATE ' . SFTOPICS . ' SET topic_status=1 WHERE topic_id=' . $this->newpost['topicid']);
     }
     $this->newpost = apply_filters('sph_new_post_pre_data_saved', $this->newpost);
     $spdb = new spdbComplex();
     $spdb->table = SFPOSTS;
     $spdb->fields = array('post_content', 'post_date', 'topic_id', 'forum_id', 'user_id', 'guest_name', 'guest_email', 'post_pinned', 'post_index', 'post_status', 'poster_ip', 'source');
     $spdb->data = array($this->newpost['postcontent'], $this->newpost['postdate'], $this->newpost['topicid'], $this->newpost['forumid'], $this->newpost['userid'], $this->newpost['guestname'], $this->newpost['guestemail'], $this->newpost['postpinned'], $this->newpost['postindex'], $this->newpost['poststatus'], $this->newpost['posterip'], $this->newpost['source']);
     $spdb = apply_filters('sph_new_post_data', $spdb);
     $this->newpost['db'] = $spdb->insert();
     if ($this->newpost['db'] == true) {
         $this->newpost['postid'] = $spVars['insertid'];
         $this->newpost = apply_filters('sph_new_post_data_saved', $this->newpost);
     } else {
         $this->abort = true;
         $this->message = sp_text('Unable to save new post message');
         return;
     }
     # Update the timestamp of the last post
     sp_update_option('poststamp', $this->newpost['postdate']);
     $this->returnURL = sp_build_url($this->newpost['forumslug'], $this->newpost['topicslug'], 0, $this->newpost['postid']);
     if ($this->newpost['poststatus']) {
         $this->newpost['submsg'] .= ' - ' . sp_text('placed in moderation') . ' ';
     }
     # Now for all that post-save processing required
     if ($this->guest) {
         $sfguests = sp_get_option('sfguests');
         if ($sfguests['storecookie']) {
             sp_write_guest_cookie($this->newpost['guestname'], $this->newpost['guestemail']);
         }
     } else {
         $postcount = sp_get_member_item($this->newpost['userid'], 'posts');
         $postcount++;
         sp_update_member_item($this->newpost['userid'], 'posts', $postcount);
         # see if postcount qualifies member for new user group membership
         # get rankings information
         if (!$this->admin) {
             # ignore for admins as they dont belong to user groups
             global $spGlobals;
             if (!empty($spGlobals['forum_rank'])) {
                 $index = 0;
                 foreach ($spGlobals['forum_rank'] as $x => $info) {
                     $rankdata['title'][$index] = $x;
                     $rankdata['posts'][$index] = $info['posts'];
                     $rankdata['usergroup'][$index] = $info['usergroup'];
                     $index++;
                 }
                 # sort rankings
                 array_multisort($rankdata['posts'], SORT_ASC, $rankdata['title'], $rankdata['usergroup']);
                 # check for new ranking
                 for ($x = 0; $x < count($rankdata['posts']); $x++) {
                     if ($postcount <= $rankdata['posts'][$x] && !empty($rankdata['usergroup'][$x])) {
                         # if a user group is tied to forum rank add member to the user group
                         if ($rankdata['usergroup'][$x] != 'none') {
                             sp_add_membership($rankdata['usergroup'][$x], $this->newpost['userid']);
                         }
                         break;
                         # only update highest rank
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:101,代码来源:sp-api-class-post.php

示例8: sp_destroy_users_newposts

function sp_destroy_users_newposts()
{
    global $spThisUser;
    $newPostList = array();
    $newPostList['topics'] = array();
    $newPostList['forums'] = array();
    sp_update_member_item($spThisUser->ID, 'newposts', $newPostList);
    sp_update_member_item($spThisUser->ID, 'checktime', 0);
    sp_set_server_timezone();
    $spThisUser->checktime = sp_apply_timezone(time(), 'mysql');
    $spThisUser->newposts = '';
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:12,代码来源:sp-db-newposts.php

示例9: sp_set_last_visited

function sp_set_last_visited($userid)
{
    global $spThisUser;
    # before setting last visit check and save timezone difference just to be sure.
    $opts = sp_get_member_item($userid, 'user_options');
    if (!empty($opts['timezone_string'])) {
        if (preg_match('/^UTC[ \\t+-]/', $opts['timezone_string'])) {
            # correct for manual UTC offets
            $userOffset = preg_replace('/UTC\\+?/', '', $opts['timezone_string']) * 3600;
        } else {
            # get timezone offset for user
            $date_time_zone_selected = new DateTimeZone(sp_esc_str($opts['timezone_string']));
            $userOffset = timezone_offset_get($date_time_zone_selected, date_create());
        }
        $wptz = get_option('timezone_string');
        if (empty($wptz)) {
            $serverOffset = get_option('gmt_offset');
        } else {
            $date_time_zone_selected = new DateTimeZone($wptz);
            $serverOffset = timezone_offset_get($date_time_zone_selected, date_create());
        }
        # calculate time offset between user and server
        $ntz = (int) round(($userOffset - $serverOffset) / 3600, 2);
        if ($opts['timezone'] != $ntz) {
            $opts['timezone'] = $ntz;
            $spThisUser->timezone = $ntz;
            sp_update_member_item($userid, 'user_options', $opts);
            sp_update_member_item($userid, 'checktime', 0);
        }
    }
    # Now set the last visit date/time
    sp_update_member_item($userid, 'lastvisit', 0);
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:33,代码来源:sp-db-statistics.php

示例10: sp_perform_install


//.........这里部分代码省略.........
            echo '<h5>' . spa_text('Phase') . ' - ' . $phase . ' - ';
            if ($successCopy1 && $successExtract1 && $successCopy2 && $successExtract2) {
                spa_etext('Resources created') . '</h5>';
            } elseif (!$successCopy1 || !$successCopy2) {
                spa_etext('Resources file failed to copy') . '</h5>';
            } elseif (!$successExtract1 || !$successExtract2) {
                spa_etext('Resources file failed to unzip');
                echo ' - ' . $archive->error_string . '</h5>';
            }
            break;
        case 8:
            # CREATE MEMBERS TABLE ---------------------------
            sp_install_members_table($subphase);
            echo '<h5>' . spa_text('Phase') . ' - ' . $phase . ' - ';
            echo spa_text('Members data created for existing users') . ' ' . (($subphase - 1) * 200 + 1) . ' - ' . $subphase * 200 . '</h5>';
            break;
        case 9:
            # add our caps
            sp_add_caps();
            # grant spf capabilities to installer
            $user = new WP_User($current_user->ID);
            $user->add_cap('SPF Manage Options');
            $user->add_cap('SPF Manage Forums');
            $user->add_cap('SPF Manage User Groups');
            $user->add_cap('SPF Manage Permissions');
            $user->add_cap('SPF Manage Components');
            $user->add_cap('SPF Manage Admins');
            $user->add_cap('SPF Manage Users');
            $user->add_cap('SPF Manage Profiles');
            $user->add_cap('SPF Manage Toolbox');
            $user->add_cap('SPF Manage Plugins');
            $user->add_cap('SPF Manage Themes');
            $user->add_cap('SPF Manage Integration');
            sp_update_member_item($current_user->ID, 'admin', 1);
            # admin your option defaults
            $sfadminoptions = array();
            $sfadminoptions['sfnotify'] = false;
            $sfadminoptions['notify-edited'] = true;
            sp_update_member_item($current_user->ID, 'admin_options', $sfadminoptions);
            echo '<h5>' . spa_text('Phase') . ' - ' . $phase . ' - ';
            spa_etext('Admin permission data built') . '</h5>';
            break;
        case 10:
            # UPDATE VERSION/BUILD NUMBERS -------------------------
            sp_log_event(SPRELEASE, SPVERSION, SPBUILD);
            # Lets update permalink and force a rewrite rules flush
            sp_update_permalink(true);
            echo '<h5>' . spa_text('Phase') . ' - ' . $phase . ' - ';
            spa_etext('Version number updated') . '</h5>';
            break;
        case 11:
            # REPORTS ERRORS IF COPY OR UNZIP FAILED ---------------
            $sCreate1 = sp_get_option('spStorageInstall1');
            $sCreate2 = sp_get_option('spStorageInstall2');
            $sOwners1 = sp_get_option('spOwnersInstall1');
            $sOwners2 = sp_get_option('spOwnersInstall2');
            $sCopy1 = sp_get_option('spCopyZip1');
            $sUnzip1 = sp_get_option('spUnZip1');
            $sCopy2 = sp_get_option('spCopyZip2');
            $sUnzip2 = sp_get_option('spUnZip2');
            if ($sCreate1 && $sCreate2 && $sCopy1 && $sUnzip1 && $sCopy2 && $sUnzip2 && $sOwners1 && $sOwners2) {
                echo '<h5>' . spa_text('The installation has been completed') . '</h5>';
            } else {
                $image = "<img src='" . SF_PLUGIN_URL . "/sp-startup/install/resources/images/important.png' alt='' style='float:left;padding: 5px 5px 20px 0;' />";
                echo '<h5>';
                spa_etext('YOU WILL NEED TO PERFORM THE FOLLOWING TASKS TO ALLOW SIMPLE:PRESS TO WORK CORRECTLY');
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:67,代码来源:sp-install.php

示例11: sp_update_member_moderator_flag

function sp_update_member_moderator_flag($userid)
{
    $ugs = sp_get_user_memberships($userid);
    if ($ugs) {
        foreach ($ugs as $ug) {
            $mod = spdb_table(SFUSERGROUPS, "usergroup_id={$ug['usergroup_id']}", 'usergroup_is_moderator');
            if ($mod) {
                sp_update_member_item($userid, 'moderator', 1);
                # see if our forum moderator list changed
                sp_update_forum_moderators();
                return;
            }
        }
    }
    # not a moderator if we get here
    sp_update_member_item($userid, 'moderator', 0);
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:17,代码来源:sp-api-users.php

示例12: sp_reset_auths

            sp_reset_auths();
        }
    }
    #remove old create links global option
    unset($sffilters['sfallowlinks']);
    sp_update_option('sffilters', $sffilters);
    sp_response($section);
}
$section = 9176;
if ($build < $section) {
    $users = spdb_select('set', 'SELECT user_id, admin_options FROM ' . SFMEMBERS . ' WHERE admin=1 OR moderator=1');
    if ($users) {
        foreach ($users as $user) {
            $options = unserialize($user->admin_options);
            $options['notify-edited'] = true;
            sp_update_member_item($user->user_id, 'admin_options', $options);
        }
    }
    sp_response($section);
}
$section = 9216;
if ($build < $section) {
    # Add default to poster_ip in sfposts
    spdb_query('ALTER TABLE ' . SFPOSTS . " CHANGE poster_ip poster_ip VARCHAR(39) NOT NULL DEFAULT '0.0.0.0'");
    sp_response($section);
}
$section = 9285;
if ($build < $section) {
    sp_add_option('combinecss', false);
    sp_add_option('combinejs', false);
    sp_response($section);
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:31,代码来源:sp-upgrade.php

示例13: spa_save_admins_newadmin_data


//.........这里部分代码省略.........
    if (isset($_POST['add-profiles'])) {
        $profiles = $_POST['add-profiles'];
    } else {
        $profiles = '';
    }
    if (isset($_POST['add-admins'])) {
        $admins = $_POST['add-admins'];
    } else {
        $admins = '';
    }
    if (isset($_POST['add-tools'])) {
        $tools = $_POST['add-tools'];
    } else {
        $tools = '';
    }
    if (isset($_POST['add-plugins'])) {
        $plugins = $_POST['add-plugins'];
    } else {
        $plugins = '';
    }
    if (isset($_POST['add-themes'])) {
        $themes = $_POST['add-themes'];
    } else {
        $themes = '';
    }
    if (isset($_POST['add-integration'])) {
        $integration = $_POST['add-integration'];
    } else {
        $integration = '';
    }
    $added = false;
    for ($index = 0; $index < count($newadmins); $index++) {
        # get user index and sanitize
        $uid = intval($newadmins[$index]);
        $user = new WP_User(sp_esc_int($uid));
        if ($opts == 'on') {
            $user->add_cap('SPF Manage Options');
        }
        if ($forums == 'on') {
            $user->add_cap('SPF Manage Forums');
        }
        if ($ugs == 'on') {
            $user->add_cap('SPF Manage User Groups');
        }
        if ($perms == 'on') {
            $user->add_cap('SPF Manage Permissions');
        }
        if ($comps == 'on') {
            $user->add_cap('SPF Manage Components');
        }
        if ($users == 'on') {
            $user->add_cap('SPF Manage Users');
        }
        if ($profiles == 'on') {
            $user->add_cap('SPF Manage Profiles');
        }
        if ($admins == 'on') {
            $user->add_cap('SPF Manage Admins');
        }
        if ($tools == 'on') {
            $user->add_cap('SPF Manage Toolbox');
        }
        if ($plugins == 'on') {
            $user->add_cap('SPF Manage Plugins');
        }
        if ($themes == 'on') {
            $user->add_cap('SPF Manage Themes');
        }
        if ($integration == 'on') {
            $user->add_cap('SPF Manage Integration');
        }
        $newadmin = $opts == 'on' || $forums == 'on' || $ugs == 'on' || $perms == 'on' || $comps == 'on' || $users == 'on' || $profiles == 'on' || $admins == 'on' || $tools == 'on' || $plugins == 'on' || $themes == 'on' || $integration == 'on';
        $newadmin = apply_filters('sph_admin_caps_new', $newadmin, $user);
        if ($newadmin) {
            $added = true;
            # flag as admin with remove moderator flag
            sp_update_member_item($uid, 'admin', 1);
            sp_update_member_item($uid, 'moderator', 0);
            # admin default options
            $sfadminoptions = array();
            $sfadminoptions['sfnotify'] = false;
            $sfadminoptions['notify-edited'] = false;
            $sfadminoptions['bypasslogout'] = false;
            sp_update_member_item($uid, 'admin_options', $sfadminoptions);
            # remove any usergroup permissions
            spdb_query('DELETE FROM ' . SFMEMBERSHIPS . " WHERE user_id={$uid}");
            do_action('sph_admin_new_admin', $uid);
        }
        # reset auths and memberships for new admins
        sp_reset_memberships($uid);
        sp_reset_auths($uid);
    }
    do_action('sph_admin_new_save');
    if ($added) {
        $mess = spa_text('New admins added!');
    } else {
        $mess = spa_text('No data changed!');
    }
    return $mess;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:101,代码来源:spa-admins-save.php

示例14: __construct


//.........这里部分代码省略.........
         $this->ID = 0;
         $this->guest = true;
         $this->member = 0;
         $this->admin = false;
         $this->moderator = false;
         $this->display_name = 'guest';
         $this->guest_name = '';
         $this->guest_email = '';
         $this->usertype = 'Guest';
         $this->offmember = sp_check_unlogged_user();
         $this->timezone = 0;
         $this->timezone_string = '';
         $this->posts = 0;
         $this->avatar = '';
         $this->user_email = '';
         $this->auths = sp_get_option('sf_guest_auths');
         $this->memberships = sp_get_option('sf_guest_memberships');
         # plugins can add iterms for guests...
         if (!$small) {
             do_action_ref_array('sph_user_class_guest', array(&$this));
         } else {
             do_action_ref_array('sph_user_class_guest_small', array(&$this));
         }
     }
     # Only perform this last section if forum is operational
     if ($spStatus == 'ok') {
         # Ranking
         $this->rank = sp_get_user_forum_rank($this->usertype, $id, $this->posts);
         $this->special_rank = $this->member ? sp_get_user_special_ranks($id) : array();
         # if no memberships rebuild them and save
         if (empty($this->memberships)) {
             $memberships = array();
             if (!empty($id)) {
                 if (!$this->admin) {
                     # get the usergroup memberships for the user and save in sfmembers table
                     $memberships = sp_get_user_memberships($id);
                     sp_update_member_item($id, 'memberships', $memberships);
                 }
             } else {
                 # user is a guest or unassigned member so get the global permissions from the guest usergroup and save as option
                 $value = sp_get_sfmeta('default usergroup', 'sfguests');
                 $memberships[] = spdb_table(SFUSERGROUPS, 'usergroup_id=' . $value[0]['meta_value'], 'row', '', '', ARRAY_A);
                 sp_update_option('sf_guest_memberships', $memberships);
             }
             # put in the data
             $this->memberships = $memberships;
         }
         # if no auths rebuild them and save
         if (empty($this->auths)) {
             $this->auths = sp_rebuild_user_auths($id);
         }
     }
     $this->ip = sp_get_ip();
     $this->trackid = -1;
     # Things to do if user is current user
     if ($current) {
         # Set up editor type
         $spGlobals['editor'] = 0;
         # for a user...
         if ($this->member && !empty($this->editor)) {
             $spGlobals['editor'] = $this->editor;
         }
         # and if not defined or is for a guest...
         if ($spGlobals['editor'] == 0) {
             $defeditor = sp_get_option('speditor');
             if (!empty($defeditor)) {
                 $spGlobals['editor'] = $defeditor;
             }
         }
         # final check to ensure selected editor type is indeed available
         if ($spGlobals['editor'] == 0 || $spGlobals['editor'] == 1 && !defined('RICHTEXT') || $spGlobals['editor'] == 2 && !defined('HTML') || $spGlobals['editor'] == 3 && !defined('BBCODE')) {
             $spGlobals['editor'] = PLAINTEXT;
             if (defined('BBCODE')) {
                 $spGlobals['editor'] = BBCODE;
             }
             if (defined('HTML')) {
                 $spGlobals['editor'] = HTML;
             }
             if (defined('RICHTEXT')) {
                 $spGlobals['editor'] = RICHTEXT;
             }
         }
         # Grab any notices present
         if ($this->guest && !empty($this->guest_email)) {
             $this->user_notices = spdb_table(SFNOTICES, "guest_email='" . $this->guest_email . "'", '', $order = 'notice_id');
         } elseif ($this->member && !empty($this->user_email)) {
             $this->user_notices = spdb_table(SFNOTICES, "user_id=" . $this->ID, '', $order = 'notice_id');
         }
         # plugins can add iterms for the current user (so no small allowed here)
         do_action_ref_array('sph_current_user_class', array(&$this));
     }
     # Finally filter the data for display
     foreach ($includeList as $item => $filter) {
         if (property_exists($this, $item)) {
             $this->{$item} = spUser_filter_item($this->{$item}, $filter);
         }
     }
     # allow plugins to add items to user class - regardless small or otherwise, current or otherwise
     do_action_ref_array('sph_user_class', array(&$this));
 }
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:101,代码来源:sp-api-class-user.php

示例15: sp_delete_post

function sp_delete_post($postid, $topicid, $forumid, $show = true, $poster = 0)
{
    global $spThisUser;
    if (!$postid || !$topicid || !$forumid) {
        return '';
    }
    if (sp_get_auth('delete_any_post', $forumid) || sp_get_auth('delete_own_posts', $forumid) && $spThisUser->ID == $poster) {
        # Check post actually exsists - might be a browsser refresh!
        $target = spdb_table(SFPOSTS, "post_id={$postid}", 'row');
        if (empty($target)) {
            if ($show) {
                sp_notify(SPSUCCESS, sp_text('Post already deleted'));
            }
            return;
        }
        # if just one post then remove topic as well
        $pcount = spdb_table(SFTOPICS, "topic_id={$topicid}", 'post_count');
        if ($pcount == 1) {
            sp_delete_topic($topicid, $forumid, $show);
        } else {
            if (spdb_query('DELETE FROM ' . SFPOSTS . " WHERE post_id={$postid}") == false) {
                if ($show) {
                    sp_notify(SPFAILURE, sp_text('Deletion failed'));
                }
            } else {
                if ($show) {
                    sp_notify(SPSUCCESS, sp_text('Post deleted'));
                }
            }
            # adjust post count if needed
            $adjust = sp_get_option('post_count_delete');
            if ($adjust) {
                $count = sp_get_member_item($target->user_id, 'posts') - 1;
                sp_update_member_item($target->user_id, 'posts', $count);
            }
            # re number post index
            sp_build_post_index($topicid);
            sp_build_forum_index($forumid);
            # post delete hook
            do_action('sph_post_delete', $target, $spThisUser->ID);
            # flush and rebuild topic cache (since one or more posts approved)
            sp_rebuild_topic_cache();
        }
        # need to look in sfwaiting to see if it's in there...
        sp_remove_from_waiting(true, $topicid, $postid);
        sp_delete_notice('post_id', $postid);
    } else {
        if (!is_user_logged_in()) {
            $msg = sp_text('Access denied - are you logged in?');
        } else {
            $msg = sp_text('Access denied - you do not have permission');
        }
        sp_notify(SPFAILURE, $msg);
    }
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:55,代码来源:sp-db-management.php


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