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


PHP get_users_of_blog函数代码示例

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


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

示例1: verify_new_user

function verify_new_user($var)
{
    if (!is_user_logged_in()) {
        return $var;
    }
    $errors = new WP_Error();
    $errors = $var['errors'];
    // get pricing plan level for the current blog
    $blogid = get_current_blog_id();
    $princing_plan = get_blog_option($blogid, 'product_id');
    // get pricing plan level for the current blog
    //$princing_plan = get_option('pricing_plan');
    //get number of users for this blog
    //$users = get_users_of_blog();
    //$nusers = count($users);
    $nusers = 0;
    global $blog_id;
    switch_to_blog($blog_id);
    $adminemail = get_bloginfo('admin_email');
    $admin = get_user_by_email($adminemail);
    restore_current_blog();
    $user_blogs = get_blogs_of_user($admin->ID);
    foreach ($user_blogs as $blog) {
        $bid = $blog->userblog_id;
        if ($bid == 1) {
            continue;
        }
        // does not count
        $email = get_blog_option($bid, 'admin_email');
        if ($email != $adminemail) {
            continue;
        }
        //eh apenas membro
        $u = get_users_of_blog($bid);
        $nusers = $nusers + count($u);
    }
    $pname = get_plan_name($princing_plan);
    switch ($pname) {
        case 'Cáucaso':
            if ($nusers == 30) {
                //$errors->add('pricing_plan', __('You have reached the maximum number of users. To add a new user pelase upgrade your plan.','delibera'));
                $errors->add('pricing_plan', __('Atingiu o número máximo de usuários permitido. Para adicionar mais usuários por favor actualize o seu plano.', 'delibera'));
            }
            break;
        case 'Miscenas':
            if ($nusers == 120) {
                //	$errors->add('pricing_plan', __('You have reached the maximum number of users. To add a new user pelase upgrade your plan.','delibera'));
                $errors->add('pricing_plan', __('Atingiu o número máximo de usuários permitido. Para adicionar mais usuários por favor actualize o seu plano.', 'delibera'));
            }
            break;
        case 'Creta':
            if ($nusers == 300) {
                //	$errors->add('pricing_plan', __('You have reached the maximum number of users. To add a new user pelase upgrade your plan.','delibera'));
                $errors->add('pricing_plan', __('Atingiu o número máximo de usuários permitido. Para adicionar mais usuários por favor actualize o seu plano.', 'delibera'));
            }
            break;
    }
    $var['errors'] = $errors;
    return $var;
}
开发者ID:cabelotaina,项目名称:delibera,代码行数:60,代码来源:delibera_plan_restriction.php

示例2: p2_get_at_name_map

