PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.

Description

This php snippet displays a list of the (x) most recent weblog titles & teasers with "read more" links to the full blogs.

Dependencies: blog.module must be enabled.

Usage

  • For use in your user profile page override
  • Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
  • To increase/decrease the number of weblog titles listed change the $nlimit value in the first line of the snippet to suit.
  • Change the div class names or the prefix text to suit.
  $nlimit = 10;
  $result1 = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.uid = %d ORDER BY n.created ASC"), $account->uid, 0, $nlimit);
  while ($node = db_fetch_object($result1)) {
    $output2 .= node_view(node_load(array('nid' => $node->nid)), 1);
  }
  print $output2;

If you're using views, you can create a view of blogs whose first argument is 'author name', and then use this snippet in your override.

  $view = views_get_view('blogs');
  print views_build_view('embed', $view, array($account->name), FALSE, 3);