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


PHP wpmu_delete_user函数代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct(site_url('pnfw/unregister/'), 'POST');
     global $wpdb;
     $push_tokens = $wpdb->get_blog_prefix() . 'push_tokens';
     $user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM {$push_tokens} WHERE token = %s AND os = %s", $this->token, $this->os));
     $res = $wpdb->delete($push_tokens, array("token" => $this->token, "os" => $this->os));
     if ($res === false) {
         $this->json_error('500', __('Unable to delete token', 'pnfw'));
     }
     $user = new WP_User($user_id);
     if (in_array(PNFW_Push_Notifications_for_WordPress_Lite::USER_ROLE, $user->roles) && empty($user->user_email)) {
         pnfw_log(PNFW_SYSTEM_LOG, sprintf(__("Automatically deleted the anonymous user %s (%s) since left without tokens.", 'pnfw'), $user->user_login, $user_id));
         require_once ABSPATH . 'wp-admin/includes/user.php';
         if (is_multisite()) {
             require_once ABSPATH . 'wp-admin/includes/ms.php';
             if (is_user_member_of_blog($user_id)) {
                 wpmu_delete_user($user_id);
             }
         } else {
             wp_delete_user($user_id);
         }
     }
     exit;
 }
开发者ID:benediktharter,项目名称:push-notifications-for-wp,代码行数:25,代码来源:class-pnfw-api-unregister.php

示例2: tearDown

 public function tearDown()
 {
     global $wpdb;
     remove_action('bp_blogs_recorded_existing_blogs', array($this, 'set_autocommit_flag'));
     parent::tearDown();
     // If we detect that a COMMIT has been triggered during the test, clean up blog and user fixtures.
     if ($this->autocommitted) {
         if (is_multisite()) {
             foreach ($wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs} WHERE blog_id != 1") as $blog_id) {
                 wpmu_delete_blog($blog_id, true);
             }
         }
         foreach ($wpdb->get_col("SELECT ID FROM {$wpdb->users} WHERE ID != 1") as $user_id) {
             if (is_multisite()) {
                 wpmu_delete_user($user_id);
             } else {
                 wp_delete_user($user_id);
             }
         }
     }
     $this->commit_transaction();
     // Reactivate any components that have been deactivated.
     foreach ($this->deactivated_components as $component) {
         buddypress()->active_components[$component] = 1;
     }
     $this->deactivated_components = array();
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:27,代码来源:testcase.php

