Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2007-07-25 23:14:58
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
v.0.1.2
Last edited by Mary (2013-01-24 17:24:07)
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
Mary
Thanks very much, have installed and as soon as one of my lazy buggers who call themselves writers get around to posting anything I’ll let you know if it solved our problem.
Richard
“Every artists strictly illimitable country is himself/the artist who has played that country false has comitted suicide” e.e. cummings
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
Hello,
since my upgrade to 4.07 this plugin stopped working. Has anyone a solution?
Update
I was a little bit to fast, three emails got lost, but it was not the fault of the plugin, I think.
It´s working in 4.0.7!
Last edited by whocarez (2009-01-15 11:17:19)
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
Hello,
How would I edit the plug-in to not inform the authors when their articles go live? (I’d rather tell them in a personal email.)
Thanks!
Offline
#20 2009-07-22 14:40:42
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
You can take advantage of one of the plugin’s limitations: when you change the article status to live via the article list screen’s multi-edit functionality, rather than editing the individual article directly, author notifications are not sent.
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
Thanks Mary, good tip.
I was thinking it would be easy just to comment out or delete some lines in the plug in, if only I knew which ones would do the job without messing up the rest of it?
Offline
#22 2009-07-23 03:08:41
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
Sure. Look for:
$GLOBALS['upm_pending_notify'] = 'author';
And comment it out.
And I’ll see about making author notification an option you can turn on and off. :)
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
Great, thank you.
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
great!
<txp:txp_me />
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
Although this plugin is orphaned, but has someone a solution or an alternative with a function notifiing authors in case of setting an article to “Live” in textpattern 4.5.5?
When an article is changed from “Pending” to “Live” status, the article’s author receives a link to view their article on the live site. If the author happens to be a Publisher and set the article to “Live” herself, she does not receive the email.
Thanks!
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
no one?
Offline
#27 2014-01-29 23:10:15
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
I imagine that could do rah_post_versions.
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
ah, thanks, I’ll give it a try …
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
hm, somehow it doesn’t match my needs …
Maybe someone of the developers can take a look on this code and say, where changes have to be made. Publishers are still notified, when an author creates an article, but there should be also a notification for the authors, when the article is published by an editor.
if (txpinterface == 'admin')
{
// i quite hate doing it this way, the write tab's setup is screwy
add_privs('upm_pending_notify_created', '1,2,3,4,5');
register_callback('upm_pending_notify_created', 'article', 'edit');
add_privs('upm_pending_notify_updated_pre', '1,2,3,4,5');
register_callback('upm_pending_notify_updated_pre', 'article', '', 1);
add_privs('upm_pending_notify_updated_post', '1,2,3,4,5');
register_callback('upm_pending_notify_updated_post', 'article', 'edit');
}
//--------------------------------------------------------------
function upm_pending_notify_created()
{
global $ID;
// not trying to create a new article
// begone!
if (!gps('publish'))
{
return;
}
$Status = (int) ps('Status');
if (!has_privs('article.publish') && $Status >= 4)
{
$Status = 3;
}
if ($Status == 3)
{
$ID = (int) $ID;
$Title = ps('Title');
upm_pending_notify_publisher($ID, $Title);
}
}
//--------------------------------------------------------------
function upm_pending_notify_updated_pre()
{
$GLOBALS['upm_pending_notify'] = false;
// article updated
if (gps('save'))
{
$ID = (int) ps('ID');
$Status = (int) ps('Status');
$old_status = (int) safe_field('Status', 'textpattern', "ID = $ID");
// only notify if...
// ...marked as pending
// publishers are notified
// see: upm_pending_notify_updated_post()
if ($Status == 3)
{
$GLOBALS['upm_pending_notify'] = 'publishers';
}
// ...marked as live/sticky and was previously pending
// author is notified
// see: upm_pending_notify_updated_post()
elseif ($Status > 3 and $old_status == 3)
{
$GLOBALS['upm_pending_notify'] = 'author';
}
}
}
//--------------------------------------------------------------
function upm_pending_notify_updated_post()
{
global $upm_pending_notify, $txp_user, $prefs;
if (!$upm_pending_notify)
{
return;
}
$ID = (int) ps('ID');
$Title = ps('Title');
switch ($upm_pending_notify)
{
case 'publishers':
upm_pending_notify_publisher($ID, $Title);
break;
case 'author':
$AuthorID = ps('AuthorID');
$LastModID = ps('LastModID');
upm_pending_notify_author($ID, $Title, $AuthorID, $LastModID);
break;
}
}
//--------------------------------------------------------------
function upm_pending_notify_publisher($ID, $Title)
{
global $txp_user, $prefs;
$publishers = safe_rows_start('RealName, email', 'txp_users', "privs = 1 and name != '".doSlash($txp_user)."'");
if ($publishers)
{
$Title = ($Title) ? strip_tags($Title) : gTxt('untitled');
$author = get_author_name($txp_user);
$subject = upm_pending_notify_gTxt('email_subject_publisher', array(
'{sitename}' => $prefs['sitename'],
'{title}' => $Title,
));
while ($publisher = nextRow($publishers))
{
$body = upm_pending_notify_gTxt('email_message_publisher', array(
'{article_url}' => hu.'textpattern/index.php?event=article&step=edit&ID='.$ID,
'{author}' => $author,
'{publisher}' => $publisher['RealName'],
'{title}' => $Title,
));
upm_pending_notify_mail($publisher['RealName'], $publisher['email'], $subject, $body);
}
}
}
//--------------------------------------------------------------
function upm_pending_notify_author($ID, $Title, $AuthorID, $LastModID)
{
global $txp_user, $prefs;
$author = safe_row('RealName, email', 'txp_users', "name = '".doSlash($AuthorID)."' and name != '".doSlash($txp_user)."'");
if ($author)
{
include_once txpath.'/publish/taghandlers.php';
$Title = ($Title) ? strip_tags($Title) : gTxt('untitled');
$url = permlinkurl_id($ID);
$publisher = get_author_name($txp_user);
$subject = upm_pending_notify_gTxt('email_subject_author', array(
'{sitename}' => $prefs['sitename'],
'{title}' => $Title,
));
$body = upm_pending_notify_gTxt('email_message_author', array(
'{article_url}' => $url,
'{author}' => $author['RealName'],
'{publisher}' => $publisher,
'{title}' => $Title,
));
upm_pending_notify_mail($author['RealName'], $author['email'], $subject, $body);
}
}
//--------------------------------------------------------------
function upm_pending_notify_mail($name, $email, $subject, $body)
{
global $prefs;
if ($prefs['override_emailcharset'])
{
$charset = 'ISO-8859-1';
if (is_callable('utf8_decode'))
{
$name = utf8_decode($name);
$email = utf8_decode($email);
$subject = utf8_decode($subject);
$body = utf8_decode($body);
}
}
else
{
$charset = 'UTF-8';
}
$name = encode_mailheader(strip_rn($name), 'phrase');
$email = strip_rn($email);
$subject = encode_mailheader(strip_rn($subject), 'text');
$sep = !is_windows() ? "\n" : "\r\n";
$body = str_replace("\r\n", "\n", $body);
$body = str_replace("\r", "\n", $body);
$body = str_replace("\n", $sep, $body);
return mail("$name <$email>", $subject, $body,
"From: $name <$email>".
$sep.'X-Mailer: upm_pending_notify Textpattern plugin'.
$sep.'Content-Transfer-Encoding: 8bit'.
$sep.'Content-Type: text/plain; charset="'.$charset.'"'.
$sep
);
}
//--------------------------------------------------------------
function upm_pending_notify_gTxt($what, $vars = array())
{
$lang = array();
$lang['email_subject_author'] = '[{sitename}] Article published: {title}';
$lang['email_message_author'] = <<<eml
Dear {author},
{publisher} has published your article:
{title}
{article_url}
eml;
$lang['email_subject_publisher'] = '[{sitename}] Article submitted: {title}';
$lang['email_message_publisher'] = <<<eml
Dear {publisher},
{author} has submitted an article for review:
{title}
{article_url}
eml;
return strtr($lang[$what], $vars);
}
Offline
Re: [plugin] [ORPHAN] upm_pending_notify: Pending article notification
no one?
function upm_pending_notify_publisher($ID, $Title) works, but function upm_pending_notify_author($ID, $Title, $AuthorID, $LastModID) not, where I have to make changes?
Thanks!
Offline