Free Press Release Submission




MB Publishing Webmaster Resource ::
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin 


E-mail Notifications Stories

 
Post new topic   Reply to topic    MB Publishing Webmaster Resource Forum Index -> Nuke Modules
View previous topic :: View next topic  
Author Message
Colocation
Site Admin
Site Admin


Joined: Jan 07, 2004
Posts: 412

PostPosted: Thu Jul 21, 2005 11:06 am    Post subject: E-mail Notifications Stories Reply with quote

Below is part of the code found in admin/modules/stories.php

What addition is needed to enable an automated e-mail to be sent to the submitter upon admin publishing the story.

Presumably some definitions can be set up in a language file for the e-mail contents ... but for the actual e-mail to be sent to the user?

Code:
function postStory($automated, $year, $day, $month, $hour, $min, $qid, $uid, $author, $subject, $hometext, $bodytext, $topic, $notes, $catid, $ihome, $alanguage, $acomm, $pollTitle, $optionText) {
    global $aid, $ultramode, $prefix, $dbi;
    if ($automated == 1) {
        if ($day < 10) {
       $day = "0$day";
   }
   if ($month < 10) {
       $month = "0$month";
   }
   $sec = "00";
   $date = "$year-$month-$day $hour:$min:$sec";
   if ($uid == 1) $author = "";
   if ($hometext == $bodytext) $bodytext = "";
   $subject = stripslashes(FixQuotes($subject));
   $hometext = stripslashes(FixQuotes($hometext));
   $bodytext = stripslashes(FixQuotes($bodytext));
   $notes = stripslashes(FixQuotes($notes));
   $result = sql_query("insert into ".$prefix."_autonews values (NULL, '$catid', '$aid', '$subject', '$date', '$hometext', '$bodytext', '$topic', '$author', '$notes', '$ihome', '$alanguage', '$acomm')", $dbi);
   if (!$result) {
       return;
   }
   if ($uid == 1) {
   } else {
       sql_query("update ".$prefix."_users set counter=counter+1 where user_id='$uid'", $dbi);
   }
       sql_query("update ".$prefix."_authors set counter=counter+1 where aid='$aid'", $dbi);
   if ($ultramode) {
           ultramode();
   }
   sql_query("delete from ".$prefix."_queue where qid=$qid", $dbi);
   Header("Location: admin.php?op=submissions");
    } else {
   if ($uid == 1) $author = "";
   if ($hometext == $bodytext) $bodytext = "";
   $subject = stripslashes(FixQuotes($subject));
   $hometext = stripslashes(FixQuotes($hometext));
   $bodytext = stripslashes(FixQuotes($bodytext));
   $notes = stripslashes(FixQuotes($notes));
   if (($pollTitle != "") AND ($optionText[1] != "") AND ($optionText[2] != "")) {
       $haspoll = 1;
       $timeStamp = time();
       $pollTitle = FixQuotes($pollTitle);
       if(!sql_query("INSERT INTO ".$prefix."_poll_desc VALUES (NULL, '$pollTitle', '$timeStamp', 0, '$alanguage', '0')", $dbi)) {
      return;
       }
       $object = sql_fetch_object(sql_query("SELECT pollID FROM ".$prefix."_poll_desc WHERE pollTitle='$pollTitle'", $dbi), $dbi);
       $id = $object->pollID;
       for($i = 1; $i <= sizeof($optionText); $i++) {
      if($optionText[$i] != "") {
          $optionText[$i] = FixQuotes($optionText[$i]);
      }
      if(!sql_query("INSERT INTO ".$prefix."_poll_data (pollID, optionText, optionCount, voteID) VALUES ($id, '$optionText[$i]', 0, $i)", $dbi)) {
          return;
      }
       }
   } else {
       $haspoll = 0;
       $id = 0;
   }
   $result = sql_query("insert into ".$prefix."_stories values (NULL, '$catid', '$aid', '$subject', now(), '$hometext', '$bodytext', '0', '0', '$topic', '$author', '$notes', '$ihome', '$alanguage', '$acomm', '$haspoll', '$id', '0', '0')", $dbi);
   $result = sql_query("select sid from ".$prefix."_stories WHERE title='$subject' order by time DESC limit 0,1", $dbi);
   list($artid) = sql_fetch_row($result, $dbi);
   sql_query("UPDATE ".$prefix."_poll_desc SET artid='$artid' WHERE pollID='$id'", $dbi);
   if (!$result) {
       return;
   }
   if ($uid == 1) {
   } else {
           sql_query("update ".$prefix."_users set counter=counter+1 where user_id='$uid'", $dbi);
   }
   sql_query("update ".$prefix."_authors set counter=counter+1 where aid='$aid'", $dbi);
   if ($ultramode) {
           ultramode();
   }
   deleteStory($qid);
    }
}
Back to top
View users profile Send private message Visit posters website Yahoo Messenger
Humpa
Site Admin
Site Admin


Joined: Feb 05, 2004
Posts: 23

PostPosted: Thu Jul 21, 2005 11:34 am    Post subject: Reply with quote

