Unified content_profile and user page

When you install content_profile, out of the box you have two user profile pages: (1) the drupal core user page (/user/%), and (2) the content-profile node pages (node/%).  These pages don't provide exactly the same information (there's some overlap), which ends up confusing users when they're viewing user profiles.

 

If you want to conslidate these two views, here are the steps I've taken (if you have a different setup, please enlighten us!).

You'll also need the following modules: ctools (also enable page_manager), panels, content_profile

1. Display full content-profile on user page

This will mix all content-profile data in with user-profile data on at /user/% .

2. Display everything on a panel

You'll need Panels of course.  

  • Enable panels and page_manager
  • Go to /admin/build/pages and enable the user_view panel
  • Add a variant with the context option checked

 

  • Add the Profile Node context (similar to a "views relationship", this will give you content-profile information while you're visiting /user/%)

  • Add the following content (see screenshot):

    Title Type: Manually set

    Title: %content_profile:title (you'll likely want auto_nodetitle setup so your node title looks like Firstname Lastname)

    Content: User profile ("User being viewed)

3. Redirect content-profile nodes to /user/%

Now your user pages have all of the information, but your node content-profile pages only have some.  Let's redirect any pages that are content-profile nodes to /user/% instead.  The reason we're keeping user pages and nixing node pages is that /user/% has all the tabs (like Contact and Track) and fieldsets (like Purchase History), and we want to keep those.

Create a custom module and add the following snippet:

function {YOURMODULE}_init(){ $node = menu_get_object(); if($node && $node->type == 'profile'){ drupal_goto("user/{$node->uid}"); } }

AttachmentSize
singleuserpage.tgz1003 bytes

5 Comments

I've now used this page

I've now used this page http://www.nowarninglabel.com/home/creating-a-new-custom-module-in-drupal-6
and now I have a long string of code from your custom module at the very top of my page. I'll be deleting my setup for now since I'm having so much trouble. I'd really like your tip to work, but it's looking bleak right now.

Amanda@godaisies.com

Hey Amanda, I'll upload a

Hey Amanda, I've uploaded a sample zip of the custom module, and I'll go through my steps and make sure I didn't miss anything when I get the chance. Sorry for the trouble.

Ack!

Okay, I managed to stumble through and get to the last step, but I don't know how to make a custom module. I used this website: http://www.hankpalan.com/blog/drupal/make-custom-drupal-module

and made my module in Notepad which I called userprofileunited and made userprofileunited.info and userprofileunited.module and uploaded it to my modules folder. I added your code:

function {YOURMODULE}_init(){
$node = menu_get_object();
if($node && $node->type == 'profile'){
drupal_goto("user/{$node->uid}");
}
}

to the userprofileunited.module and instead of anything happening, I just got the code written across my screen. I even changed the name of YOURMODULE to userprofileunited and that didn't work either. Do you have any pointers? I'd REALLY appreciate it!

Amanda@godaisies.com

No Display Settings here

I've followed along till I get to the page about:

Add the following content (see screenshot):

Title Type: Manually set

Title: %content_profile:title (you'll likely want auto_nodetitle setup so your node title looks like Firstname Lastname)

Content: User profile ("User being viewed)

but I don't see this screen at all. Where is it? I added the Relationship: Profile Node but nothing changes. When I click continue, I get the "choose your panel layout" screen instead.

Amanda@godaisies.com

nice, thank you!

nice, thank you!