1
rajaito
adding comments to member profiles
  • 2005/2/25 0:55

  • rajaito

  • Not too shy to talk

  • Posts: 109

  • Since: 2005/1/3 1


I'd like to add personal comments or a guestbook to each member's profile. Kind of like friend's comments on myspace. Anyone know how to do this??

2
hyperpod
Re: adding comments to member profiles
  • 2005/2/25 1:45

  • hyperpod

  • Quite a regular

  • Posts: 359

  • Since: 2004/10/4


I dont think its possible with the default XOOPS user profiles.

At the bottom it only lists content the user has submitted in various modules.

Good idea tho. And it can be done if you extend it with another custom module with comments integrated in.

Hope you can find a solution.

Cheers,

3
Wheeler
Re: adding comments to member profiles
  • 2005/2/25 3:34

  • Wheeler

  • Not too shy to talk

  • Posts: 145

  • Since: 2004/10/29


rajaito,
You could possibly do it. Check this link out
http://dev.xoops.org/modules/phpwiki/index.php/Commentsystem
Now that you said it, I want it for my site. I will make an attempt at this soon. I would like to give it a try now but I am launching a new site. If you can't get it, please wait patiently for I will keep you posted on my progress.

4
rajaito
Re: adding comments to member profiles
  • 2005/2/25 5:10

  • rajaito

  • Not too shy to talk

  • Posts: 109

  • Since: 2005/1/3 1


Hmm... thanx wheeler. It doesn't look too difficult, but I'll be honest that I am a little nervous to go at this alone. I am still a little new to all this. I have learned a lot, but I'd hate to mess my site up and scare everyone away after I just released it. I'll talk with my fellow admin and see if he wants to go at it with me or if we should hold back and let you do all the dirty work. Ha ha.... Stay in touch.

5
rajaito
Re: adding comments to member profiles
  • 2005/3/13 9:04

  • rajaito

  • Not too shy to talk

  • Posts: 109

  • Since: 2005/1/3 1


Hey Wheeler,

Have you heard of the "extremuserguestbook" module? This is almost exactly what I was talking about. I am not sure much hacking would be involved, but if one could make each user's guest book display on their member profiles..... Bam!! Just what we want. What do you think??

6
hyperpod
Re: adding comments to member profiles
  • 2005/3/22 14:07

  • hyperpod

  • Quite a regular

  • Posts: 359

  • Since: 2004/10/4


The profiles module lets users create an extended profile that has the comments system integrated as well as image uploads.


Resized Image



Best Regards,

7
rajaito
Re: adding comments to member profiles
  • 2005/6/18 1:14

  • rajaito

  • Not too shy to talk

  • Posts: 109

  • Since: 2005/1/3 1


Thank you, but the profiles module has a lot of potential but its not really what I am looking for. I just want to add a simple guestbook or a comment system to the default XOOPS profile page.

8
rajaito
Re: adding comments to member profiles
  • 2005/6/18 4:11

  • rajaito

  • Not too shy to talk

  • Posts: 109

  • Since: 2005/1/3 1


Looking at the link that wheeler posted, it totally seems feesible. I just don't feel quite comfortable enough to do this alone. Anyone else want to help? I think this would be an awesome hack that people would utilize. Look how successful MySpace is. Think about it.

Here is that link again:
http://dev.xoops.org/modules/phpwiki/index.php/Commentsystem

9
rajaito
Re: adding comments to member profiles
  • 2005/6/21 1:55

  • rajaito

  • Not too shy to talk

  • Posts: 109

  • Since: 2005/1/3 1


Ok well... Since nobody seems to be interested, I decided to try this myself. But after I completed step 4 I don't really understand what to do next.

How do I actually make it work? Do I have to at a table to the database? How do I call the comment functions on userinfo.php? What is a callback and why is it optional?

Someone out there that knows more than me must be interested in this hack! At least tell me if I am crazy to try to make this work?

===== 3.4.3.1 Adding XOOPS global comments feature to your module (Smarty version) =====
===
Step 1===

First of allthere are 2 variables that you must prepare before proceeding to subsequent stepsThose are:

    * 
AThe name of unique ID for an item to which comments will be added. For examplethis will be 'storyid' in News module, and 'poll_id' in XoopsPoll module.
    * 
