WordPress.org

Support

Support » Plugins and Hacks » JSON API » [Plugin: JSON API] getting avatar image output in JSON

[Plugin: JSON API] getting avatar image output in JSON

Viewing 1 replies (of 1 total)
  • Are you using BuddyPress also?
    Something like this perhaps?

    public function user_listing() {
            global $json_api;
            $key = null;
            extract($json_api->query->get(array('key')));
    
    // optional - you may want to validate a "key" parameter?
    //        authorise($key) ? die('Access denied') : false;
    
    // Which users do you want?
            $args = array('role'=>'subscriber');
            $my_users = get_users( $args );
    
            foreach($my_users as $handle => $my_user){
               $$my_users[$my_user->ID]= array(
                    'UserID'=>$my_user->ID,
                    'UserName'=>$my_user->display_name,
                    'AvatarImageURL'=>bp_core_fetch_avatar(array('html'=> false,'item_id'=>$my_user->ID,'object'=>'user'))
                );
    
            }
    
            return array(
                "users" => $my_users,
                "message" => ''
            );
        }
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: JSON API] getting avatar image output in JSON’ is closed to new replies.
Skip to toolbar