function blogapi_blogger_get_recent_posts in Blog API 7
Same name and namespace in other branches
- 8 modules/blogapi_blogger/blogapi_blogger.module \blogapi_blogger_get_recent_posts()
 - 7.2 modules/blogapi_blogger/blogapi_blogger.module \blogapi_blogger_get_recent_posts()
 
Blogging API callback. Returns the latest few postings in a user's blog. $bodies TRUE <a href="http://movabletype.org/docs/mtmanual_programmatic.html#item_mt%2EgetRece... returns a bandwidth-friendly list</a>.
2 calls to blogapi_blogger_get_recent_posts()
1 string reference to 'blogapi_blogger_get_recent_posts'
- blogapi_xmlrpc in ./
blogapi.module  - Implement hook_xmlrpc().
 
File
- ./
blogapi.module, line 410  - Enable users to post using applications that support XML-RPC blog APIs.
 
Code
function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password, $number_of_posts, $bodies = TRUE) {
  // Remove unused appkey (from bloggerAPI).
  $user = blogapi_validate_user($username, $password);
  if (!$user->uid) {
    return blogapi_error($user);
  }
  if (($error = _blogapi_validate_blogid($blogid)) !== TRUE) {
    // Return an error if not configured type.
    return $error;
  }
  if ($bodies) {
    $result = db_query_range("SELECT n.nid, n.title, n.comment, n.created, u.name FROM {node} n, {node_revision} r, {users} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", 0, $number_of_posts, array(
      ':type' => $blogid,
      ':uid' => $user->uid,
    ));
  }
  else {
    $result = db_query_range("SELECT n.nid, n.title, n.created, u.name FROM {node} n, {users} u WHERE n.uid = u.uid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", 0, $number_of_posts, array(
      ':type' => $blogid,
      ':uid' => $user->uid,
    ));
  }
  $blogs = array();
  foreach ($result as $blog) {
    $blogs[] = _blogapi_get_post($blog, $bodies);
  }
  return $blogs;
}