示例3: wpTearDownAfterClass

 public static function wpTearDownAfterClass()
 {
     if (is_multisite()) {
         wpmu_delete_user(self::$user_id);
     } else {
         wp_delete_user(self::$user_id);
     }
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Develop,代码行数:8,代码来源:getDashboardUrl.php

示例4: delete_user

 /**
  * Multisite-agnostic way to delete a user from the database.
  *
  * @since 4.3.0
  */
 public static function delete_user($user_id)
 {
     if (is_multisite()) {
         return wpmu_delete_user($user_id);
     } else {
         return wp_delete_user($user_id);
     }
 }
开发者ID:LeRondPoint,项目名称:wp-browser,代码行数:13,代码来源:WPTestCase.php

示例5: pnfw_delete_plugin

function pnfw_delete_plugin()
{
    global $wpdb;
    $table_name = $wpdb->get_blog_prefix() . 'push_tokens';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_viewed';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_sent';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_excluded_categories';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'push_logs';
    $wpdb->query("DROP TABLE IF EXISTS {$table_name};");
    $table_name = $wpdb->get_blog_prefix() . 'postmeta';
    $wpdb->query("DELETE FROM {$table_name} WHERE meta_key = 'pnfw_do_not_send_push_notifications_for_this_post' OR meta_key = 'pnfw_user_cat';");
    $user_query = new WP_User_Query(array('role' => 'app_subscriber'));
    foreach ($user_query->results as $user) {
        if (empty($user->user_email)) {
            if (is_multisite()) {
                require_once ABSPATH . 'wp-admin/includes/ms.php';
                if (is_user_member_of_blog($user->ID)) {
                    wpmu_delete_user($user->ID);
                }
            } else {
                wp_delete_user($user->ID);
            }
        }
    }
    delete_option('pnfw_db_version');
    delete_option('pnfw_posts_per_page');
    delete_option('pnfw_last_save_timestamp');
    delete_option('pnfw_enable_push_notifications');
    delete_option('pnfw_ios_push_notifications');
    delete_option('pnfw_android_push_notifications');
    delete_option('pnfw_kindle_push_notifications');
    delete_option('pnfw_url_scheme');
    delete_option('pnfw_ios_use_sandbox');
    delete_option('pnfw_sandbox_ssl_certificate_media_id');
    delete_option('pnfw_sandbox_ssl_certificate_password');
    delete_option('pnfw_production_ssl_certificate_media_id');
    delete_option('pnfw_production_ssl_certificate_password');
    delete_option('pnfw_ios_payload_sound');
    delete_option('pnfw_google_api_key');
    delete_option('pnfw_adm_client_id');
    delete_option('pnfw_adm_client_secret');
    delete_option('pnfw_api_consumer_key');
    delete_option('pnfw_api_consumer_secret');
    delete_option('pnfw_enabled_post_types');
    delete_option('pnfw_enabled_object_taxonomies');
    delete_option('pnfw_use_wpautop');
    delete_option('pnfw_disable_email_verification');
    delete_option('pnfw_add_message_field_in_payload');
    delete_option('pnfw_uninstall_data');
    flush_rewrite_rules();
}
开发者ID:benediktharter,项目名称:push-notifications-for-wp,代码行数:55,代码来源:uninstall.php

示例6: test_author_queried_object_fix

 /**
  * On author pages, the queried object should only be set
  * to a user that's not a member of the blog if they
  * have at least one published post. This matches core behavior.
  *
  * @see https://core.trac.wordpress.org/changeset/27290
  */
 function test_author_queried_object_fix()
 {
     global $wp_rewrite, $coauthors_plus;
     /**
      * Set up
      */
     $author1 = $this->factory->user->create(array('user_login' => 'msauthor1'));
     $author2 = $this->factory->user->create(array('user_login' => 'msauthor2'));
     $blog2 = $this->factory->blog->create(array('user_id' => $author1));
     switch_to_blog($blog2);
     $wp_rewrite->init();
     $blog2_post1 = $this->factory->post->create(array('post_status' => 'publish', 'post_content' => rand_str(), 'post_title' => rand_str(), 'post_author' => $author1));
     /**
      * Author 1 is an author on the blog
      */
     $this->go_to(get_author_posts_url($author1));
     $this->assertQueryTrue('is_author', 'is_archive');
     /**
      * Author 2 is not yet an author on the blog
      */
     $this->go_to(get_author_posts_url($author2));
     $this->assertQueryTrue('is_404');
     // Add the user to the blog
     add_user_to_blog($blog2, $author2, 'author');
     /**
      * Author 2 is now on the blog, but not yet published
      */
     $this->go_to(get_author_posts_url($author2));
     $this->assertQueryTrue('is_author', 'is_archive');
     // Add the user as an author on the original post
     $author2_obj = get_user_by('id', $author2);
     $coauthors_plus->add_coauthors($blog2_post1, array($author2_obj->user_login), true);
     /**
      * Author 2 is now on the blog, and published
      */
     $this->go_to(get_author_posts_url($author2));
     $this->assertQueryTrue('is_author', 'is_archive');
     // Remove the user from the blog
     remove_user_from_blog($author2, $blog2);
     /**
      * Author 2 was removed from the blog, but still a published author
      */
     $this->go_to(get_author_posts_url($author2));
     $this->assertQueryTrue('is_author', 'is_archive');
     // Delete the user from the network
     wpmu_delete_user($author2);
     /**
      * Author 2 is no more
      */
     $this->go_to(get_author_posts_url($author2));
     $this->assertQueryTrue('is_404');
     $this->assertEquals(false, get_user_by('id', $author2));
     restore_current_blog();
 }
开发者ID:voceconnect,项目名称:Co-Authors-Plus,代码行数:61,代码来源:test-author-queries.php

示例7: _destroy_user

function _destroy_user($user_id)
{
    //non-admin
    if (!function_exists('wp_delete_user')) {
        require_once ABSPATH . 'wp-admin/includes/user.php';
    }
    if (is_multisite()) {
        wpmu_delete_user($user_id);
    } else {
        wp_delete_user($user_id);
    }
}
开发者ID:Beelegumes,项目名称:syst-ass-web,代码行数:12,代码来源:bootstrap.php

示例8: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     if (is_multisite()) {
         wpmu_delete_user(self::$user_id);
     } else {
         wp_delete_user(self::$user_id);
     }
     foreach (self::$post_ids as $post_id) {
         wp_delete_post($post_id, true);
     }
     self::commit_transaction();
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:12,代码来源:countUserPosts.php

示例9: 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

示例10: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     foreach (array_merge(self::$users, array(self::$fred_id)) as $user_id) {
         if (is_multisite()) {
             wpmu_delete_user($user_id);
         } else {
             wp_delete_user($user_id);
         }
     }
     foreach (self::$posts as $post_id) {
         wp_delete_post($post_id, true);
     }
     self::commit_transaction();
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:14,代码来源:listAuthors.php

示例11: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     foreach (self::$groups as $group) {
         groups_delete_group($group);
     }
     if (is_multisite()) {
         wpmu_delete_user(self::$user);
         wpmu_delete_user(self::$admin_user);
     } else {
         wp_delete_user(self::$user);
         wp_delete_user(self::$admin_user);
     }
     self::commit_transaction();
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:14,代码来源:groupsIsUser.php

示例12: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     foreach (self::$group_ids as $group_id) {
         groups_delete_group($group_id);
     }
     foreach (self::$user_ids as $user_id) {
         if (is_multisite()) {
             wpmu_delete_user($user_id);
         } else {
             wp_delete_user($user_id);
         }
     }
     self::commit_transaction();
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:14,代码来源:suggestions-nonauth.php

示例13: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     if (is_multisite()) {
         wpmu_delete_user(self::$editor_user);
         wpmu_delete_user(self::$author_user);
     } else {
         wp_delete_user(self::$editor_user);
         wp_delete_user(self::$author_user);
     }
     wp_delete_post(self::$editor_private_post, true);
     wp_delete_post(self::$author_private_post, true);
     wp_delete_post(self::$editor_privatefoo_post, true);
     wp_delete_post(self::$author_privatefoo_post, true);
     self::commit_transaction();
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:15,代码来源:postStatus.php

示例14: test_get_blogs_of_user

 /**
  * Test that usermeta cache is cleared after user deletion.
  *
  * @ticket 19500
  */
 function test_get_blogs_of_user()
 {
     // Logged out users don't have blogs.
     $this->assertEquals(array(), get_blogs_of_user(0));
     $user_id = $this->factory->user->create(array('role' => 'subscriber'));
     $blogs = get_blogs_of_user($user_id);
     $this->assertEquals(array(1), array_keys($blogs));
     // Non-existent users don't have blogs.
     if (is_multisite()) {
         wpmu_delete_user($user_id);
     } else {
         wp_delete_user($user_id);
     }
     $user = new WP_User($user_id);
     $this->assertFalse($user->exists(), 'WP_User->exists');
     $this->assertEquals(array(), get_blogs_of_user($user_id));
 }
开发者ID:plis197715,项目名称:wordpress-develop,代码行数:22,代码来源:wpDeleteUser.php

示例15: tearDown

 public function tearDown()
 {
     global $wpdb;
     parent::tearDown();
     if (is_multisite()) {
         foreach ($wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs} WHERE blog_id != 1") as $blog_id) {
             wpmu_delete_blog($blog_id, true);
         }
     }
     foreach ($wpdb->get_col("SELECT ID FROM {$wpdb->users} WHERE ID != 1") as $user_id) {
         if (is_multisite()) {
             wpmu_delete_user($user_id);
         } else {
             wp_delete_user($user_id);
         }
     }
     $this->commit_transaction();
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:18,代码来源:testcase.php


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