Display guestbook entries in user profile

hipvictor - October 18, 2005 - 17:35
Project:Guestbook
Version:6.x-1.0-rc1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (code needs work)
Description

consolidation is great. I feel my site would be better served with fewer links and more content per page. Is there, or could there possibly be, a way to attach the guestbook directly to the user page rather than linking through "recent guestbook entries?"

#1

neablo - January 23, 2006 - 20:28

That's exactly what I need!

Is it possible to help me with a phptemplate file that integrates a guestbook directly in the user profile page?
That would be so great, I just don't know how to do it myself!

Is there anyone who is able to make such (as I think) difficult stuff?!?

#2

txcrew - January 29, 2006 - 21:41

Yes, I am looking to do this too!

I would imagine it can be done through the userprofile.tpl.php file, but how is the question. I am not much of a coder so perhaps we can get someone to help us out with this request.

Thanks in advance.

#3

hba - February 1, 2006 - 20:13
Assigned to:Anonymous» hba

Would this demand changes outside the guestbook module?

#4

bluecobalt - February 1, 2006 - 21:42

See http://drupal.org/node/46976

It works for me.

peace,
blue

#5

hba - May 5, 2006 - 07:49
Version:4.6.x-1.x-dev» 4.7.x-1.x-dev

Bumping version to 4.7. Someone might have a hack for 4.7 as well?

#6

scroogie - May 6, 2006 - 09:19

Yes, I did it already. Its really simple. You need a template override for your user_profile. An explenation for general profile customization can be found here: http://drupal.org/node/35728
To show the user guestbook just type

<?php
print module_invoke('guestbook', 'page', $user->uid)
?>

in the profile template.
There is one problem though, and thats the reason i was just searching the issues. The problem is that you get forwarded to the dedicated guestbook page after submitting an entry. It would be nice if you could change the module, so that it uses an hidden form field to determine from which page it gets called, and redirects to this page after submission. The regarding code is in guestbook_form_entry_submit() line 407.

#7

kylehase - May 25, 2006 - 14:30

So far looks good but the submission form is missing on my profile pages. Any ideas? Also, the theming for the guestbook module seems strange. I sometimes get white sections in the guestbook entry borders as if there's something wrong with the floating pictures. I'm ok with PHP but very new to CSS.

#8

kylehase - May 25, 2006 - 14:38

Oops, disregard that issue about missing the form. I was looking at my own profile. Still have a theming issue though.

#9

kylehase - October 10, 2006 - 04:09

Also found that if the user disables their guestbook, you get a "page not found" page where the guestbook should be. Any suggestions on an "if" statement to check thta the user has guestbook enabled?

#10

kylehase - October 10, 2006 - 04:50

This seems to work but if anyone could suggest a better alternative please let me know.

<?php
if(!$user->guestbook_status){  // guestbook_status seems to store 0 for enabled and 1 for disabled
     
print module_invoke('guestbook', 'page', $user->uid)
}
?>

#11

scroogie - October 11, 2006 - 00:20

<?php
if module_exist('guestbook')
{
   print
module_invoke('guestbook', 'page', $user->uid)
}
?>

#12

moshe weitzman - December 6, 2006 - 15:41

yes, seems like inline presentation of comments is the usual. i agree that guestbook should behave like this by default.

#13

hba - February 27, 2007 - 20:28
Version:4.7.x-1.x-dev» 5.x-1.x-dev
Status:active» fixed

added this info to INSTALL.txt in cvs

#14

bjraines - March 3, 2007 - 21:39

cannot get the snippet to work in 5.1 added

<?php
if module_exist('guestbook')
{
print
module_invoke('guestbook', 'page', $user->uid)
}
?>
as a cut and paste to a functional user profile overide and recieved the following error.

Parse error: syntax error, unexpected T_STRING, expecting '

on the second line of the code.

#15

hba - March 4, 2007 - 15:51

Try this instead (added missing ";" and used module_exists() instead):

<?php
if module_exists('guestbook') {
    print
module_invoke('guestbook', 'page', $user->uid);
}
?>

#16

hba - March 4, 2007 - 15:51
Status:fixed» active

#17

Rayvan - March 14, 2007 - 21:46
Category:feature request» support request
Priority:normal» critical
Assigned to:hba» Rayvan
Status:active» active (needs more info)

so i put

function phptemplate_user_profile($user, $fields = array())
{  if module_exists('guestbook') { print module_invoke('guestbook', 'page', $user->uid);
  }
return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields));
  }

in my template.php file????? please clarify.

#18

jeforma - March 21, 2007 - 23:38

I have tried all the ways, and your modification to add the guestbook to the profile page does not work.

please help :)

Regards,

Charles

#19

moonray - April 25, 2007 - 16:42
Category:support request» feature request
Assigned to:Rayvan» moonray
Status:active (needs more info)» patch (code needs review)