BThe name of file which displays each item when the above unique item ID is passed as HTTP GET request. For examplethe file name will be 'article.php' for News modulewhere an each article will be displayed by accessing this file as article.php?storyid=(unique id here). Similarlyit will be 'pollresults.php' for XoopsPoll module.

Now open xoops_version.php and add the following lines:

$modversion['hasComments'] = 1;
$modversion['comments']['itemName'] = 'value obtained in A';
$modversion['comments']['pageName'] = 'value obtained in B';

For 
examplein News module:

$modversion['hasComments'] = 1;
$modversion['comments']['itemName'] = 'storyid';
$modversion['comments']['pageName'] = 'article.php';

===
Step 2===

Copy the following files from the web links module and save them to your module directory

        
comment_new.php
        
comment_edit.php
        
comment_delete.php
        
comment_post.php
        
comment_reply.php

===Step 3===

Open the file specified in Step 1B (i.earticle.php in News), and add the following line just before including footer.php

include XOOPS_ROOT_PATH.'/include/comment_view.php';

===
Step 4===

Open the appropriate template file for your module (news_article.html for News module), and copy paste the following lines where comments should be displayed (You can of course customise the HTML tags as you prefer).

<
div style="text-align: center; padding: 3px; margin: 3px;">
  <{
$commentsnav}>
  <{
$lang_notice}>
div>

<
div style="margin: 3px; padding: 3px;">

<{if 
$comment_mode == "flat"}>
  <{include 
file="db:system_comments_flat.html"}>
<{elseif 
$comment_mode == "thread"}>
  <{include 
file="db:system_comments_thread.html"}>
<{elseif 
$comment_mode == "nest"}>
  <{include 
file="db:system_comments_nest.html"}>
<{/if}>

div>

That's about all you would need to add on the user side. As for the admin side, ALWAYS call the following function whenever an item is deleted so that the comments attached to the deleted item will also be removed and number of user posts be updated accordingly.

function xoops_comment_delete(integer module_id , integer item_id)

For example in News module, the function is called as below whenever a news article is deleted:

xoops_comment_delete($xoopsModule->getVar('
mid'), $storyid)

Another useful function is xoops_comment_count(), which takes module ID and item ID as parameters and will return the total number of comments for the specified item.

function xoops_comment_count(integer module_id [, integer item_id*])

If item_id is not specified, then the total number of comments for the module specified by module_id will be returned.

===Step 5 (Optional)===

==Setting up callback functions==

You can specify callback functions by adding the following lines to xoops_version.php.

$modversion['
comments']['callback']['approve'] = 'function';

function will be executed upon successful post of an approved comment. This includes comment posts by administrators, and change of comment status from '
pending' to 'active' state. An XoopsComment object that has been approved will be passed as the first and only parameter. This should be useful for example notifying the item submitter of a comment post.

$modversion['
comments']['callback']['update'] = 'function';

function will be executed whenever the total number of '
active' comments for an item is changed. Two parameters will be passed as parameters, the unique ID of an item as the first parameter and the total number of active comments for that item as the second.

$modversion['
comments']['callbackFile'] = 'file name';

The name of file in which callback functions are defined.

Example

modules/mylinks/xoops_version.php

$modversion['
comments']['callbackFile'] = 'include/comment_functions.php';
$modversion['
comments']['callback']['approve'] = 'mylinks_com_approve';
$modversion['
comments']['callback']['update'] = 'mylinks_com_update';

modules/mylinks/include/comment_functions.php

function mylinks_com_update($link_id, $total_num){
        $db =& Database::getInstance();
        $sql = '
UPDATE '.$db->prefix('mylinks_links').' SET comments '.$total_num.' WHERE lid '.$link_id;
        $db->query($sql);
}

function mylinks_com_approve(&$comment){
        / / send notification mail
}

10
simeon
Re: adding comments to member profiles
  • 2005/7/31 23:31

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


i´ll bump this up cause im also interested in having comments in profiles.
i did all steps from the wiki howto but i just got this error in userinfo.php
Notice [PHP]: Undefined indexcom_rule in file include/comment_view.php line 38


no comment system is showing.i thought i´ve done everything okay.please show me what could causes this problem

thx

sime

btw. XOOPS 2.2

Login

Who's Online

360 user(s) are online (245 user(s) are browsing Support Forums)


Members: 0


Guests: 360


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits