Warning: include(.../cache/template/template63867.php): failed to open stream: No such file or directory in /home/codingta/public_html/includes/vb5/template.php on line 328 Warning: include(): Failed opening '.../cache/template/template63867.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/codingta/public_html/includes/vb5/template.php on line 328 Comment Notification - Coding-Talk

Comment Notification

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Comment Notification

    Hey guys, I'm trying to notify other members who commented under a status about the others who commented under the same status. For example, to notify me that "john commented under kevin's status" since i would have commented too. It works, but the problem is that it does not notify everyone who commented under the status, only the first person who commented is notifed about the others. How can i achieve this?
    PHP Code:
    $shti mysql_fetch_array(mysql_query("SELECT shouter, shout, id FROM ibwf_shouts WHERE id='".mysql_real_escape_string($shtid)."'"));
    $chorn mysql_fetch_array(mysql_query("SELECT max(byuid) FROM ibwf_notify WHERE actid='".mysql_real_escape_string($_GET["shtid"])."' AND myaction='shout-comment' ORDER BY byuid LIMIT 100"));
    if(
    $chorn[0]!=getuid_sid($sid))

    {
    $msg "<a href="main.php?action=viewuser&amp;who=$uid">".htm lspecialchars(getnick_uid("$uid"))."</a> Commented on ".htmlspecialchars(getnick_uid("$shti[0]"))." shout <a href="lists.php?action=moresht&amp;shtid=".$shti[2]."#comnu">&quot;".substr($shti[1],0,40)."&quot;</a>[br/]Auto Notification Msg";
    autopm($msg$chorn[0], 1);

    Last edited by tupac; 17.05.18, 21:25.

  • #2
    Something like:
    Code:
    $shti = mysql_fetch_array(mysql_query("SELECT shouter, shout, id FROM ibwf_shouts WHERE id='".mysql_real_escape_string($shtid)."'"));
    $rows = mysql_query("SELECT byuid FROM ibwf_notify WHERE actid='".mysql_real_escape_string($_GET["shtid"])."' AND myaction='shout-comment'");
    while ($row = mysql_fetch_array($rows))
    {
        if($row[0]!=getuid_sid($sid))
        {
            $msg = "<a href="main.php?action=viewuser&amp;who=$uid">".htm lspecialchars(getnick_uid("$uid"))."</a> Commented on ".htmlspecialchars(getnick_uid("$shti[0]"))." shout <a href="lists.php?action=moresht&amp;shtid=".$shti[2]."#comnu">&quot;".substr($shti[1],0,40)."&quot;</a>[br/]Auto Notification Msg";
            autopm($msg, $row[0], 1);
        }
    }
    Note: It maybe wrong as I am guessing at what the table names do.

    Comment


    • #3
      That's ok bro, the essense of it is how to make sure other users that also commented on the shout also receives the same message you can even use your own example

      Comment


      • #4
        It still doesn't send the notification to others who would have commented, only the first person that commented gets notifications of who else commented...

        Comment


        • #5
          what is the comments table? is it ibwf_shouts or ibwf_notify or something else?

          Comment


          • #6
            ibwf_shouts have the person who makes the shouts ibwf_notify has the user id who makes the shout with the shout id so that the notifcation can be sent, but the comment itself is originally stored in ibwf_comments but ibwf_notify tells me who is the shouter all those who commented on my shout. I just would like to use it the same way to tell everyone else who comments, but it only tells the first person who comments

            Comment


            • #7
              I don't think ibwf_notify table is needed.

              It would be on the lines of:
              Code:
              $shti = mysql_fetch_array(mysql_query("SELECT shouter, shout, id FROM ibwf_shouts WHERE id='".mysql_real_escape_string($shtid)."'"));
              $rows = mysql_query("SELECT byuid FROM ibwf_comments WHERE shtid='".mysql_real_escape_string($shtid)."'");
              while ($row = mysql_fetch_array($rows))
              {
                  if($row[0]!=getuid_sid($sid))
                  {
                      $msg = "<a href="main.php?action=viewuser&amp;who=$uid">".htm lspecialchars(getnick_uid("$uid"))."</a> Commented on ".htmlspecialchars(getnick_uid("$shti[0]"))." shout <a href="lists.php?action=moresht&amp;shtid=".$shti[2]."#comnu">&quot;".substr($shti[1],0,40)."&quot;</a>[br/]Auto Notification Msg";
                      autopm($msg, $row[0], 1);
                  }
              }
              shtid and byuid on ibwf_comments probably needs changing to what ever names they are.

              Comment


              • #8
                Thanks alot bro this worked well

                Comment


                • #9
                  The only issue is that it sends the message also to the person who created the shout E.G Tupac commented on tupac's shout. How can it stop that?

                  Comment


                  • #10
                    if($row[0]!=getuid_sid($sid)) should be blocking that from happening so I am not sure why its not working. (Would need to see full code to see what is wrong)

                    There is another problem where notification will be sent twice if someone has commented twice which can be fixed with DISTINCT:
                    $rows = mysql_query("SELECT DISTINCT byuid FROM ibwf_comments WHERE shtid='".mysql_real_escape_string($shtid)."'");

                    Comment


                    • #11
                      Something else replies will do the job.

                      Comment

                      Working...
                      X