blogapi_blogger_get_recent_posts

5 blogapi.module blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password, $number_of_posts, $bodies = TRUE)
6 blogapi.module blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password, $number_of_posts, $bodies = TRUE)

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%2EgetRecentPostTitles"> returns a bandwidth-friendly list</a>.

2 calls to blogapi_blogger_get_recent_posts()

1 string reference to 'blogapi_blogger_get_recent_posts'

File

modules/blogapi.module, line 312
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);
  }

  $type = _blogapi_blogid($blogid);
  $result = db_query_range('SELECT n.nid, n.title,' . ($bodies ? ' n.body,' : '') . " n.created, u.name FROM {node} n, {users} u WHERE n.uid=u.uid AND n.type = '%s' AND n.uid = %d ORDER BY n.created DESC", $type, $user->uid, 0, $number_of_posts);
  $blogs = array();
  while ($blog = db_fetch_object($result)) {
    $blogs[] = _blogapi_get_post($blog, $bodies);
  }
  return $blogs;
}
Login or register to post comments