I am using the UserPhoto plugin which allows users to upload a photo which can be used in many ways. (It’s awesome) But I would also like when the admins look at the list of users the column displays this users photo instead of the Gravatar. Is there a hook?
I’m a little closer…
function change_user_avatar_col( $column ) {
$column['avatar'] = 'avatar';
return $column;
}
add_filter( 'manage_users_columns', 'change_user_avatar_col' );
function change_user_avatar( $val, $column_name, $user_id ) {
$user = get_userdata( $user_id );
switch ($column_name) {
case 'avatar' :
return userphoto_thumbnail($user);
break;
default:
}
return $return;
}
add_filter( 'manage_users_custom_column', 'change_user_avatar', 10, 3 );
I am getting the images but they they are not in the column, plus I really want to replace the current gravatars and this is creating an additional column. I tried changing out the “avatar” to “Username” for the column but no success.
Not tested, but much probably this works:
Instead of trying to add/change the columns, change the
get_avatar
behavior.For one, it is a pluggable function, so it can be overridden. And second, there are many Questions in this Stack on how to modify/customize the avatars.
Check this two:
In the first one, Bainternet states:
ok i solved this problem through hacking around
in the
wp-admin/includes/class-wp-users-list-table.php
i eddited on line 285, the: case ‘username’ as followed
note: user_photo pictures must be in .jpg.
my help-source for this was user > dikkevandale on > http://wordpress.org/support/topic/plugin-user-photo-how-do-i-return-just-the-image-url
thx!
dimi