Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9241161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:19:16+00:00 2026-06-18T08:19:16+00:00

I have been trying to code a notification system for a profile wall script

  • 0

I have been trying to code a notification system for a profile wall script I made a long time ago for a forum.
The trouble I have is, that I am trying to only send one PM to the people who fit the criteria for the PM, but I also have 2 select statements in MYSQL to find the people who should be PM’d.

I have 2 tables to select from… log_statuses and log_status_replies
I am trying to achieve this.
I want it to notify everyone who has commented only ONCE! Also the persons wall it belongs to and the person who written the status on the persons wall, but not yourself if you written it.
Kinda complex that’s why I am struggling to get this right…

Here is my code for it to search through who commented and send them a PM.
How would I also do the checks for who written the status and who’s wall it is, without it sending a duplicate PM if they have commented aswell.

Otherwise they would receive a PM because they have commented and because its their status/wall.
I hope you understand that, kinda hard to explain.

Here is my source code.. I would love anyone who could help..

$query = $smcFunc['db_query']('', '
    SELECT id_member, id_poster
    FROM {db_prefix}log_statuses
    WHERE id_status = {int:id_status}',
    array(
        'id_status' => $status,
    )
);
   list($id_member,$id_poster) = $smcFunc['db_fetch_row']($query);


if ($id_poster != $ucomment || $id_member != $ucomment)
{   

    $query2 = $smcFunc['db_query']('', '
        SELECT DISTINCT id_member
        FROM {db_prefix}log_status_replies
        WHERE id_status = {int:id_status}',
        array(
            'id_status' => $status,
        )
    );

    while ($row = $smcFunc['db_fetch_assoc']($query2)) {
        if ($row['id_member'] != $ucomment)
        {
            $pm_recipients = array(
                'to' => array($row['id_member']),
                'bcc' => array(),
            );

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

            $notify_body = $txt['status_body'] . '[iurl]' .$scripturl . '?action=profile;area=showstatus;s=' . $status . '[/iurl]';
            $notify_body = str_replace("%poster",$context['user']['name'],$notify_body);

            $pm_from = array(
                        'id' => $ucomment,
                        'username' => '',
                        'name' => '',
                    );

            sendpm($pm_recipients,$txt['status_subject'] , $notify_body,false,$pm_from);
        }       
    }           
}   

$id_member is the persons wall, $id_poster is the person who posted on the wall.
$ucomment is the person who is posting..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:19:16+00:00Added an answer on June 18, 2026 at 8:19 am

    Solved.. I built an array from the while, then checked if the value exists from the comments table when checking the other table to see who to PM also..

        $id_comment = array();
                while ($row = $smcFunc['db_fetch_assoc']($query2)) {
                $id_comment[] = $row['id_member'];
        }
    
    if (!in_array($id_poster, $id_comment) && !in_array($id_member, $id_comment)) {
         //Send PM
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to debug my code whenever I had free-time for the
I have been trying to write some code in Scala to read a file
I have been trying to find a code snippet to do an unsharp mask
I have been trying to access the below code DECLARE N_DEPTNO DEPT.DEPTNO %TYPE :=&DEPT_NUM;
I have been trying to extract e-mail addresses from the following code for quite
I have been trying to find out why the following lines of code do
I have been trying to use the hibernate dialect for SQLite from http://code.google.com/p/hibernate-sqlite/ in
I have been trying to develop a Core Data piece of code and have
I am using python to code. I have been trying to webscrape the names,
Good evening, I have been trying to wrap my head about this, below, code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.