Try this:
Code:
function postStory($automated, $year, $day, $month, $hour, $min, $qid, $uid, $author, $subject, $hometext, $bodytext, $topic, $notes, $catid, $ihome, $alanguage, $acomm, $pollTitle, $optionText) {
    global $aid, $ultramode, $prefix, $dbi;
    if ($automated == 1) {
        if ($day < 10) {
       $day = "0$day";
   }
   if ($month < 10) {
       $month = "0$month";
   }
   $sec = "00";
   $date = "$year-$month-$day $hour:$min:$sec";
   if ($uid == 1) $author = "";
   if ($hometext == $bodytext) $bodytext = "";
   $subject = stripslashes(FixQuotes($subject));
   $hometext = stripslashes(FixQuotes($hometext));
   $bodytext = stripslashes(FixQuotes($bodytext));
   $notes = stripslashes(FixQuotes($notes));
   $result = sql_query("insert into ".$prefix."_autonews values (NULL, '$catid', '$aid', '$subject', '$date', '$hometext', '$bodytext', '$topic', '$author', '$notes', '$ihome', '$alanguage', '$acomm')", $dbi);
   if (!$result) {
       return;
   }
   if ($uid == 1) {
   } else {
       sql_query("update ".$prefix."_users set counter=counter+1 where user_id='$uid'", $dbi);
   }
       sql_query("update ".$prefix."_authors set counter=counter+1 where aid='$aid'", $dbi);
   if ($ultramode) {
           ultramode();
   }
   sql_query("delete from ".$prefix."_queue where qid=$qid", $dbi);
   Header("Location: admin.php?op=submissions");
    } else {
   if ($uid == 1) $author = "";
   if ($hometext == $bodytext) $bodytext = "";
   $subject = stripslashes(FixQuotes($subject));
   $hometext = stripslashes(FixQuotes($hometext));
   $bodytext = stripslashes(FixQuotes($bodytext));
   $notes = stripslashes(FixQuotes($notes));
   if (($pollTitle != "") AND ($optionText[1] != "") AND ($optionText[2] != "")) {
       $haspoll = 1;
       $timeStamp = time();
       $pollTitle = FixQuotes($pollTitle);
       if(!sql_query("INSERT INTO ".$prefix."_poll_desc VALUES (NULL, '$pollTitle', '$timeStamp', 0, '$alanguage', '0')", $dbi)) {
      return;
       }
       $object = sql_fetch_object(sql_query("SELECT pollID FROM ".$prefix."_poll_desc WHERE pollTitle='$pollTitle'", $dbi), $dbi);
       $id = $object->pollID;
       for($i = 1; $i <= sizeof($optionText); $i++) {
      if($optionText[$i] != "") {
          $optionText[$i] = FixQuotes($optionText[$i]);
      }
      if(!sql_query("INSERT INTO ".$prefix."_poll_data (pollID, optionText, optionCount, voteID) VALUES ($id, '$optionText[$i]', 0, $i)", $dbi)) {
          return;
      }
       }
   } else {
       $haspoll = 0;
       $id = 0;
   }
   $result = sql_query("insert into ".$prefix."_stories values (NULL, '$catid', '$aid', '$subject', now(), '$hometext', '$bodytext', '0', '0', '$topic', '$author', '$notes', '$ihome', '$alanguage', '$acomm', '$haspoll', '$id', '0', '0')", $dbi);
   $result = sql_query("select sid from ".$prefix."_stories WHERE title='$subject' order by time DESC limit 0,1", $dbi);
   list($artid) = sql_fetch_row($result, $dbi);
   sql_query("UPDATE ".$prefix."_poll_desc SET artid='$artid' WHERE pollID='$id'", $dbi);
   if (!$result) {
       return;
   }
   if ($uid == 1) {
   } else {
           sql_query("update ".$prefix."_users set counter=counter+1 where user_id='$uid'", $dbi);
           $result_email = mysql_query("select * from ".$prefix."_users where user_id='$uid'");
           $row = mysql_fetch_array($result_email);
           $user_email = $row['user_email'];
           $humpa_subject = "Your Press Release";
         $notify_message = "Congratulations your press release has been published and can be seen at the following url:\n"
                        ."http://www.malebits.com/article$artid.html\n\n"
                        ."Kind regards  MB Publishing http://www.malebits.com\n\nNOTE: Do not reply to this e-mail. It is sent from a robot and not monitored by a human.";
         mail($user_email, $humpa_subject, $notify_message, "From: noreply@yourdomain6867ty65e.com");
   }
   sql_query("update ".$prefix."_authors set counter=counter+1 where aid='$aid'", $dbi);
   if ($ultramode) {
           ultramode();
   }
   deleteStory($qid);
    }
}
Back to top
View users profile Send private message Visit posters website
Colocation
Site Admin
Site Admin


Joined: Jan 07, 2004
Posts: 412

PostPosted: Thu Jul 21, 2005 11:56 am    Post subject: Job Done Reply with quote

Cracking work Humpa!

Functions perfectly - "buts" seem to be not evident.

Users will now recieve e-mail notifications when articles have been published.
Back to top
View users profile Send private message Visit posters website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    MB Publishing Webmaster Resource Forum Index -> Nuke Modules All times are GMT + 1 Hour
Page 1 of 1

 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Home | News Feeds | Release Archive | Web Marketing | Weight Loss | Publish Your Links | Press Release Topics | Free Downloads | Press FAQs | AvantGO | Amazon Store
Webmaster Forums | Search Releases | Press Topics | Feedback | Submit Press Release | Webmaster Surveys | Recommend | Top | Account | PM | Prweb | Free Link Submission | Add Downloads | New Media | Audio School | TOS

The comments are property of their posters, all the rest 2004 - 2008 by MB
Audana Ltd
You can syndicate our news using the file backend.php
Web site engine's code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 1.450 Seconds. -