place latest blog posts with user profile page
Recent weblog entries (titles) snippet
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 and links to the full blogs
Dependencies: blog.module must be enabled.
Thanks to Thinkinkless and Incidental for help with improving this snippet!
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
$nlimitvalue in the first line of the snippet to suit. - Change the div class names or the prefix text to suit.
<?php
$nlimit = 10;
$query= "SELECT n.created, n.title, n.nid, n.changed FROM {node} n WHERE n.uid = %d AND n.type = 'blog' AND n.status = 1 ORDER BY n.changed DESC";
$result = db_query_range(db_rewrite_sql($query), $account->uid, 0, $nlimit);
