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


PHP update_user_status函数代码示例

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


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

示例1: test_wp_authenticate_spam_check_returns_wp_error_when_flagged

 function test_wp_authenticate_spam_check_returns_wp_error_when_flagged()
 {
     if (!is_multisite()) {
         $this->markTestSkipped('This test applies to multisite only.');
     }
     $user_id = self::factory()->user->create(array('role' => 'contributor'));
     update_user_status($user_id, 'spam', 1);
     $user = new WP_User($user_id);
     $actual_user = wp_authenticate_spam_check($user);
     wpmu_delete_user($user_id);
     $this->assertInstanceOf('WP_Error', $actual_user);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:12,代码来源:wpAuthenticateSpamCheck.php

示例2: logout

function logout()
{
    $userid = isset($_SESSION['userid']) ? $_SESSION['userid'] : 0;
    $ip = client_ip();
    update_user_status($_SESSION['userid'], 0, $ip, $_SERVER['HTTP_USER_AGENT']);
    update_confid($userid, md5(mt_rand()));
    $dir = $_SERVER['DOCUMENT_ROOT'] . "/Contacts/views/user/temp/" . md5($userid);
    if (file_exists($dir)) {
        removeDir($dir);
    }
    unset($_SESSION['userid']);
    unset($_SESSION['timeout']);
    unset($_SESSION['username']);
    unset($_SESSION['isLoggedIn']);
    unset($_SESSION['becomeLogin']);
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:16,代码来源:activity.php

示例3: bp_core_process_spammer_status

/**
 * Processes a spammed or unspammed user
 *
 * This function is called in three ways:
 *  - in bp_settings_action_capabilities() (from the front-end)
 *  - by bp_core_mark_user_spam_admin()    (from wp-admin)
 *  - bp_core_mark_user_ham_admin()        (from wp-admin)
 *
 * @since BuddyPress (1.6)
 *
 * @param int $user_id The user being spammed/hammed
 * @param string $status 'spam' if being marked as spam, 'ham' otherwise
 */
function bp_core_process_spammer_status($user_id, $status)
{
    global $wpdb;
    // Only super admins can currently spam users
    if (!is_super_admin() || bp_is_my_profile()) {
        return;
    }
    // Bail if no user ID
    if (empty($user_id)) {
        return;
    }
    // Bail if user ID is super admin
    if (is_super_admin($user_id)) {
        return;
    }
    // Get the functions file
    if (is_multisite()) {
        require_once ABSPATH . 'wp-admin/includes/ms.php';
    }
    $is_spam = 'spam' == $status;
    // Only you can prevent infinite loops
    remove_action('make_spam_user', 'bp_core_mark_user_spam_admin');
    remove_action('make_ham_user', 'bp_core_mark_user_ham_admin');
    // When marking as spam in the Dashboard, these actions are handled by WordPress
    if (!is_admin()) {
        // Get the blogs for the user
        $blogs = get_blogs_of_user($user_id, true);
        foreach ((array) $blogs as $key => $details) {
            // Do not mark the main or current root blog as spam
            if (1 == $details->userblog_id || bp_get_root_blog_id() == $details->userblog_id) {
                continue;
            }
            // Update the blog status
            update_blog_status($details->userblog_id, 'spam', $is_spam);
        }
        // Finally, mark this user as a spammer
        if (is_multisite()) {
            update_user_status($user_id, 'spam', $is_spam);
        }
        // Always set single site status
        $wpdb->update($wpdb->users, array('user_status' => $is_spam), array('ID' => $user_id));
        // Call multisite actions in single site mode for good measure
        if (!is_multisite()) {
            $wp_action = true === $is_spam ? 'make_spam_user' : 'make_ham_user';
            do_action($wp_action, bp_displayed_user_id());
        }
    }
    // Hide this user's activity
    if (true === $is_spam && bp_is_active('activity')) {
        bp_activity_hide_user_activity($user_id);
    }
    // We need a special hook for is_spam so that components can delete data at spam time
    $bp_action = true === $is_spam ? 'bp_make_spam_user' : 'bp_make_ham_user';
    do_action($bp_action, $user_id);
    // Allow plugins to do neat things
    do_action('bp_core_process_spammer_status', $user_id, $is_spam);
    return true;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:71,代码来源:bp-members-functions.php

示例4: foreach

                     foreach ((array) $blogs as $key => $details) {
                         if ($details->userblog_id == 1) {
                             continue;
                         }
                         // main blog not a spam !
                         update_blog_status($details->userblog_id, "spam", '1');
                         do_action("make_spam_blog", $details->userblog_id);
                     }
                     update_user_status($val, "spam", '1', 1);
                 } elseif (isset($_POST['alluser_notspam'])) {
                     $userfunction = 'all_notspam';
                     $blogs = get_blogs_of_user($val, true);
                     foreach ((array) $blogs as $key => $details) {
                         update_blog_status($details->userblog_id, "spam", '0');
                     }
                     update_user_status($val, "spam", '0', 1);
                 }
             }
         }
         wp_redirect(add_query_arg(array('updated' => 'true', 'action' => $userfunction), $_SERVER['HTTP_REFERER']));
     }
     exit;
     break;
 case "adduser":
     check_admin_referer('add-user');
     $user = $_POST['user'];
     if (empty($user['username']) && empty($user['email'])) {
         wp_die(__('Missing username and email.'));
     } elseif (empty($user['username'])) {
         wp_die(__('Missing username.'));
     } elseif (empty($user['email'])) {
开发者ID:jinpingv,项目名称:website_wrapper,代码行数:31,代码来源:wpmu-edit.php

示例5: set_spammer_status

 /**
  * set spammeer status
  *
  * @param <int|array> $user_ids member ids
  * @param <bool> $is_spam mark spammer (true) or unmark (false)
  * @param <callback> $end_callback function to execute after marking/unmarking, after this bpcore will redirect back & die
  */
 function set_spammer_status($user_ids, $is_spam, $end_callback)
 {
     global $wpdb;
     $user_ids = (array) $user_ids;
     $successes = array();
     foreach ($user_ids as $user_id) {
         // Bail if user ID is super admin
         if (is_super_admin($user_id)) {
             continue;
         }
         // Get the blogs for the user
         $blogs = get_blogs_of_user($user_id, true);
         foreach ((array) $blogs as $key => $details) {
             // Do not mark the main or current root blog as spam
             if (1 == $details->userblog_id || bp_get_root_blog_id() == $details->userblog_id) {
                 continue;
             }
             // Update the blog status
             update_blog_status($details->userblog_id, 'spam', $is_spam);
         }
         // Finally, mark this user as a spammer
         if (is_multisite()) {
             update_user_status($user_id, 'spam', $is_spam);
         }
         // Always set single site status
         $wpdb->update($wpdb->users, array('user_status' => (int) $is_spam), array('ID' => $user_id));
         // Hide this user's activity
         if ($is_spam && bp_is_active('activity')) {
             bp_activity_hide_user_activity($user_id);
         }
         // We need a special hook for is_spam so that components can delete data at spam time
         $bp_action = $is_spam ? 'bp_make_spam_user' : 'bp_make_ham_user';
         do_action($bp_action, $user_id);
         // Call multisite actions in single site mode for good measure
         if (!is_multisite()) {
             $wp_action = $is_spam ? 'make_spam_user' : 'make_ham_user';
             do_action($wp_action, $user_id);
         }
         // Allow plugins to do neat things
         do_action('bp_core_action_set_spammer_status', $user_id, $is_spam);
         $successes[] = $user_id;
     }
     $errors = array_diff($user_ids, $successes);
     call_user_func($end_callback, $successes, $errors, $is_spam);
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:52,代码来源:bpModBackendActions.php

示例6: file_get_contents

//Post to facebook token URL
$access_token = file_get_contents($fb_token_URL . "&code={$code}");
//Get AccessToken from facebook
$res_auth = file_get_contents($fb_info_URL . "&" . $access_token);
//Get the user infomation using AccessToken, and parse the result
$user = json_decode($res_auth);
// facebook の user_id + name(表示名)をセット
if (isset($user->id)) {
    $fb_user_id = $user->id;
    $fb_user_name = $user->name;
    $fb_user_email = $user->email;
}
$http_ref = $_SERVER['HTTP_REFERER'];
if ($http_ref = $fb_auth_ref && isset($fb_user_id)) {
    //Update User Status
    update_user_status($fb_user_id, "facebook", $fb_user_name, $fb_user_email);
    $_SESSION["auth_name"] = $ggl_user_name;
    $_SESSION["auth_type"] = "facebook";
    $_SESSION["auth_icon"] = "./img/fb_icon.png";
    header("Location: {$top_page}");
} else {
    $showMsg = "Notice: Invalid authentication<br>";
}
echo <<<EOF
<html>
\t<head>
\t\t<title>
\t\t\tfb test login
\t\t</title>
\t</head>
\t<body>
开发者ID:lequix,项目名称:kowork,代码行数:31,代码来源:fb_callback.php

示例7: file_get_contents

$res_auth = file_get_contents($ggl_token_URL, false, stream_context_create($options), -1, 40000);
// Decode the result from google token URL
$token = json_decode($res_auth, true);
if (isset($token['error'])) {
    echo 'An error occurs on Google OAuth2\\n';
    exit;
}
$access_token = $token['access_token'];
//--------------------------------------
// Get User information
//--------------------------------------
$params = array('access_token' => $access_token);
$user_json = file_get_contents($ggl_info_URL . '?' . http_build_query($params));
$user = json_decode($user_json);
$ggl_user_id = $user->id;
$ggl_user_name = $user->name;
$ggl_user_email = $user->email;
//--------------------------------------
// Register user on DB
//--------------------------------------
if (isset($ggl_user_id)) {
    //Update User Status
    update_user_status($ggl_user_id, "google", $ggl_user_name, $ggl_user_email);
    $_SESSION["auth_name"] = $ggl_user_name;
    $_SESSION["auth_type"] = "google";
    $_SESSION["auth_icon"] = "./img/ggl_icon.png";
    header("Location: {$top_page}");
    exit;
} else {
    $showMsg = "Notice: Invalid authentication.<br>";
}
开发者ID:lequix,项目名称:kowork,代码行数:31,代码来源:ggl_callback.php

示例8: header

            include_once $_SERVER['DOCUMENT_ROOT'] . '/Contacts/models/user/logout.php';
            break;
        case "settings":
            /*Account Management code*/
            if (!$isLoggedIn) {
                header("Location: index.php");
                $_SESSION['error'] = ($debug ? "<b>pages.php:</b><br />" : "") . "The page you are looking was not found!";
                die;
            }
            break;
        default:
            $_SESSION['error'] = ($debug ? "<b>pages.php:</b><br />" : "") . "The page you are looking was not found!";
            header("Location: index.php");
            die;
    }
} else {
    if (!$isLoggedIn) {
        include_once $_SERVER['DOCUMENT_ROOT'] . '/Contacts/views/welcome.php';
    }
}
if ($isLoggedIn) {
    /*Here is content who view logged in users!*/
    /*Update the database relating to the user about the current status 
    		for synchronization at Session variables and db Fields*/
    update_user_status($userid, $isLoggedIn, $ip, $_SERVER['HTTP_USER_AGENT']);
    if ($page == "settings") {
        include_once $_SERVER['DOCUMENT_ROOT'] . '/Contacts/views/content/settings.php';
    } else {
        include_once $_SERVER['DOCUMENT_ROOT'] . '/Contacts/views/content/tabs.php';
    }
}
开发者ID:kwstarikanos,项目名称:Contacts,代码行数:31,代码来源:pages.php