function p2_get_at_name_map()
{
    global $wpdb;
    static $name_map = array();
    if ($name_map) {
        // since $names is static, the stuff below will only get run once per page load.
        return $name_map;
    }
    $users = get_users_of_blog();
    // get display names (can take out if you only want to handle nicenames)
    foreach ($users as $user) {
        $name_map["@{$user->user_login}"]['id'] = $user->ID;
        $users_to_array[] = $user->ID;
    }
    // get nicenames (can take out if you only want to handle display names)
    $user_ids = join(',', array_map('intval', $users_to_array));
    foreach ($wpdb->get_results("SELECT ID, display_name, user_nicename from {$wpdb->users} WHERE ID IN({$user_ids})") as $user) {
        $name_map["@{$user->display_name}"]['id'] = $user->ID;
        $name_map["@{$user->user_nicename}"]['id'] = $user->ID;
    }
    foreach ($name_map as $name => $values) {
        $username = get_userdata($values['id'])->user_login;
        $name_map[$name]['replacement'] = '<a href="' . esc_url('/mentions/' . $username) . '/">' . esc_html($name) . '</a>';
    }
    // remove any empty name just in case
    unset($name_map['@']);
    return $name_map;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:28,代码来源:functions.php

示例3: pp_generate_sidebars

function pp_generate_sidebars()
{
    register_sidebar(array('name' => 'All - Top', 'id' => 'pp-sidebar-top', 'before_widget' => '<li id="%1$s" class="widget pp-sidebar-top %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
    register_sidebar(array('name' => 'Home', 'id' => 'pp-home-sidebar', 'before_widget' => '<li id="%1$s" class="widget pp-home-sidebar %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
    register_sidebar(array('name' => 'Single post page', 'id' => 'pp-single-sidebar', 'before_widget' => '<li id="%1$s" class="widget pp-single-sidebar %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
    register_sidebar(array('name' => 'Project (default)', 'id' => 'pp-project-sidebar-default', 'before_widget' => '<li id="%1$s" class="widget pp-project-sidebar pp-project-sidebar-all %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
    $options = pp_get_options();
    if ($options['project_sidebars'] && ($projects = pp_get_projects())) {
        foreach ($projects as $project) {
            register_sidebar(array('name' => 'Project - ' . $project->name, 'id' => 'pp-project-sidebar-' . $project->cat_ID, 'before_widget' => '<li id="%1$s" class="widget pp-project-sidebar pp-project-sidebar-' . $project->cat_ID . ' %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
        }
    }
    register_sidebar(array('name' => 'Author (default)', 'id' => 'pp-author-sidebar-default', 'before_widget' => '<li id="%1$s" class="widget pp-author-sidebar pp-author-sidebar-all %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
    // Todo: cache the author array
    $authors = array();
    if ($options['author_sidebars'] && ($users = get_users_of_blog())) {
        foreach ($users as $user) {
            $user_object = new WP_User($user->user_id);
            if (!$user_object->has_cap('publish_posts')) {
                continue;
            }
            $authors[] = $user;
        }
    }
    foreach ($authors as $author) {
        register_sidebar(array('name' => 'Author - ' . $author->display_name, 'id' => 'pp-author-sidebar-' . $author->user_id, 'before_widget' => '<li id="%1$s" class="widget pp-author-sidebar pp-author-sidebar-' . $author->user_id . ' %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
    }
    register_sidebar(array('name' => 'All - Bottom', 'id' => 'pp-sidebar-bottom', 'before_widget' => '<li id="%1$s" class="widget pp-sidebar-bottom %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>'));
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:29,代码来源:functions-sidebars.php

示例4: setUp

 function setUp()
 {
     parent::setUp();
     // keep track of users we create
     $this->_flush_roles();
     $this->orig_users = get_users_of_blog();
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:7,代码来源:capabilities.php

示例5: load_users

 /**
  * Generates array of users indexed by user ID, and
  * an array of user_nicenames, indexed by user ID.
  *
  * @compat < 3.1: Use $wpdb and get_users of blog.
  */
 function load_users()
 {
     global $wpdb;
     // < 3.1
     // Cache the user information.
     if (!empty($this->users)) {
         return $this->users;
     }
     if (function_exists('get_users')) {
         // >= 3.1
         $users = get_users();
         foreach ($users as $user) {
             $this->users[$user->ID] = $user;
             $this->names[$user->ID] = $user->user_nicename;
         }
     } else {
         //  < 3.1
         $users = get_users_of_blog();
         $user_ids = '';
         foreach ($users as $user) {
             $this->users[$user->ID] = $user;
             $user_ids .= $user->ID;
         }
         foreach ($wpdb->get_results("SELECT ID, user_nicename from {$wpdb->users} WHERE ID IN({$user_ids})") as $user) {
             $this->users[$user->ID]->user_nicename = $user->user_nicename;
             $this->names[$user->ID] = $user->user_nicename;
         }
     }
     return $this->users;
 }
开发者ID:rajbot,项目名称:tikirobot_p2,代码行数:36,代码来源:mentions.php

示例6: form

    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, array('title' => '', 'user_id' => 0));
        ?>
        <p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:');
        ?>
</label>
			<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        esc_attr_e($instance['title']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('user_id');
        ?>
"><?php 
        _e('User:');
        ?>
</label>
			<select name="<?php 
        echo $this->get_field_name('user_id');
        ?>
" id="<?php 
        echo $this->get_field_id('user_id');
        ?>
" class="widefat">
				<option value="-1"<?php 
        selected($instance['user_id'], -1);
        ?>
><?php 
        _e('Select a User');
        ?>
</option>
<?php 
        $users = get_users_of_blog();
        foreach ($users as $user) {
            echo '
				<option value="' . $user->ID . '"' . selected($instance['user_id'], $user->ID) . '>' . esc_html($user->display_name) . '</option>';
        }
        ?>
			</select>
		</p>
<?php 
    }
开发者ID:pfefferle,项目名称:wordpress-extended-profile,代码行数:56,代码来源:widget.php

示例7: get_users_of_blog_by_rol

function get_users_of_blog_by_rol($blog_id, $rol)
{
    $users = get_users_of_blog($blog_id);
    $result = array();
    foreach ($users as $user) {
        switch_to_blog($blog_id);
        $user_o = new WP_User($user->user_id);
        if ($user_o->has_cap($rol) && strcmp($user->user_nicename, "admin") != 0) {
            array_push($result, $user);
        }
        restore_current_blog();
    }
    return $result;
}
开发者ID:alx,项目名称:blogsfera,代码行数:14,代码来源:blog_info.php

示例8: format_author_value

 function format_author_value(&$value)
 {
     if (is_array($value)) {
         $users = get_users_of_blog();
         $all = true;
         foreach ($users as $user) {
             if (!in_array($user->user_id, $value)) {
                 $all = false;
                 break;
             }
         }
         if ($all) {
             $value = '';
         }
     }
 }
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:16,代码来源:Tools.php

示例9: users_form

    function users_form($n)
    {
        global $wpdb, $testing;
        $users = get_users_of_blog($wpdb->blogid);
        ?>
<select name="userselect[<?php 
        echo $n;
        ?>
]">
	<option value="#NONE#"><?php 
        _e('- Select -');
        ?>
</option>
	<?php 
        foreach ($users as $user) {
            echo '<option value="' . $user->user_login . '">' . $user->user_login . '</option>';
        }
        ?>
	</select>
	<?php 
    }
开发者ID:joelglennwright,项目名称:agencypress,代码行数:21,代码来源:mt.php

示例10: q_generate_quser_pages

function q_generate_quser_pages()
{
    $errormessage = "All Users: ";
    $qusers = get_users_of_blog();
    foreach ($qusers as $quser) {
        $userpost = array('post_title' => $quser->display_name, 'post_content' => $quser->user_description, 'post_status' => 'publish', 'post_author' => $quser->ID, 'post_date' => $quser->registered, 'post_type' => 'quser');
        $postid = wp_insert_post($userpost);
        if (!$postid) {
            $errormessage .= __("error with user", 'qna-forum') . " " . $quser->ID;
        } else {
            update_user_meta($quser->ID, 'q_profilepage_id', $postid);
        }
    }
    //create default page with author -1 so that we can display a homepage or login page
    $default_post = array('post_title' => 'My Account', 'post_content' => 'Default User', 'post_status' => 'publish', 'post_author' => 1, 'post_type' => 'quser');
    $default_id = wp_insert_post($default_post);
    if (!$default_id) {
        $errormessage .= __("error creating default page", 'qna-forum');
    } else {
        update_option('q_quser_default_pageid', $default_id);
    }
    return $erromessage;
}
开发者ID:rongandat,项目名称:cyarevfoods,代码行数:23,代码来源:qusers.php

示例11: users_form

    function users_form($n, $author)
    {
        if ($this->allow_create_users()) {
            printf('<label>' . __('Create user %1$s or map to existing'), ' <input type="text" value="' . esc_attr($author) . '" name="' . 'user_create[' . intval($n) . ']' . '" maxlength="30" /></label> <br />');
        } else {
            echo __('Map to existing') . '<br />';
        }
        // keep track of $n => $author name
        echo '<input type="hidden" name="author_in[' . intval($n) . ']" value="' . esc_attr($author) . '" />';
        $users = get_users_of_blog();
        ?>
<select name="user_select[<?php 
        echo $n;
        ?>
]">
	<option value="0"><?php 
        _e('- Select -');
        ?>
</option>
	<?php 
        foreach ($users as $user) {
            echo '<option value="' . $user->user_id . '">' . $user->user_login . '</option>';
        }
        ?>
	</select>
	<?php 
    }
开发者ID:bluedanbob,项目名称:wordpress,代码行数:27,代码来源:wordpress.php

示例12: confirm_delete_users

function confirm_delete_users($users)
{
    global $current_user;
    if (!is_array($users)) {
        return false;
    }
    screen_icon();
    ?>
	<h2><?php 
    esc_html_e('Users');
    ?>
</h2>
	<p><?php 
    _e('Transfer or delete posts and links before deleting users.');
    ?>
</p>
	<form action="ms-edit.php?action=dodelete" method="post">
	<input type="hidden" name="dodelete" />
    <?php 
    wp_nonce_field('ms-users-delete');
    $site_admins = get_super_admins();
    $admin_out = "<option value='{$current_user->ID}'>{$current_user->user_login}</option>";
    foreach ($allusers = (array) $_POST['allusers'] as $key => $val) {
        if ($val != '' && $val != '0') {
            $delete_user = new WP_User($val);
            if (in_array($delete_user->user_login, $site_admins)) {
                wp_die(sprintf(__('Warning! User cannot be deleted. The user %s is a network admnistrator.'), $delete_user->user_login));
            }
            echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
            $blogs = get_blogs_of_user($val, true);
            if (!empty($blogs)) {
                ?>
				<br /><fieldset><p><legend><?php 
                printf(__("What should be done with posts and links owned by <em>%s</em>?"), $delete_user->user_login);
                ?>
</legend></p>
				<?php 
                foreach ((array) $blogs as $key => $details) {
                    $blog_users = get_users_of_blog($details->userblog_id);
                    if (is_array($blog_users) && !empty($blog_users)) {
                        $user_site = "<a href='" . esc_url(get_home_url($details->userblog_id)) . "'>{$details->blogname}</a>";
                        $user_dropdown = "<select name='blog[{$val}][{$key}]'>";
                        $user_list = '';
                        foreach ($blog_users as $user) {
                            if ($user->user_id != $val && !in_array($user->user_id, $allusers)) {
                                $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
                            }
                        }
                        if ('' == $user_list) {
                            $user_list = $admin_out;
                        }
                        $user_dropdown .= $user_list;
                        $user_dropdown .= "</select>\n";
                        ?>
						<ul style="list-style:none;">
							<li><?php 
                        printf(__('Site: %s'), $user_site);
                        ?>
</li>
							<li><label><input type="radio" id="delete_option0" name="delete[<?php 
                        echo $details->userblog_id . '][' . $delete_user->ID;
                        ?>
]" value="delete" checked="checked" />
							<?php 
                        _e('Delete all posts and links.');
                        ?>
</label></li>
							<li><label><input type="radio" id="delete_option1" name="delete[<?php 
                        echo $details->userblog_id . '][' . $delete_user->ID;
                        ?>
]" value="reassign" />
							<?php 
                        echo __('Attribute all posts and links to:') . '</label>' . $user_dropdown;
                        ?>
</li>
						</ul>
						<?php 
                    }
                }
                echo "</fieldset>";
            }
        }
    }
    ?>
	<p class="submit"><input type="submit" class="button-secondary delete" value="<?php 
    esc_attr_e('Confirm Deletion');
    ?>
" /></p>
	</form>
    <?php 
    return true;
}
开发者ID:owaismeo,项目名称:wordpress-10,代码行数:92,代码来源:ms.php

示例13: getBlogUsernames

 /**
  * Returns all blog usernames (in form [user_login => display_name (user_login)] )
  *
  * @return array $usernames
  **/
 function getBlogUsernames()
 {
     $return = array();
     $users = get_users_of_blog();
     foreach ($users as $user) {
         if ($user->display_name == $user->user_login) {
             $return[$user->user_login] = "{$user->display_name}";
         } else {
             $return[$user->user_login] = "{$user->display_name} ({$user->user_login})";
         }
     }
     return $return;
 }
开发者ID:elizabethcb,项目名称:Daily-Globe,代码行数:18,代码来源:wpomatic-class-copy-thing.php

示例14: xtec_delblogs_page

function xtec_delblogs_page()
{
    if (isset($_POST['inactivity_days'])) {
        $inactivity_days = $_POST['inactivity_days'];
    } else {
        $inactivity_days = get_site_option('xtec_maintenance_inactivity_days', 90);
    }
    if (isset($_POST['posts_pages'])) {
        $posts_pages = $_POST['posts_pages'];
    } else {
        $posts_pages = get_site_option('xtec_maintenance_posts_pages', 2);
    }
    if (get_site_option('xtec_maintenance_never_upload_file', 1) == 1) {
        $never_upload_file = true;
    } else {
        $never_upload_file = false;
    }
    if (isset($_POST['never_upload_file'])) {
        $never_upload_file = true;
    } else {
        if (isset($_POST['submit']) || isset($_POST['set_as_default']) || isset($_POST['touch'])) {
            $never_upload_file = false;
        }
    }
    ?>
	
	<div class="wrap">
	
	<h2>Eliminació de blocs</h2>
	
	<?php 
    global $wpdb;
    if (isset($_POST['delete'])) {
        if (!isset($_POST['idblogs'])) {
            ?>
<div class="error below-h2"><p>No has seleccionat cap bloc.</p></div><?php 
        } else {
            $idblogs = $_POST['idblogs'];
            foreach ($idblogs as $idblog) {
                $blogname = get_blog_option($idblog, 'blogname');
                $path = $wpdb->get_var("SELECT `path` FROM `{$wpdb->blogs}` WHERE `blog_id`='{$idblog}'");
                $del_date = date("Y-m-d H:i:s");
                $sql = "INSERT INTO `wp_delblocs` SET `site_id` = '{$idblog}', `site_path` = '" . $path . "', `blogname` = '" . $blogname . "', `del_date` = '{$del_date}', `status` = '2';";
                $wpdb->get_results($sql);
                $users = get_users_of_blog($idblog);
                foreach ($users as $user) {
                    $sql = "INSERT INTO `wp_delblocs_users` SET `blog_id` = '{$idblog}', `user_id` = '" . $user->user_id . "', `user_login` = '" . $user->user_login . "', `display_name` = '" . $user->display_name . "', `user_email` = '" . $user->user_email . "', `meta_value` = '" . $user->meta_value . "';";
                    $wpdb->get_results($sql);
                }
                // drops data of the blog when deleted
                wpmu_delete_blog($idblog, true);
                echo "El bloc {$blogname} amb ID {$idblog} s'ha eliminat correctament.<br />";
            }
        }
        echo "<p><a href=\"?page=xtec-delblogs\">Torna al formulari d'eliminació de blocs</a></p>";
    } else {
        if (isset($_POST['touch'])) {
            if (!isset($_POST['idblogs'])) {
                ?>
<div class="error below-h2"><p>No has seleccionat cap bloc.</p></div><?php 
            } else {
                $idblogs = $_POST['idblogs'];
                foreach ($idblogs as $idblog) {
                    $blogname = get_blog_option($idblog, 'blogname');
                    $wpdb->update($wpdb->blogs, array('last_updated' => current_time('mysql', true)), array('blog_id' => $idblog));
                    refresh_blog_details($wpdb->blogid);
                    echo "La data de la darrera actualització del bloc <strong>{$blogname}</strong> amb ID <strong>{$idblog}</strong> ha estat actualitzada a la data actual.<br>";
                }
            }
            echo "<p><a href=\"?page=xtec-delblogs\">Torna al formulari d'eliminació de blocs</a></p>";
        } else {
            if (isset($_POST['set_as_default'])) {
                update_site_option('xtec_maintenance_inactivity_days', $_POST['inactivity_days']);
                update_site_option('xtec_maintenance_posts_pages', $_POST['posts_pages']);
                $value = isset($_POST['never_upload_file']) ? 1 : 0;
                update_site_option('xtec_maintenance_never_upload_file', $value);
            }
            ?>
		
		<form action="?page=xtec-delblogs" method="post">
			<table class="form-table">
				<tbody>
					<tr valign="top">
						<th scope="row">
							<label for="inactivity_days">Dies d'inactivitat</label>
						</th>
						<td>
							<input id="inactivity_days" class="small-text" type="text" value="<?php 
            echo $inactivity_days;
            ?>
" name="inactivity_days"/>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row">
							<label for="posts_pages">Articles i pàgines</label>
						</th>
						<td>
							<input id="posts_pages" class="small-text" type="text" value="<?php 
            echo $posts_pages;
//.........这里部分代码省略.........
开发者ID:ignacioabejaro,项目名称:xtecblocs,代码行数:101,代码来源:xtec-maintenance.php

示例15: trailingslashit

         } else {
             $domain = $current_site->domain;
             $path = trailingslashit($current_site->path . $dashboard_blog);
         }
         $wpdb->hide_errors();
         $dashboard_blog_id = wpmu_create_blog($domain, $path, __('My Dashboard'), $current_user->id, array('public' => 0), $current_site->id);
         $wpdb->show_errors();
     } else {
         $dashboard_blog_id = $blog_details->blog_id;
     }
 }
 if (is_wp_error($dashboard_blog_id)) {
     wp_die(__('Problem creating dashboard blog: ') . $dashboard_blog_id->get_error_message());
 }
 if ($_POST['dashboard_blog_orig'] != $_POST['dashboard_blog']) {
     $users = get_users_of_blog(get_site_option('dashboard_blog'));
     $move_users = array();
     foreach ((array) $users as $user) {
         if (array_pop(array_keys(unserialize($user->meta_value))) == 'subscriber') {
             $move_users[] = $user->user_id;
         }
     }
     if (false == empty($move_users)) {
         foreach ((array) $move_users as $user_id) {
             remove_user_from_blog($user_id, get_site_option('dashboard_blog'));
             add_user_to_blog($dashboard_blog_id, $user_id, get_site_option('default_user_role', 'subscriber'));
             update_user_meta($user_id, 'primary_blog', $dashboard_blog_id);
         }
     }
 }
 update_site_option('dashboard_blog', $dashboard_blog_id);
开发者ID:beaucollins,项目名称:wp,代码行数:31,代码来源:ms-edit.php


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