Posted by Lausch on October 22, 2007 at 7:00pm
Jump to:
| Project: | Usernode Guestbook |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | MarcoR |
| Status: | postponed (maintainer needs more info) |
Issue Summary
hi guys,
is there a way to embed the comments to my custom profile page?
i use node_load to load fields of my usernode
anyway to show comments on my custom profile?
module_invoke or any possibilitie?
greets
Lausch
Comments
#1
What do you mean by custom profile page?
#2
i mean by user_profile.tpl
<?phpprint module_invoke('comment', 'nodeapi', $node, 'update index');
?>
show me the titles and comments but no template
i also tryd
<?phpprint theme('comment_view', $node, module_invoke_all('comment', 'nodeapi', $node, 'update index'));
?>
then i see the template from comment.tpl
but comment-cid and content will not work / shown
greets
Lausch
#3
Thanks for your private message, that helped a lot!
Usually the usernode_guestbook is rendered inside a normal, untouched profile-page.
As I understood your local approach, you don't use this, because you load several nodes into into your custom styled user_profile.tpl.php
You can render the usernode's comment box if you use the function usernode_guestbook_box($account); where $account is the user object of the user whose profile page is to be displayed. Note: The API has changed, the function was called usernode_guestbook_usernode($account) until revision 1.2.
Please reopen this issue if you need further help on it.
#4
Automatically closed -- issue fixed for two weeks with no activity.
#5
Sorry for reopening this, but what is the code I would use in my custom user_profile.tpl.php. Actually I would prefer to use it in a block if at all possible. This is what I posted in my template.php, is that correct to override the function?
<?phpfunction phptemplate_usernode_guestbook_box($account) {
$node = usernode_get_node($account);
$output = '';
switch ($node->comment) {
case COMMENT_NODE_READ_WRITE: // 2
$output .= comment_form_box(array('nid' => $node->nid), NULL);
case COMMENT_NODE_READ_ONLY: // 1
$output .= comment_render($node);
break;
case COMMENT_NODE_DISABLED: // 0
default:
$output .= t('@name\'s @guestbook is currently deactivated.', _usernode_guestbook_translations(check_plain($account->name)));
}
// Update the history table, stating that this user viewed the usernode.
node_tag_new($node->nid);
return $output;
}
?>
Thanks for assisting,
Marius
#6
I thought the following should work but it doesn't.
In template.php
<?phpfunction phptemplate_usernode_guestbook_box($account) {
return _phptemplate_callback('usernode_guestbook_box', array('account' => $account));
}
?>
In user_profile.tpl.php
<?phpprint $account;
?>
I'm kinda guessing how these theme overrides work, so it's no surprise it's not working. I really need to show the comments on my custom profile page with the comment post box. This module is exactly what I'm looking for, but without a solution for my profile page, I'm doomed. Any further help please?
#7
print $account huh?
use this my friend:
<?php print usernode_guestbook_box($user->uid) ?>and if you want to add the usernode_guestbook into a custom node template use:
<?php print usernode_guestbook_box($node->uid) ?>regards
Lausch
#8
Thanks a ton Lausch...I have to admit, much of this php is abracadabra to me. So I took your code and together with the following line I stuffed it in a block like so:
<?phpglobal $user;
print usernode_guestbook_box($user->uid)
?>
However that shows my comments on everybody's profile page, since I'm considered the current logged in user. What argument do I need to include to make it so it shows the users own comments?
Thanks in advance,
Marius
#9
just use ->
<?php print usernode_guestbook_box($user->uid) ?>for guestbook on the profile tpl
and
<?php print usernode_guestbook_box($node->uid) ?>on a node tpl
not global $user
regards
Lausch
#10
Right...I failed to explain that without that line it fails to load the usernode guestbook properly for the user and returns "anonymous's guestbook is currently deactivated." So I used some code from another block and now it works perfect. Thanks for pointing me in the right direction. This is the added code to activate the user from a block:
<?php$uid = arg(1);
$user = user_load(array('uid' => $uid));
print usernode_guestbook_box($user->uid)
?>
#11
ok good! im happy that your snipped work...
but something...
$uid = arg(1);$user = user_load(array('uid' => $uid));
you told me, you embed the guestbook on your custom profile template?
if you really use a custom profile tpl you have not use the function user_load()
$user is already defined.
try to print $user->uid bevor you use user_load and after, you have to get the same UID twice!
i think something is wrong in your template at another place.
your guestbook works ok, but just for your information, something seems wrong.
regards
Lausch
#12
i'm wondering what is the result!?
best regards
tf
#13
need help for the guestbook_block
i can write a comment, but the lines below the inputfield are not working/not collapsible...
<?php$uid = arg(1);
$user = user_load(array('uid' => $uid));
print usernode_guestbook_box($user->uid)
?>