示例9: bp_core_process_spammer_status

/**
 * Process a spammed or unspammed user.
 *
 * This function is called from three places:
 *
 * - in bp_settings_action_capabilities() (from the front-end)
 * - by bp_core_mark_user_spam_admin()    (from wp-admin)
 * - bp_core_mark_user_ham_admin()        (from wp-admin)
 *
 * @since 1.6.0
 *
 * @param int    $user_id       The ID of the user being spammed/hammed.
 * @param string $status        'spam' if being marked as spam, 'ham' otherwise.
 * @param bool   $do_wp_cleanup True to force the cleanup of WordPress content
 *                              and status, otherwise false. Generally, this should
 *                              only be false if WordPress is expected to have
 *                              performed this cleanup independently, as when hooked
 *                              to 'make_spam_user'.
 * @return bool True on success, false on failure.
 */
function bp_core_process_spammer_status($user_id, $status, $do_wp_cleanup = true)
{
    global $wpdb;
    // Bail if no user ID.
    if (empty($user_id)) {
        return;
    }
    // Bail if user ID is super admin.
    if (is_super_admin($user_id)) {
        return;
    }
    // Get the functions file.
    if (is_multisite()) {
        require_once ABSPATH . 'wp-admin/includes/ms.php';
    }
    $is_spam = 'spam' == $status;
    // Only you can prevent infinite loops.
    remove_action('make_spam_user', 'bp_core_mark_user_spam_admin');
    remove_action('make_ham_user', 'bp_core_mark_user_ham_admin');
    // Force the cleanup of WordPress content and status for multisite configs.
    if ($do_wp_cleanup) {
        // Get the blogs for the user.
        $blogs = get_blogs_of_user($user_id, true);
        foreach ((array) array_values($blogs) as $details) {
            // Do not mark the main or current root blog as spam.
            if (1 == $details->userblog_id || bp_get_root_blog_id() == $details->userblog_id) {
                continue;
            }
            // Update the blog status.
            update_blog_status($details->userblog_id, 'spam', $is_spam);
        }
        // Finally, mark this user as a spammer.
        if (is_multisite()) {
            update_user_status($user_id, 'spam', $is_spam);
        }
    }
    // Update the user status.
    $wpdb->update($wpdb->users, array('user_status' => $is_spam), array('ID' => $user_id));
    // Clean user cache.
    clean_user_cache($user_id);
    if (!is_multisite()) {
        // Call multisite actions in single site mode for good measure.
        if (true === $is_spam) {
            /**
             * Fires at end of processing spammer in Dashboard if not multisite and user is spam.
             *
             * @since 1.5.0
             *
             * @param int $value user ID.
             */
            do_action('make_spam_user', $user_id);
        } else {
            /**
             * Fires at end of processing spammer in Dashboard if not multisite and user is not spam.
             *
             * @since 1.5.0
             *
             * @param int $value user ID.
             */
            do_action('make_ham_user', $user_id);
        }
    }
    // Hide this user's activity.
    if (true === $is_spam && bp_is_active('activity')) {
        bp_activity_hide_user_activity($user_id);
    }
    // We need a special hook for is_spam so that components can delete data at spam time.
    if (true === $is_spam) {
        /**
         * Fires at the end of the process spammer process if the user is spam.
         *
         * @since 1.5.0
         *
         * @param int $value Displayed user ID.
         */
        do_action('bp_make_spam_user', $user_id);
    } else {
        /**
         * Fires at the end of the process spammer process if the user is not spam.
         *
//.........这里部分代码省略.........
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:101,代码来源:bp-members-functions.php

示例10: bp_core_action_set_spammer_status

/**
 * When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu
 * this action will fire and mark or unmark the user and their blogs as spam.
 * Must be a site admin for this function to run.
 *
 * @package BuddyPress Core
 * @param int $user_id Optional user ID to mark as spam
 * @global object $wpdb Global WordPress Database object
 */
function bp_core_action_set_spammer_status($user_id = 0)
{
    global $wpdb;
    // Only super admins can currently spam users
    if (!is_super_admin() || bp_is_my_profile()) {
        return;
    }
    // Use displayed user if it's not yourself
    if (empty($user_id) && bp_is_user()) {
        $user_id = bp_displayed_user_id();
    }
    // Bail if no user ID
    if (empty($user_id)) {
        return;
    }
    // Bail if user ID is super admin
    if (is_super_admin($user_id)) {
        return;
    }
    if (bp_is_current_component('admin') && in_array(bp_current_action(), array('mark-spammer', 'unmark-spammer'))) {
        // Check the nonce
        check_admin_referer('mark-unmark-spammer');
        // Get the functions file
        if (is_multisite()) {
            require ABSPATH . 'wp-admin/includes/ms.php';
        }
        // To spam or not to spam
        $is_spam = bp_is_current_action('mark-spammer') ? 1 : 0;
        // Get the blogs for the user
        $blogs = get_blogs_of_user($user_id, true);
        foreach ((array) $blogs as $key => $details) {
            // Do not mark the main or current root blog as spam
            if (1 == $details->userblog_id || bp_get_root_blog_id() == $details->userblog_id) {
                continue;
            }
            // Update the blog status
            update_blog_status($details->userblog_id, 'spam', $is_spam);
        }
        // Finally, mark this user as a spammer
        if (is_multisite()) {
            update_user_status($user_id, 'spam', $is_spam);
        }
        // Always set single site status
        $wpdb->update($wpdb->users, array('user_status' => $is_spam), array('ID' => $user_id));
        // Add feedback message
        if ($is_spam) {
            bp_core_add_message(__('User marked as spammer. Spam users are visible only to site admins.', 'buddypress'));
        } else {
            bp_core_add_message(__('User removed as spammer.', 'buddypress'));
        }
        // Hide this user's activity
        if ($is_spam && bp_is_active('activity')) {
            bp_activity_hide_user_activity($user_id);
        }
        // We need a special hook for is_spam so that components can delete data at spam time
        $bp_action = $is_spam ? 'bp_make_spam_user' : 'bp_make_ham_user';
        do_action($bp_action, bp_displayed_user_id());
        // Call multisite actions in single site mode for good measure
        if (!is_multisite()) {
            $wp_action = $is_spam ? 'make_spam_user' : 'make_ham_user';
            do_action($wp_action, bp_displayed_user_id());
        }
        // Allow plugins to do neat things
        do_action('bp_core_action_set_spammer_status', bp_displayed_user_id(), $is_spam);
        // Redirect back to where we came from
        bp_core_redirect(wp_get_referer());
    }
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:77,代码来源:bp-members-actions.php

示例11: setnocache

require_once "${_CLASS_PATH}clsConnection.php";
require_once "${_CLASS_PATH}clsDB.php";
require_once "${_UMS_PATH}clsUser.php";

setnocache();

session_start();
if (logged_in()) {
    $oU = &$_SESSION["oU"];
    $oU->Lang = (isset($_GET["lang"]) && $_GET["lang"] == "") ? "th" : $_GET["lang"];
    if (isset($_GET["StID"]) && $_GET["StID"] != "") $oU->StID = $_GET["StID"];
    if (isset($_GET["GpID"]) && $_GET["GpID"] != "") $oU->GpID = $_GET["GpID"];
    if (isset($_GET["MnID"]) && $_GET["MnID"] != "") $oU->MnID = $_GET["MnID"];
    if (isset($_GET["MmnID"]) && $_GET["MmnID"] != "") $oU->MmnID = $_GET["MmnID"];
    update_user_status();
    $oU->GetRightsByMenu();
	
    include_once "${_UMS_PATH}clsUmMenu.php";
    include_once "${_UMS_PATH}clsUmPermission.php";
    include_once "${_UMS_PATH}clsUmGPermission.php";
    include_once "${_UMS_PATH}clsUmUserGroup.php";
    include_once "${_UMS_PATH}clsUmGroup.php";
    if (isset($_GET["mm"]))
        ob_start("incsubmenuTpl");
    else
        ob_start("nonsubmenuTpl");
} else {
    $full_url = $GLOBALS["_PROTOCOL"] . $GLOBALS["_INFO_INDEX"];
    header("Location: $full_url");
}
开发者ID:hds-team,项目名称:HDS,代码行数:30,代码来源:template.php

示例12: wangguard_users

function wangguard_users()
{
    global $wpdb, $wangguard_is_network_admin, $wangguard_nonce, $wangguard_g_splog_users_count;
    if (!current_user_can('level_10')) {
        die(__('Cheatin&#8217; uh?', 'wangguard'));
    }
    include 'wangguard-class-wp-users.php';
    $wp_list_table = new WangGuard_Users_Table();
    $pagenum = $wp_list_table->get_pagenum();
    $messages = array();
    switch ($wp_list_table->current_action()) {
        case 'delete':
            if (!wp_verify_nonce($_REQUEST['_wpnonce'], "bulk-users")) {
                die("bad nonce");
            }
            //report selected users
            $reportedUsers = 0;
            $users = (array) @$_REQUEST['users'];
            if (wangguard_is_multisite() && function_exists("wpmu_delete_user")) {
                $delFunc = 'wpmu_delete_user';
            } else {
                if (!function_exists('wp_delete_user')) {
                    @(include_once ABSPATH . 'wp-admin/includes/user.php');
                }
                $delFunc = 'wp_delete_user';
            }
            $deletedUsers = 0;
            foreach ($users as $spuserID) {
                $user_object = new WP_User($spuserID);
                if (!wangguard_is_admin($user_object)) {
                    $delFunc($spuserID);
                    $deletedUsers++;
                }
            }
            if ($deletedUsers) {
                $messages[] = '<div id="message" class="updated fade"><p><strong>' . sprintf(__("%d user(s) were deleted", "wangguard"), $deletedUsers) . '</strong></p></div>';
            }
            break;
        case 'reportassplog':
            if (!wp_verify_nonce($_REQUEST['_wpnonce'], "bulk-users")) {
                die("bad nonce");
            }
            //report selected users
            $reportedUsers = 0;
            $users = (array) $_REQUEST['users'];
            $res = wangguard_report_users($users);
            $resArr = explode(",", $res);
            $reportedUsers = count($users) == 0 ? 0 : count($resArr);
            if ($reportedUsers) {
                if (wangguard_get_option("wangguard-delete-users-on-report") == '1') {
                    $messages[] = '<div id="message" class="updated fade"><p><strong>' . sprintf(__("%d user(s) were reported as Splogger(s) and deleted", "wangguard"), $reportedUsers) . '</strong></p></div>';
                } else {
                    $messages[] = '<div id="message" class="updated fade"><p><strong>' . sprintf(__("%d user(s) were reported as Splogger(s)", "wangguard"), $reportedUsers) . '</strong></p></div>';
                }
            }
            break;
        case 'spam':
            $spamUsers = 0;
            $users = (array) $_REQUEST['users'];
            foreach ($users as $spuserID) {
                $user = new WP_User($spuserID);
                if (in_array($user->user_login, get_super_admins())) {
                    continue;
                }
                if (function_exists('get_blogs_of_user') && function_exists('update_blog_status')) {
                    $blogs = get_blogs_of_user($spuserID, true);
                    foreach ((array) $blogs as $key => $details) {
                        //						if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
                        //							update_blog_status( $details->userblog_id, 'spam', '1' );
                        $isMainBlog = false;
                        if (isset($current_site)) {
                            $isMainBlog = $details->userblog_id != $current_site->blog_id;
                            // main blog not a spam !
                        } elseif (defined("BP_ROOT_BLOG")) {
                            $isMainBlog = 1 == $details->userblog_id || BP_ROOT_BLOG == $details->userblog_id;
                        } else {
                            $isMainBlog = $details->userblog_id == 1;
                        }
                        $userIsAuthor = false;
                        if (!$isMainBlog) {
                            //Only works on WP 3+
                            $blog_prefix = $wpdb->get_blog_prefix($details->userblog_id);
                            $authorcaps = $wpdb->get_var(sprintf("SELECT meta_value as caps FROM {$wpdb->users} u, {$wpdb->usermeta} um WHERE u.ID = %d and u.ID = um.user_id AND meta_key = '{$blog_prefix}capabilities'", $spuserID));
                            $caps = maybe_unserialize($authorcaps);
                            $userIsAuthor = isset($caps['administrator']);
                        }
                        //Update blog to spam if the user is the author and its not the main blog
                        if (!$isMainBlog && $userIsAuthor) {
                            @update_blog_status($details->userblog_id, 'spam', '1');
                            //remove blog from queue
                            $table_name = $wpdb->base_prefix . "wangguardreportqueue";
                            $wpdb->query($wpdb->prepare("delete from {$table_name} where blog_id = '%d'", $details->userblog_id));
                        }
                    }
                }
                if (function_exists('update_user_status')) {
                    update_user_status($spuserID, 'spam', '1');
                }
                $wpdb->update($wpdb->users, array('user_status' => 1), array('ID' => $spuserID));
                $spamUsers++;
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:wangguard-users.php

示例13: ust_do_ajax

function ust_do_ajax()
{
    global $wpdb, $current_site;
    //make sure we have permission!
    if (!current_user_can('manage_sites')) {
        die;
    }
    if (isset($_POST['url'])) {
        $query = parse_url($_POST['url']);
        parse_str($query['query'], $_GET);
    }
    //process any actions and messages
    if (isset($_GET['spam_user'])) {
        //spam a user and all blogs they are associated with
        //don't spam site admin
        $user_info = get_userdata((int) $_GET['spam_user']);
        if (!is_super_admin($user_info->user_login)) {
            $blogs = get_blogs_of_user((int) $_GET['spam_user'], true);
            foreach ((array) $blogs as $key => $details) {
                if ($details->userblog_id == $current_site->blog_id) {
                    continue;
                }
                // main blog not a spam !
                update_blog_status($details->userblog_id, "spam", '1');
                set_time_limit(60);
            }
            update_user_status((int) $_GET['spam_user'], "spam", '1');
        }
    } else {
        if (isset($_POST['check_ip'])) {
            //count all blogs created or modified with the IP address
            $ip_query = parse_url($_POST['check_ip']);
            parse_str($ip_query['query'], $ip_data);
            $spam_ip = addslashes($ip_data['spam_ip']);
            $query = "SELECT COUNT(b.blog_id)\r\n        \t\t\t\tFROM {$wpdb->blogs} b, {$wpdb->registration_log} r, {$wpdb->base_prefix}ust u\r\n        \t\t\t\tWHERE b.site_id = '{$wpdb->siteid}'\r\n        \t\t\t\tAND b.blog_id = r.blog_id\r\n        \t\t\t\tAND b.blog_id = u.blog_id\r\n        \t\t\t\tAND b.spam = 0\r\n        \t\t\t\tAND (r.IP = '{$spam_ip}' OR u.last_ip = '{$spam_ip}')";
            $query2 = "SELECT COUNT(b.blog_id)\r\n        \t\t\t\tFROM {$wpdb->blogs} b, {$wpdb->registration_log} r, {$wpdb->base_prefix}ust u\r\n        \t\t\t\tWHERE b.site_id = '{$wpdb->siteid}'\r\n        \t\t\t\tAND b.blog_id = r.blog_id\r\n        \t\t\t\tAND b.blog_id = u.blog_id\r\n        \t\t\t\tAND b.spam = 1\r\n        \t\t\t\tAND (r.IP = '{$spam_ip}' OR u.last_ip = '{$spam_ip}')";
            //return json response
            echo '{"num":"' . $wpdb->get_var($query) . '", "numspam":"' . $wpdb->get_var($query2) . '", "bid":"' . $ip_data['id'] . '", "ip":"' . $ip_data['spam_ip'] . '"}';
        } else {
            if (isset($_GET['spam_ip'])) {
                //spam all blogs created or modified with the IP address
                $spam_ip = addslashes($_GET['spam_ip']);
                $query = "SELECT b.blog_id\r\n        \t\t\t\tFROM {$wpdb->blogs} b, {$wpdb->registration_log} r, {$wpdb->base_prefix}ust u\r\n        \t\t\t\tWHERE b.site_id = '{$wpdb->siteid}'\r\n        \t\t\t\tAND b.blog_id = r.blog_id\r\n        \t\t\t\tAND b.blog_id = u.blog_id\r\n        \t\t\t\tAND b.spam = 0\r\n        \t\t\t\tAND (r.IP = '{$spam_ip}' OR u.last_ip = '{$spam_ip}')";
                $blogs = $wpdb->get_results($query, ARRAY_A);
                foreach ((array) $blogs as $blog) {
                    if ($blog['blog_id'] == $current_site->blog_id) {
                        continue;
                    }
                    // main blog not a spam !
                    update_blog_status($blog['blog_id'], "spam", '1');
                    set_time_limit(60);
                }
            } else {
                if (isset($_GET['ignore_blog'])) {
                    //ignore a single blog so it doesn't show up on the possible spam list
                    ust_blog_ignore((int) $_GET['id']);
                    echo $_GET['id'];
                } else {
                    if (isset($_GET['unignore_blog'])) {
                        //unignore a single blog so it can show up on the possible spam list
                        ust_blog_unignore((int) $_GET['id']);
                        echo $_GET['id'];
                    } else {
                        if (isset($_GET['spam_blog'])) {
                            //spam a single blog
                            update_blog_status((int) $_GET['id'], "spam", '1');
                            echo $_GET['id'];
                        } else {
                            if (isset($_GET['unspam_blog'])) {
                                update_blog_status((int) $_GET['id'], "spam", '0');
                                ust_blog_ignore((int) $_GET['id'], false);
                                echo $_GET['id'];
                            } else {
                                if (isset($_POST['allblogs'])) {
                                    parse_str($_POST['allblogs'], $blog_list);
                                    foreach ((array) $blog_list['allblogs'] as $key => $val) {
                                        if ($val != '0' && $val != $current_site->blog_id) {
                                            if (isset($_POST['allblog_ignore'])) {
                                                ust_blog_ignore($val);
                                                set_time_limit(60);
                                            } else {
                                                if (isset($_POST['allblog_unignore'])) {
                                                    ust_blog_unignore($val);
                                                    set_time_limit(60);
                                                } else {
                                                    if (isset($_POST['allblog_spam'])) {
                                                        update_blog_status($val, "spam", '1');
                                                        set_time_limit(60);
                                                    } else {
                                                        if (isset($_POST['allblog_notspam'])) {
                                                            update_blog_status($val, "spam", '0');
                                                            ust_blog_ignore($val, false);
                                                            set_time_limit(60);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    _e("Selected blogs processed", 'ust');
//.........这里部分代码省略.........
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:anti-splog.php

示例14: get_userdata

//process any actions and messages
if (isset($_GET['spam_user'])) {
    //spam a user and all blogs they are associated with
    //don't spam site admin
    $user_info = get_userdata((int) $_GET['spam_user']);
    if (!is_super_admin($user_info->user_login)) {
        $blogs = get_blogs_of_user((int) $_GET['spam_user'], true);
        foreach ((array) $blogs as $key => $details) {
            if ($details->userblog_id == $current_site->blog_id) {
                continue;
            }
            // main blog not a spam !
            update_blog_status($details->userblog_id, "spam", '1');
            set_time_limit(60);
        }
        update_user_status((int) $_GET['spam_user'], "spam", '1');
        $_GET['updatedmsg'] = sprintf(__('%s blog(s) spammed for user!', 'ust'), count($blogs));
    }
} else {
    if (isset($_GET['spam_ip'])) {
        //spam all blogs created or modified with the IP address
        $spam_ip = addslashes($_GET['spam_ip']);
        $query = "SELECT b.blog_id\n\t\t\t\t\t\t\tFROM {$wpdb->blogs} b, {$wpdb->registration_log} r, {$wpdb->base_prefix}ust u\n\t\t\t\t\t\t\tWHERE b.site_id = '{$wpdb->siteid}'\n\t\t\t\t\t\t\tAND b.blog_id = r.blog_id\n\t\t\t\t\t\t\tAND b.blog_id = u.blog_id\n\t\t\t\t\t\t\tAND b.spam = 0\n\t\t\t\t\t\t\tAND (r.IP = '{$spam_ip}' OR u.last_ip = '{$spam_ip}')";
        $blogs = $wpdb->get_results($query, ARRAY_A);
        foreach ((array) $blogs as $blog) {
            if ($blog['blog_id'] == $current_site->blog_id) {
                continue;
            }
            // main blog not a spam !
            update_blog_status($blog['blog_id'], "spam", '1');
            set_time_limit(60);
开发者ID:adisonc,项目名称:MaineLearning,代码行数:31,代码来源:moderate.php

示例15: get_blogs_of_user

                     $blogs = get_blogs_of_user($user_id, true);
                     foreach ((array) $blogs as $details) {
                         if ($details->userblog_id != get_network()->site_id) {
                             // main blog not a spam !
                             update_blog_status($details->userblog_id, 'spam', '1');
                         }
                     }
                     update_user_status($user_id, 'spam', '1');
                     break;
                 case 'notspam':
                     $userfunction = 'all_notspam';
                     $blogs = get_blogs_of_user($user_id, true);
                     foreach ((array) $blogs as $details) {
                         update_blog_status($details->userblog_id, 'spam', '0');
                     }
                     update_user_status($user_id, 'spam', '0');
                     break;
             }
         }
     }
     if (!in_array($doaction, array('delete', 'spam', 'notspam'), true)) {
         $sendback = wp_get_referer();
         $user_ids = (array) $_POST['allusers'];
         /** This action is documented in wp-admin/network/site-themes.php */
         $sendback = apply_filters('handle_network_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $user_ids);
         wp_safe_redirect($sendback);
         exit;
     }
     wp_safe_redirect(add_query_arg(array('updated' => 'true', 'action' => $userfunction), wp_get_referer()));
 } else {
     $location = network_admin_url('users.php');
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:31,代码来源:users.php


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