Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.
Grimloch

Request: Help with PM functions

by Grimloch, Last updated on 10 months ago in Modifications and Requests - 8
I will try to explain my problem w/o a lengthy dissertation. My Newsletters infusion works perfectly fine but I decided to add a 'pm to admin' function when subscriptions are set to 'public'. The actual public subscription works fine but I cannot get the script to send a pm to the admin no matter what I try. Here is the code I'm using at the moment and BTW this code works perfectly when my Site Statistics panel sends a birthday pm to a user.

if (isnum(isset($_REQUEST['id'])) AND isset($_REQUEST['activate'])) {
   echo "<div style='text-align:center'>\n";
   $get_vc = dbquery("SELECT * FROM ".DB_NEWS_LETTER_SUBS." WHERE nl_sub_id='".$_REQUEST['id']."'");
   $get_vca = dbarray($get_vc);
   $get_vcr = dbrows($get_vc);
   if ($get_vcr != 0) {
      if ($get_vca['nl_sub_stat'] == 0) {
         $get_vn = dbquery("SELECT * FROM ".DB_NEWS_LETTER_VALIDATE." WHERE validate_code='".$_REQUEST['activate']."'");
         $get_vna = dbarray($get_vn);
         $get_vnr = dbrows($get_vn);
         if ($get_vnr != 0) {
            $result = dbquery("UPDATE ".DB_NEWS_LETTER_SUBS." SET nl_sub_stat='1' WHERE nl_sub_id ='".$_REQUEST['id']."'");
            $result = dbquery("DELETE FROM ".DB_NEWS_LETTER_VALIDATE." WHERE validate_code='".$_REQUEST['activate']."'");

// send pm to site admin
$pm_send = dbquery("SELECT nl_sub_id, nl_sub_mail, nl_sub_name, nl_sub_stat FROM ".DB_NEWS_LETTER_SUBS." WHERE nl_sub_stat='1' AND nl_sub_id='".$_REQUEST['id']."'");
if (dbrows($pm_send) != 0) {
require_once INCLUDES."infusions_include.php";
   while($data = dbarray($pm_send)) {
      $sendr = $data['nl_sub_mail'];
      $pnam = $data['nl_sub_name'];
      $recvr = 1;
   $sndit = ($locale['nl_498']."".$pnam.$locale['nl_499']);
send_pm($recvr, $sendr, $locale['nl_497'], $sndit);
   }
}
// end pm send


I have tried the $recvr variable as ($settings['siteemail'] and also just "webmaster@whisperwillow.com") . I realize that code taken out of context can be hard to interpret/follow and I will post the entire script if needed. Right after the code: if (dbrows($pm_send) !=0) if I do this: echo dbrows($pm_send); exit; .. it stops the script and prints a 1 to the screen so I know it's doing the dbquery and getting a result. Any help would be appreciated very much. I am using Fusion 7.02.07

Merged on 05/28/2018:
OK ! I figured out why it won't work ! The '$sendr' variable which gets input to 'infusions_include.php' as the '$from' variable, is a public user who has an email address but NO system user id. I don't know how to fix that except maybe using one of my alternate logins as the sender. That should work.
Energy can neither be created nor destroyed; only transformed !
You can view all discussion threads in this forum.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.