You are here

function blogapi_blogger_get_user_info in Blog API 7

Same name and namespace in other branches
  1. 8 modules/blogapi_blogger/blogapi_blogger.module \blogapi_blogger_get_user_info()
  2. 7.2 modules/blogapi_blogger/blogapi_blogger.module \blogapi_blogger_get_user_info()

Blogging API callback. Returns profile information about a user.

1 string reference to 'blogapi_blogger_get_user_info'
blogapi_xmlrpc in ./blogapi.module
Implement hook_xmlrpc().

File

./blogapi.module, line 205
Enable users to post using applications that support XML-RPC blog APIs.

Code

function blogapi_blogger_get_user_info($appkey, $username, $password) {
  $user = blogapi_validate_user($username, $password);
  if ($user->uid) {
    $name = explode(' ', $user->realname ? $user->realname : $user->name, 2);
    return array(
      'userid' => $user->uid,
      'lastname' => $name[1],
      'firstname' => $name[0],
      'nickname' => $user->name,
      'email' => $user->mail,
      'url' => url('user/' . $user->uid, array(
        'absolute' => TRUE,
      )),
    );
  }
  else {
    return blogapi_error($user);
  }
}