After trying the option suggested in the INSTALL.txt I found several issues.
All the links still point to the guestbook/* url, instead of the user/* url.

So, I wrote up a patch that adds a configuration option to show the guestbook on the user profile page. It then fixes the links so the user profile page is the main page it always returns to, rather than guestbook/*.

Please review.

AttachmentSize
guestbook_list_in_user_profile.patch6.91 KB

#20

artycul - May 13, 2007 - 21:44

hey moonray...

absolutely great idea. i tried your patch and had only one problem... i couldn't get the comments to work properly. the diff around line 638 looks good for me, but when i click on 'add comment' the profile shows up as before (without guestbook_form_comment_form), while the url says something like: "www.domain.tld/user/2/comment/22#comment-entry". i had to change the file by hand, because the patch didn't work for me. i'm using the dev-version...

thanks
...sebi

#21

moonray - May 15, 2007 - 16:52

Sounds like it could be a cache issue. Have you tried clearing your cache after applying the patch?
Also sounds like the patch needs to be re-rolled... will get to that soon.

#22

artycul - May 16, 2007 - 13:56

sorry, clearing the cache did not solve the prob... i'll try to re-change the file from the original one and keep you informed to rule out mistakes by me ;) thanks again for the good work!

...sebi

#23

hade - May 28, 2007 - 22:40

on my drupal 5.1 site all above snippets gave errors or "page not found" when a user disables his guestbook, now this works for me:

<?php
if (module_exists('guestbook')) {
  if(!
$user->guestbook_status){  // guestbook_status seems to store 0 for enabled and 1 for disabled
    
print module_invoke('guestbook', 'page', $user->uid);
  }
}
?>

with moonray´s patch it´s nearly perfect, but now looking for some ajax functionality for guestbook pager on profiles. ;)

#24

gurukripa - July 18, 2007 - 17:16

hi
i am using the Core profile module without any template override..

how can i ensure that the guestbook shows at the bottom of each profile...can this be done without a template override...

if i do have to do an override..then its going to be tough to get all the info back on the page...

can someone help me out..thanks..

#25

gurukripa - July 18, 2007 - 17:17
Version:5.x-1.x-dev» 5.x-1.0

i am using Version 5.x-1.0 not the dev verssion..pls help..thanks.

#26

gurukripa - July 20, 2007 - 11:33

moonray..i want to use your patch..but u say u r going to re roll it..and also there was a point ..that there was some issue with comments....cld u clarify...
shld i use the patch ???

#27

moonray - July 20, 2007 - 13:52
Version:5.x-1.0» 5.x-1.x-dev

I just checked, and there were no changes in 5.x-1.x-dev. So no need to re-roll.
Try applying it, and if it doesn't work we'll try and figure it out.

#28

Suede Pudding - August 17, 2007 - 04:36

I had the same problem as #20 (submitted by sebi_tl)

I did a quick fix by changing this line in moonray's patch

$comment_link = "user/$uid/comment/{$entry['id']}";

To

$comment_link = "guestbook/$uid/comment/{$entry['id']}";

That brings you back to the regular guestbook page when you add a comment back to a guestbook entry..I am not sure if the patch was supposed to add the comment form right on the profile page? That would be cool but, either way works for me ..YMMV.

#29

scarer - August 28, 2007 - 04:44

Hi,

I tried to run the patch using the patch command in ssh and it returns an error that all 9 hunks failed.

Is there something I am doing wrong? Please help.

Sarah

#30

panis - September 2, 2007 - 12:43
Title:option for adding guestbook to user page» Ajax functionality for guest book available

I just finished extended guestbook module to insert the guestbook in a block on any page

Features:
- show a clipped entry in the block - so if the entry is too long it will show the first "N" a teaser if you like.
- enter a new short entry into the guestbook - can be as long as you need but because it is a block I kept the entry to one line.
- Update the block using ajax as soon as the entry is updated - if ajax not available then the entire page will reload
- refresh block periodically and automatically only if ajax is available.

Configurations:
- adjust the height of the block and have scrollbar if needed
- change the background image of the block
- Limit the number of entries shown in the block

I will have a demo on my website later this week. Please let me know if something like this would be acceptable as part of the guestbook module or I should be developing an independent module. Any ideas and suggestions for features are welcome.

thanks

#31

Muslim guy - September 2, 2007 - 13:20
Title:Ajax functionality for guest book available» Summary for custom userprofile (4.7.x and 5.x)

Please could somebody summarize here `How to integrate Guestbook with custom userprofile.tpl.php'

and add to `Fun with user_profile.tpl.php - stuff for MySpace or Friendster like customizable profile'

http://drupal.org/node/165114

*You'd be an instant Drupal hero to all Drupal users/non-programmers thank you :)

#32

Muslim guy - September 2, 2007 - 14:07

Wow that worked! So simple, and no addition to template.php

So for 4.7.x, you must not use module_exists bcos its not understood by Drupal

<?php
 
if(!$user->guestbook_status){  // guestbook_status seems to store 0 for enabled and 1 for disabled
    
print module_invoke('guestbook', 'page', $user->uid);
  }
?>

#33

Muslim guy - September 2, 2007 - 14:10

The above for Drupal 4.7.x worked, only that when SUBMIT, you are brought to the actual guestbook, and you have to hit Back Button on your web browser to return to the custom user profile

Nice though, thanks a lot

*I also tried the lengthy PHP code from http://drupal.org/node/46976 but got wacky result

#34

artycul - September 3, 2007 - 10:46

Thx Suede Pudding, with your help it now works for me, too ;)

#35

JohnNoc - September 20, 2007 - 21:45

The problem with the code for 5.x stated above is that whenever the owner of the profile visits his own profile, Drupal seems to think that the profile has been edited and updated. This will show on userlists with last updated info or if you have snippets to show when the profileuser updated his profile.

dunno if it has the same problem in the 4.7.x snippet above. Haven't tested it.

#36

72dpi - November 13, 2007 - 15:21

Does anyone know if you can add an entry to your own Gusetbook?
I am using it as 'comment blocks" on user pages, and it is handy to respond top someones comments.

Also, I would lofve to modify this, so U could have a 'whisper", whereby only you and the person you wrote on can read it.

Anyone thought of this? would be really handy...

#37

sdsheridan - November 13, 2007 - 21:46

I could definitely use something like this. Is it ready for general consumption?

#38

gurukripa - November 14, 2007 - 04:54

where can we see this..hope it works for Drupal 5.1

#39

panis - January 28, 2008 - 09:35

Comment removed...

#40

sun - January 27, 2008 - 23:51
Title:Summary for custom userprofile (4.7.x and 5.x)» Display guestbook entries in user profile
Component:User interface» Code
Priority:critical» normal
Assigned to:moonray» Anonymous
Status:patch (code needs review)» patch (code needs work)

@panis: If you want to share your code, please open a separate issue and attach a patch against the latest development snapshot of guestbook.

Setting a more appropriate title.

#41

Xoso - April 10, 2008 - 00:38

I'm sorry, where do you paste this code? I'm using the Denver theme and don't have a userprofile.tpl.php file or anything like that. can i paste it in my template.php like rayvan asked?

#42

Xoso - April 10, 2008 - 23:51

I got it, I just need to resize the guestbook image and get it to use the imagecache pic. can't find how to do that.

#43

the2ndday - April 23, 2008 - 21:23
Title:Display guestbook entries in user profile» use imagecache image for guestbook

I had same problem and I just changed guestbook module file(guestbook.module)
It's not pretty but, check it out.

What I did to use imagecache on guestbook page
Replace this code (from guestbook.module)
___________________
$picture = theme('image', $picture, $alt, $alt, '', false);
___________________
with this
___________________
$picture = theme('imagecache', 'Put name of imagecache profile you made', $account->picture, $alt, $alt, '', false);
___________________

#44

sun - April 24, 2008 - 00:53
Title:use imagecache image for guestbook» Display guestbook entries in user profile

Please do not hijack issues.

#45

fe - May 11, 2008 - 22:28

clicking the submit button brings me on the guestbook page, rather than the profile page. is there a fix? i really would appreciate this feature!!

#46

IceCreamYou - May 18, 2008 - 01:25

Is there any chance of this patch getting into a release of the module anytime soon? If not, what needs to be done to get it in?

#47

IceCreamYou - May 18, 2008 - 02:28

Also, how can I get the guestbook to display at the bottom of the user's profile instead of the top without reconstructing my profile page? I know it's possible (somehow) if I create a user_profile.tpl.php but I really don't want to have to go find all the different variables I need to put in it.

#48

Xoso - May 18, 2008 - 17:15

I use advanced profile with panels. Then you can customize your profile layout easily.

#49

IceCreamYou - May 18, 2008 - 19:16

I'll probably do that at some point, but working out all the theming procedures that Advanced Profile requires to make it look good is a little more than I have time for right now.

#50

Muslim guy - May 24, 2008 - 05:39

The guestbook is sort of PUBLIC

So to achieve like u called `Whisper',

Akin to:
Private message :)

Modified privatemsg.module maybe?

#51

coupet - May 24, 2008 - 05:55

subscribe

#52

ChristieLuv - May 26, 2008 - 00:49

Hi! I tried all of the above with drupal version 5.7 but they seem to not be working. I'd like to try moonrays's patch but I don't have the capabilities to make patches. Can someone be so kind to attach the already patched file or is it even compatible with 5.7? I think an official release for 5.x would help so many people out. This is a feature a lot of people would want, a myspace style comment area. Thank you!

#53

ChristieLuv - May 26, 2008 - 04:03

Yay! I got it to work with the code hade posted! I just needed to adjust some of my configurations. Thank you so much! My visitor profiles will be so much more fun now!

#54

quam - August 3, 2008 - 05:21
Version:5.x-1.x-dev» 6.x-1.0-rc1

Does someone have a fix to display guestbook within (not replace) user profiles for Drupal 6.x?

#55

atuyo60 - August 4, 2008 - 13:23

quam, isn't the guestbook already presented as a tab in the user page?

 
 

Drupal is a registered trademark of Dries Buytaert.