I'm using Content Profile to allow my users to create their own profile nodes. I'm not sure if that makes a difference here, so I want to point it out. I'm also using Panels to control the layout of the user profiles.

When I go to a user's account page, I see Home >> My account, if I'm logged in. If I'm not logged in, I only see Home.
When I go to my own account page, I only see Home.

What I would like to see is:
Home >> User Profiles ("User Profiles" will just be a path to a view that displays all the user profiles on the site.)

I've tried using a Custom Breadcrumb for Module Page, with the Module Page dropdown menu set to modules/user/user-profile but this did not work.

What am I doing wrong? Any help would be very much appreciated.

Thanks!

Comments

megan_m’s picture

subscribe

MGN’s picture

Status: Active » Postponed (maintainer needs more info)

Your approach is correct - the user-profile template is the one you are looking for.

I tracked the source of this bug down to a problem with breadcrumb caching. The fix (I hope) has been committed to the 6.x-2.x-dev version for further testing. Can you try the latest code and verify that this solves the problem?

bohz’s picture

Hallo.
just tested the very setup described by OP with the latest 6.x-2.x-dev and it works as expected.
(using content profile but not panels)

Thanks a lot!

dmetzcher’s picture

Good to know. Thanks!

I ended up coming up with another approach that worked nicely. I wonder what advantages doing it the way I was trying to do it would have over doing it the way I did it below. Can anyone shed some light on this? Basically, I'm getting what I want out of it. If I'm logged in and view my profile, I see a "Home" breadcrumb. If I'm viewing another user's profile (whether I'm logged in or not), I see a custom breadcrumb that I added. The second one below adds breadcrumbs to the pages that come after user/username/, such as user/username/edit and user/username/track, etc.

I created three custom breadcrumbs. They are below. Thoughts?

================================================================

User Profiles: Profile Page (All users except current) with PHP snippet
Type: Path
Breadcrumb Visibility:

// Show breadcrumbs only on the profile page and not on the user/register, user/login, or user/*/edit pages.
// Do not show on logged in user's own page.
global $user;
if (arg(0) == 'user' && $user->uid != arg(1) && is_numeric(arg(1)) && (arg(2) == NULL) )
{
  return TRUE;
} else {
  return FALSE;
}

Titles: Member Profiles
Paths: users/profiles

================================================================

User Profiles: Profile Page Tabs (All users except current) with PHP snippet
Type: Path
Breadcrumb Visibility:

// Show breadcrumb on pages that come after user, such as user/*/edit, user/*/sluser, user/*/track/navigation, etc.
// Do not show on logged in user's own page.
global $user;
if (arg(0) == 'user' && $user->uid != arg(1) && is_numeric(arg(1)) && (arg(2) != NULL) )
{
  return TRUE;
} else {
  return FALSE;
}

Titles: <?php return array('Member Profiles', user_load(arg(1))->name); ?>
Paths: <?php return array('users/profiles', 'user/'.arg(1)); ?>
(The PHP above in the Titles and Paths fields produces breadcrumbs like Home » Member Profiles » James Smith, where "James Smith is the actual username for the profile being viewed.)

================================================================

User Profiles: Profile Page Tabs (Current user) with PHP snippet
Type: Path
Breadcrumb Visibility:

// Show breadcrumbs on pages that come after /user, such as user/*/edit, user/*/sluser, etc.
// Only show on logged in user's own page.
global $user;
if (arg(0) == 'user' && $user->uid == arg(1) && is_numeric(arg(1)) && (arg(2) != NULL) )
{
  return TRUE;
} else {
  return FALSE;
}

Titles: My Account
Paths: user

================================================================

Elder Brother’s picture

dmetzcher - Currently trying to run through your solution to this problem - How do you allow PHP to be used in the 'Titles' field? I'm getting a warning -

'Use of PHP in titles is not permitted and will be filtered out.'

Thanks for your work so far in this, I've spent an unholy amount of time on this (relatively small) issue as it should be so simple to solve..

Cheers.

MGN’s picture

@bulkhead, make sure you have enabled the 'Allow the use of PHP to set titles and paths' option on the custom breadcrumbs configuration page (admin/settings/custom-breadcrumbs).

@dmetzcher, I don't see a problem with this approach. Its a good demonstration of how breadcrumb visibility can be used to customize the breadcrumb trail. Thanks for sharing.

dmetzcher’s picture

@bulkhead: MGN beat me to it and answered your question.

@MGN: OK, thank you. :)

Elder Brother’s picture

Great - Thanks for tip - Hadn't even come across the Custom Breadcrumb settings before (argh).

I'm using Advanced Profile (which also requires Content Profile) and have managed to get other user's profiles displaying a custom breadcrumb as you have suggested. However, if you edit another user the trail changes to 'My Account', which I think may be coming from the Advanced Profile module. I'm unsure how to amend the URL alias for user/%/edit, and whether this is necessary to get the breadcrumb consistent.

What are the paths (or panels..or module pages) that you are applying the three breadcrumbs to exactly, and have you been able to correctly breadcrumb user/%/edit?

I have aliased the following paths -

user -> my-profile

(using automated path) user account page paths: members-directory/[uid]

Sorry for the slightly clueless questions, I hope I'm not de-railing the topic.

dmetzcher’s picture

Re: Comment #8

I'm not seeing that on my site.
When I click "Edit" on another user's profile (this assumes I'm an admin and can edit someone else's profile), I see the breadcrumb as Home » Member Profiles » John Smith (where "John Smith" is the username). If I then click the secondary tab to edit the user's Content Profile node, I see the same path (Home » Member Profiles » John Smith).

I believe that one of the custom breadcrumbs that I listed in comment #4 above is controlling this. Specifically, I think the one labeled "User Profiles: Profile Page Tabs (All users except current) with PHP snippet" is handling the Edit pages. I say that only based on my PHP comments for that one.

"Show breadcrumb on pages that come after user, such as user/*/edit, user/*/sluser, user/*/track/navigation, etc."

Try creating that one on your site and let us know if it works.

Elder Brother’s picture

Thanks dmetzcher, I think I finally ironed this all out, though I somehow made it more involved than required.

Right, now to sort out those pesky forum breadcrumbs..

MGN’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I think this can now be closed. If there is more to do here, please reopen.

andreiianusco’s picture

Hello,

What do I have to put into the "Specific Path" field?
In pathauto I have set up users/[user-raw] for user paths.

Thank you in advance,
Andrei