To add to @Rarst answer, there are a couple of other problems in your code.
As stated, get_users_of_blog()
has been depreciated. You’ve said that you did try get_users()
, but it did not work. The reason for that is, the returned objects have changed with the function. You should do a var_dump
to see what objects are returned and are valid to use
Doing something like this
<?php
$blogusers = get_users();
?><pre><?php var_dump($blogusers); ?></pre><?php
produces something like
array(4) {
[0]=>
object(WP_User)#307 (7) {
["data"]=>
object(stdClass)#208 (10) {
["ID"]=>
string(1) "4"
["user_login"]=>
string(8) "NAME WITHHELD"
["user_pass"]=>
string(34) "$P$BUisddOXmHJTE8i1vB/a1WZIy4KazDbD/1"
["user_nicename"]=>
string(8) "chantell"
["user_email"]=>
string(26) "EMAIL WITHHELD"
["user_url"]=>
string(0) ""
["user_registered"]=>
string(19) "2013-07-01 15:25:10"
["user_activation_key"]=>
string(0) ""
["user_status"]=>
string(1) "0"
["display_name"]=>
string(15) "WITH HELD"
}
["ID"]=>
int(4)
["caps"]=>
array(1) {
["subscriber"]=>
bool(true)
}
["cap_key"]=>
string(15) "wp_capabilities"
["roles"]=>
array(1) {
[0]=>
string(10) "subscriber"
}
["allcaps"]=>
array(3) {
["read"]=>
bool(true)
["level_0"]=>
bool(true)
["subscriber"]=>
bool(true)
}
["filter"]=>
NULL
etc.......................
This is also wrong
$user = get_userdata($bloguser->user_id);
user_id
should be ID
as you can see from the var_dump
. Also, I think you are actually looking for get_user_meta
as get_userdata
returns the same values as get_users
. Also, do a var_dump
to see what objects are returned from get_user_meta
$user = get_user_meta($bloguser->ID);
?><pre><?php var_dump($user); ?></pre><?php
returns
array(14) {
["first_name"]=>
array(1) {
[0]=>
string(8) "WITHELD"
}
["last_name"]=>
array(1) {
[0]=>
string(6) "WITHHELD"
}
["nickname"]=>
array(1) {
[0]=>
string(8) "WITHHELD"
}
["description"]=>
array(1) {
[0]=>
string(0) ""
}
["rich_editing"]=>
array(1) {
[0]=>
string(4) "true"
}
["comment_shortcuts"]=>
array(1) {
[0]=>
string(5) "false"
}
["admin_color"]=>
array(1) {
[0]=>
string(5) "fresh"
}
["use_ssl"]=>
array(1) {
[0]=>
string(1) "0"
}
["show_admin_bar_front"]=>
array(1) {
[0]=>
string(4) "true"
}
["wp_capabilities"]=>
array(1) {
[0]=>
string(28) "a:1:{s:10:"subscriber";b:1;}"
}
["wp_user_level"]=>
array(1) {
[0]=>
string(1) "0"
}
["avatar_manager_avatar_type"]=>
array(1) {
[0]=>
string(8) "gravatar"
}
["twitter"]=>
array(1) {
[0]=>
string(0) ""
}
["facebook"]=>
array(1) {
[0]=>
string(12) "WITHHELD"
}
}
This should get you going. Just another point, you should use wp_reset_postdata()
to reset WP_Query
, not wp_reset_query()