Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Aiheen aloitti: jackregan - joulukuu 27, 2007, 10:49:51 AP

Otsikko: Profile Comments - notification of post!
Kirjoitti: jackregan - joulukuu 27, 2007, 10:49:51 AP
I am using the Profile Comments mod, which I love, but I am finding that often people post comments on each other's profiles and people don't realise!

I guess my users are used to Facebook! But is there a way to notify people than a comment has been made on their profile??

Thanks
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: shadow82x - joulukuu 27, 2007, 12:40:47 IP
Lainaus käyttäjältä: jackregan - joulukuu 27, 2007, 10:49:51 AP
I am using the Profile Comments mod, which I love, but I am finding that often people post comments on each other's profiles and people don't realise!

I guess my users are used to Facebook! But is there a way to notify people than a comment has been made on their profile??

Thanks
I think it would be best if you requested this at smfhacks.com. :) Where the mod was created.

I like your thinking though.
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: karlbenson - joulukuu 27, 2007, 01:26:07 IP
A logical request.

I'm sure it will be well received.
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: jackregan - joulukuu 27, 2007, 02:35:58 IP
I have actually spent a lot of the day messing with the profile comments mod and I have made it so that you can click links in each post to: return the comment to the sender, view the sender's gallery photos and send a PM.

I would also love to display the avatar and group stars of each member.

I might sniff around SMF-hacks as you all say.
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: vbgamer45 - joulukuu 27, 2007, 08:57:03 IP
I am thinking about it heh. I keep all the good changes for my forums. I have it right now to a pm to the user when they get a comment.
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: Dragooon - joulukuu 28, 2007, 02:04:45 AP
Thats so cruel and cool :P
But I think I can do something like this, like send a Mail, or send a PM.
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: karlbenson - joulukuu 28, 2007, 08:42:04 AP
lol vb.
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: jackregan - joulukuu 28, 2007, 09:06:47 AP
Well, the good news is that I have figured it out and ironed out a bug as well.

PLEASE READ THE WHOLE OF THIS BEFORE YOU DO ANYTHING

The official thread on the mod says that you open sources/Profilecomments.php and find this

Lainaa
function Add2()
{
    global $db_prefix, $ID_MEMBER, $sources;
    //Guests can't do this stuff
    is_not_guest();
    isAllowedTo('pcomments_add');

    @$subject = htmlspecialchars($_POST['subject'],ENT_NOQUOTES);
    @$comment = htmlspecialchars($_POST['comment'],ENT_NOQUOTES);
    @$userid = (int) $_POST['userid'];

    //if($subject == '')
    //  fatal_error('You need to enter a comment subject.');

    if($comment == '')
        fatal_error('You need to enter a comment.');

    if($userid == '')
        fatal_error('No profile selected.');

    $commentdate = time();

    $request =  db_query("INSERT INTO {$db_prefix}profile_comments
            (ID_MEMBER, comment, subject, date, COMMENT_MEMBER_ID)
        VALUES ($ID_MEMBER,'$comment','$subject', $commentdate,$userid)", __FILE__, __LINE__);

...and then it says that after that you add this:

Lainaa
global $sourcedir;
       

require_once($sourcedir . '/Subs-Post.php');

$subject = 'You have a new profile comment';

$message = 'This is an automated alert that you have a new comment on your profile!';

return sendpm(array('to' => array($_POST['userid']), 'bcc' => array()), $subject, $message);

Doing that puts this new code just above the part of the add2 function which redirects you back to the person's profile afterwards.

The problem is though that the redirect doesn't work with this code. It just takes you to a blank page whcih is just your index.template.php and nothing else, so I have tweaked it a bit and this works for me:

Firstly, in that new code you just added in, remove the word 'return' on the last line, so the new code now becomes:

Lainaa
global $sourcedir;
       

require_once($sourcedir . '/Subs-Post.php');

$subject = 'You have a new profile comment';

$message = 'This is an automated alert that you have a new comment on your profile!';

sendpm(array('to' => array($_POST['userid']), 'bcc' => array()), $subject, $message);

...and that seems to work just fine. It sends a PM to the person whose profile you have just commented and if they have the option enabled, it also E-mails them to notify them of the PM.

It then takes you back to their profile!

N.B. I also changed the subject and the content of the message it sends too, which is simple enough to do.

Next, I need to figure out putting avatars and user stars in comments people leave...
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: Andy134 - joulukuu 31, 2007, 12:53:48 AP
Woo hoo! Works perfectly. Thanks for that :D
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: myaicons - tammikuu 21, 2008, 10:21:14 AP
this is awsome! 

but i can see how pesky pms could get aftera few dozen comments.... you know how people love their comments  :P
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: fecu2008 - helmikuu 22, 2008, 08:11:12 IP
Man, good stuff!! Thank you!
Otsikko: Re: Profile Comments - notification of post!
Kirjoitti: myaicons - helmikuu 23, 2008, 11:38:05 AP
if someone can add a tick box in the profile settings so they can turn on or off the notifications for the comment PMs ... would be the best!