avatar issue
-
Hello Ali.
Could you change a few lines of code in the JSON_API_User_Controller class where it concerns avatars.
When calling the get_userinfo(), generate_auth_cookie(), get_currentuserinfo() methods in the array, the $avatar[1] variable is returned.
We do not use these avatars in our application. These avatars cause an error:
[error][ErrorException:8] ErrorException: Undefined offset: 1 in C:\wordpress\wp-content\plugins\json-api-user\controllers\User.php:467
I suggest changing this code like this:
"avatar" => isset($avatar[1]) ? $avatar[1] : NULL,
or
"avatar" => $avatar[1] ?? NULL,
or
$avatar[1] = NULL;
preg_match('|src="(.+?)"|', get_avatar( $user->ID, 32 ), $avatar);
return array(
“cookie” => $cookie,
“cookie_admin” => $cookie_admin,
“cookie_name” => LOGGED_IN_COOKIE,
“user” => array(
“id” => $user->ID,
“username” => $user->user_login,
“nicename” => $user->user_nicename,
“email” => $user->user_email,
“url” => $user->user_url,
“registered” => $user->user_registered,
“displayname” => $user->display_name,
“firstname” => $user->user_firstname,
“lastname” => $user->last_name,
“nickname” => $user->nickname,
“description” => $user->user_description,
“capabilities” => $user->wp_capabilities,
“avatar” => ==> See Above <===
);Thank you for your attention!
- The topic ‘avatar issue’ is closed to new replies.