[support] changing the display of the breadcrumb trail in blog module
Sarah.Vardy at student.griffith.edu.au
Sarah.Vardy at student.griffith.edu.au
Wed Dec 12 06:20:57 UTC 2007
Hi Steve,
Thanks for your reply. I tired to change it to the following:
function getUserDisplayName($number)
{
$fieldId = 19;
$result = db_query("SELECT p.value FROM {profile_values} p WHERE p.fid = $fieldId AND p.uid = $number");
while ($nameQuery = db_fetch_object($result)) {
$displayName = $nameQuery;
}
return $displayName;
}
/**
* Implementation of hook_view().
*/
function blog_view($node, $teaser = FALSE, $page = FALSE) {
if ($page) {
// Breadcrumb navigation
$breadcrumb[] = array('path' => 'blog', 'title' => t('Blogs'));
$number = $node->uid;
$breadcrumb[] = array('path' => 'blog/'. $node->uid, 'title' => t(getUserDisplayName($number) . "'s blog");
$breadcrumb[] = array('path' => 'node/'. $node->nid);
menu_set_location($breadcrumb);
}
return node_prepare($node, $teaser);
}
But it still isn't working.
What am I doing wrong?
Sarah
----- Original Message -----
From: Steve Edwards <killshot91 at comcast.net>
Date: Tuesday, December 11, 2007 12:35 pm
Subject: Re: [support] changing the display of the breadcrumb trail in blog module
To: support at drupal.org
> Yes, you can use hook_view() (the code from the blog module is
> an implementation of hook_view).
>
> http://api.drupal.org/api/function/hook_view/5
>
> You just create the breadcrumb array the way it does below,
> replacing the appropriate element with the custom field
> data. I'm not
> sure if custom fields become part of the $user object, so you
> might have to query the database to get the field you
> want. For
> instance, if you were using the Profile module, you would need
> to query profile_fields and profile_values to get what you want
> and
> then replace the user name with the custom field in the
> $breadcrumb array.
>
> Steve
>
>
> Sarah.Vardy at student.griffith.edu.au wrote:
> > Hi,
> >
> > I was wondering if it's possible to alter this function in the
> blog
> > module, so that it displays a custom field from the user's
> profile
> > instead of the user name of the user:
> >
> > |<?php
> > function blog_view($node, $teaser = FALSE, $page = FALSE) {
> > if ($page) {
> > // Breadcrumb navigation
> > $breadcrumb[] = array('path' =>
> 'blog', 'title' => t('Blogs'));
> > $breadcrumb[] = array('path' =>
> 'blog/'. $node->uid, 'title' =>
> > t("@name's blog", array('@name' => $node->profile_displayName)));
> > $breadcrumb[] = array('path' =>
> 'node/'. $node->nid);
> > menu_set_location($breadcrumb);
> > }
> > return node_prepare($node, $teaser);
> > }
> > ?>|
> >
> > Any help would be great!
> >
> > Sarah
> >
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20071212/913eb333/attachment.htm
More information about the support
mailing list