How to show comments on Profile Page
marenz - April 11, 2008 - 02:02
| Project: | Content Profile |
| Version: | 6.x-1.0-beta1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
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!

#1
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.
#2
Hi marenz. I was wondering if your module has been completed...
#3
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...?
#4
Any more info on this one? I've got the same problem.
#5
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
<?phpcomment_render($nid, $cid=0)
?>
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....
#6
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:
<?php
print views_embed_view(guestbook, $display_id = 'block_1', $nid);
print drupal_get_form('comment_form', array('nid' => $nid));
$node->comment = NULL;
}
?>
#7
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:
<?phpecho $content_profile->get_variable('profile', 'title');
?>
For more, check out the README.txt which ships with the module.
#8
But that has nothing to do with showing comments, does it?
#9
Yes it has. For example, here is my solution:
<?php
$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);
}
}
?>
Hope it helps.
#10
#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?
#11
I assume you are using content profile module
You should see this option in admin/content/node-type/%type%/profile
#12
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.
#13
sorry I'm not using CCK... :-(