2015-10-16, 01:12 PM
Hi,
There are couple Plugin available that enable us to send automatic welcome PM to new member upon registration but that is not what I need.
I want to send an automatic PM from admin to a member when a function on my custom page gets executed.
For example, something like that:
Is there any quick and easy method to accomplish this?
Regards
There are couple Plugin available that enable us to send automatic welcome PM to new member upon registration but that is not what I need.
I want to send an automatic PM from admin to a member when a function on my custom page gets executed.
For example, something like that:
<?php
define("IN_MYBB", 1);
require_once "../global.php";
$data = '';//some data
$result = $db->query('
SELECT * FROM '.TABLE_PREFIX.'test
WHERE `data` = "'.$db->escape_string($data).'"
LIMIT 1');
if($result == TRUE){
$db_r = mysqli_fetch_assoc($result);
if ($db_r['data'] == $data){
echo "Already exists";
exit();
} else {
$new_record = array(
"uid" => intval($mybb->user["uid"]),
"username" => $db->escape_string($mybb->user["username"]),
"data" => $db->escape_string($data)
);
$db->insert_query('test', $new_record);
//and send PM to the user that new record was successfully created.
}
?>
Is there any quick and easy method to accomplish this?
Regards