Drupal is up and running but how do I ...?

Custom code for recent posts block

At http://drupal.org/node/46459 I found a piece of custom code to add a block which displays the latest posts. It works great, except that I'd really like to see the date of the last update and the user who updated (or added) the post. I've looked at the code, but despite I know a bit of PHP and MySQL (or maybe thanks to that) I don't really know what to do. I can see the values I want to use are extracted from the database, but I don't know what to do to get them in the actual output. The code:

/**
* Implementation of hook_block().
*/
function tracker_block($op = 'list', $delta = 0) {
global $user;

if ($op == 'list') {
$blocks[0]['info'] = t('Recent posts');

return $blocks;
}
else if ($op == 'view') {
$sql = 'SELECT DISTINCT
(n.nid),
n.title,
n.type,
n.changed,
n.uid,
u.name,
l.last_comment_timestamp as last_post,
l.comment_count
FROM
{node} n
INNER JOIN {users} u on n.uid = u.uid
INNER JOIN {node_comment_statistics} l on n.nid = l.nid
WHERE
n.status = 1
ORDER BY
last_post desc
LIMIT 0, 16';

$sql = db_rewrite_sql($sql);
$result = db_query($sql);

$rows = array();
while ($node = db_fetch_object($result)) {
$rows[] = l($node->title, "node/$node->nid");
}

$block['content'] = theme_item_list($rows);
$block['subject'] = t('Recent posts');

return $block;
}
}

Views listing multiple times

Hello,

I am trying to use the views module to list all articles under a specific vocabulary. This should essentially work fine, but the issue I am having is that it lists single articles multiple times - once for each tag (or taxonomy term) assigned to it.

My taxonomy hierarchy is simple a free-form editing "tagging" system.

Below is an export of my views configuration.

Any advice welcome.

Thanks,
Josh


$view = new stdClass();
$view->name = 'Buyers';
$view->description = 'Buyers page';
$view->access = array (
0 => '1',
1 => '2',
2 => '3',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Buyers';
$view->page_header = 'Buyers General Page

Hello

Hey';
$view->page_header_format = '3';
$view->page_footer = 'do we

need
t

this';
$view->page_footer_format = '3';
$view->page_empty = 'There are currently no articles published under buyers.';
$view->page_empty_format = '3';
$view->page_type = 'teaser';
$view->url = 'buyers_view';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),

Adding content to a menu item

I've started to design my new site using Menu to create a menu item for reach page I want to create. (I put in dummy info for the URL.) I know I can create a menu item while I'm creating content, but how do you create content and associate it with an exisiting menu item?

.htaccess URL RewriteRule "site to be accessed only WITHOUT the www. prefix" redirecting node paths to the front page

I just installed Drupal 5.0 RC1 and wanted all request with the www. prefix in the URL to redirect to their equivalent without the www.

How to remove "Add new comments" in new page ? Also how to not put every published page on front by default ?

ok, I again got stuck. Every Page that I am creating is is having Add new Comments option as well as being promoted to front page. Now what I am doing is I have to manually disable to comments from comments settings and manually uncheck the Promoted to front page option in Publishing options when I am creating a page.

This is a real pain as I am creating lot's of pages. Can't I by default make them disable ? I am sure there will be such option ?

Regards

Flexinode Form Field in Collapsible Fieldset

Flexinode Form Field in Collapsible Fieldset

Does anyone know how to place a Flexinode form field in Collapsible Fieldset. I am trying to use form API to design a form for a flexinode content type. I have this so far, and I do see the fieldset. But all of the flexinode form items appear outside of it.

Pages

Subscribe with RSS Subscribe to RSS - Post installation