Hi, I can see the comments after clicking on "View" on the Account Page, but how I can let Drupal show also the Comments on my normal Account Page? I tried so much out, please help me!

Comments

Anonymous’s picture

Hi, so far I found out this has to be programmed. First I thought my programming skills are not enough, but now I am working on a module that is exactly doing that.

Passionate_Lass’s picture

Hi marenz. I was wondering if your module has been completed...

zilla’s picture

Component: User interface » Miscellaneous

you can not show the comments unless the profile is set to full content AND takes over the profile, apparently...it's a bit odd in terms of user experience, but perhaps this should go in as a feature request...?

halfiranian’s picture

Any more info on this one? I've got the same problem.

savioret’s picture

I have the same problem... :-(

Maybe the best option is to set the Don't display this content profile on the user account page option and use your own profile template and call directly to comment_render($nid, $cid=0) to show de comments.

Anyway the problem persists if you access the node using ?q=node/XX (sometimes the VIEW link still points there...)
This module seems too problematic I think I'll try the guestbook module instead.

*UPDATE*
Well, after trying Guestbook, maybe the best integrated option is Content Profile... so I'll try to make my own profile template...
I still don't know what to do to avoid the ?q=node/XX link....

halfiranian’s picture

I basically created a block 'view' of my comments, embedded that, and then called the comment form.

I put this in my node-profile.tpl.php page:

   print views_embed_view(guestbook, $display_id = 'block_1', $nid);
   print drupal_get_form('comment_form', array('nid' => $nid));
   $node->comment = NULL;
   }
   
savioret’s picture

I have found this documentation in the author's blog.

Theming with content profile

When you have a "profile-as-nodes" you probably want to use some profile information stored in your profile content in some of your themes, e.g. to show some additional information about the author of a forum post. To do so, you previously had to manually load the profile node in your theme and output the right data at the right place - yeah and not forget to properly check your data...
This cried for improvements, so I tackled this problem. We need to be able to easily access the data of the created profiles, where it should be already properly prepared for use in a template so you haven't to check it yourself. Yes and we should do that fast.. So just loading all profile data and putting it into $user is really no option.

The solution I came up with is $content_profile: A little nice variable which is available in templates related to users that let's you access all the information stored in profiles. The nice thing is that it offers you all variables you are used to have a in a "node template" and it lazy-loads the profile content nodes - so they aren't loaded for nothing.

This is an example use you could put in a template to show the profile content's title:
echo $content_profile->get_variable('profile', 'title');

For more, check out the README.txt which ships with the module.

halfiranian’s picture

But that has nothing to do with showing comments, does it?

savioret’s picture

Yes it has. For example, here is my solution:

  • Set Don't display this content profile on the user account page from admin options.
  • Edit user-profile.tpl.php from you template folder and add this wherever you want
    
      $node = NULL;
      $node_profile = $content_profile->get_variables('profile');
      if($node_profile)
        $node = &$node_profile['node'];
    
      // [ ... ]
    
    
      // This is the ready-for-print variable for the user profile data
      print $user_profile;
    
      // [ ... ]
    
      // Print this wherever you want to show the node_profile content
      print node_view($node, FALSE/*teaser*/, TRUE, TRUE);
    
      // [ ... ]
    
      // Put this where you want to show your comment block
      if ($node && function_exists('comment_render')){
        if( $node->comment)
        {
          print comment_render($node);
        }
      }
    
    
  • you can overwrite the node-profile.tpl.php file to show you profile content themed.
  • Remember to clear cache if you have added new tpl files.
  • With this method you don't have to use the content_profile-display-view.tpl.php file and you have to access the profile using the user/XX query (not the node/XX query).

Hope it helps.

twopointoh’s picture

#9 - I cant get that working! Can you advise what I might be doing wrong? I followed your instructions - but no comments are printed or ability to add comments. I am so confused. I am using Drupal 6.x.
The only part I couldn't see where to go to was "Set Don't display this content profile on the user account page from admin options." Where is this?

savioret’s picture

I assume you are using content profile module
You should see this option in admin/content/node-type/%type%/profile

Sailingdude’s picture

Birwil, do you mean: "Use this content type as a content profile for users"? I followed your steps, but i get this error:
warning: Invalid argument supplied for foreach() in /usr/home/deb23581/domains/dezeil.nl/public_html/drupal/sites/all/modules/cck/content.module on line 1284.

savioret’s picture

sorry I'm not using CCK... :-(

51ucars’s picture

it works for the core comment module. any suggestion for node comment showing in the content profile?
I try to embed view of node comment view -defaults using veiw_get_view and print, but doesnot work.

charlybrown’s picture

I have been looking for something like this for some time now. Does the module you were creating functioning?

Regards,
chi hair straightener

heather’s picture

To show comments on the profile page.

Step 1: Edit the Profile content type:
- Enable comments, and set whatever settings you like. I like my comments 'Flat' and to hide subject lines.
- Select: Use this content type as a content profile for users
- Save

Step 2: Override the theme template file.

- Locate the content-profile-display-view.tpl.php in the Content profile module directory. Copy this into your theme directory.
- Open your theme's copy of content-profile-display-view.tpl.php. Add this code to the bottom:

<?php if ($node && function_exists('comment_render')){
    if( $node->comment)
    {
      print comment_render($node);
    }
  }
  ?>

- Clear your theme registry

This puts the comments on your profile page. Just tried this yesterday!

Rick Hood’s picture

Confirming that Heather's solution work's great. Thanks Heather.

I am working on a site where I need to create a Facebook style (sort of) "wall" -- trying to do just using Drupal core commenting (to keep things simple) -- comments on user profiles more or less does that.

I also used the suggestion here: http://drupal.org/node/661572#comment-2411118 so that when hitting the profile node directly it redirects you to the user page. Without that, if you post a comment to a profile in a user page, it redirects you to the profile node, when really you want to come back to the user page.

I wanted the user page to be a users "home page" (not the profile node) because that is the page that is linked to from so many places (such as 'author' link on posts).

Q2U’s picture

subscribe

mpavankumar’s picture

hi Rick, did you find the solution for staying on the page after submitting the comment?

Heihachi88’s picture

subscribing either

Heihachi88’s picture

in node-profile.tpl.php add these lines of code:

	// We don't ever want to go to the nodeprofile itself.
	// Always redirect to the user page.
	if (arg(0) == "node") {
	drupal_goto("user/$node->uid", NULL, NULL, 301);
	}