Developers corner > Developer Lobby

User Comments link to CB profiles [code included]

(1/2) > >>

Hi all!

If u want to link the CommunityBuilder profile of a user to his/her comments on a photo, you have to edit the file rsgcomments.class.php
It's in your directory /components/com_rsgallery2/lib/rsgcomments/

I'm not sure about the line where you have to add code, cause I deleted/added/edited preceding lines of code for other things I wanted to implement...
Anyway, somewhere around line 370 you will see:

--- Code: --- foreach ($comments as $comment) {
$catid = galleryUtils::getCatIdFromFileId($comment['item_id']);

--- End code ---

add the following between these two lines:

--- Code: ---/* GRVULTURE CB INTEGRATION -------------------------------------------------------------------------*/
      $grName = galleryUtils::genericGetUsername( $comment['user_id'] );
  $grHref = "index.php?option=com_comprofiler&task=userProfile&user={$comment['user_id']}";
      $grHref = sefRelToAbs($grHref);
$gruser = "<a href='{$grHref}' title='$grName'>$grName</a>";
/* --------------------------------------------------------------------------------------------------*/

--- End code ---

Then, search for galleryUtils::genericGetUsername( $comment['user_id'] )
and replace it with $gruser

This is where normally the user's name/username appears in his/her comment box.

Mine is at the Title cell, cause I don't use titles in the comments on my site.
So my line became from this:

--- Code: --- <td colspan="2" class="title"><span class="posttitle"><?php echo galleryUtils::genericGetUsername( $comment[&#39;user_id&#39;] );?></span></td>   

--- End code ---

to this:

--- Code: --- <td colspan="2" class="title"><span class="posttitle"><?php echo $gruser;?></span></td>   

--- End code ---

Now the name of the user is hyperlinked to his/her profile!
Have fun!

next I'm going to display the username of the owner of the photo and link that also to his/her profile. that's easy...
and then I will try to display thumbnails of the users' avatars next to their comments. this is gonna be tricky, so any help is mostly welcome!

I got the avatars displaying on the comments. Eaaaasy!  ;D

anyway, if u're interested, reply...

...and link to gallery where the image belongs. and link to image owner...

all working


--- Quote from: grVulture on May 10, 2008, 03:03:39 PM ---...and link to gallery where the image belongs. and link to image owner...

all working

--- End quote ---

Hi, great job !

please post the exactly what I was looking for !!!!  ::)


--- Quote ---and link to image owner...
--- End quote ---

AWESOME! Pleeeeeeeeease provide the code for this!
Would be great! Awesome work

Kind Regards Tomek


[0] Message Index

[#] Next page

Go to full version