-
-
Save exside/5073352 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Hi there!</p> | |
<p>The resource [[+pagetitle]] (ID: [[+id]]) has been [[+mode]].</p> | |
<p>You can login to the manager at www.mysite.com/manager/ to review and if needed publish the resource.</p> | |
<p>Thank you!</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// untested | |
// Update these if you have to | |
$usergroup = 1; // user group ID (1=admin) | |
$chunkname = 'notificationtpl'; // name of chunk for the email notification | |
$emailoptions = array( | |
'from' => $modx->getOption('emailsender'), | |
'fromName' => 'Resource Notification', | |
'subject' => 'Nofication of Created or Updated Resource', | |
'html' => true, | |
); | |
// No need to update below (unless I typo-ed) | |
$placeholders = $resource->toArray(); | |
$placeholders['mode'] = ($mode == 'upd') ? 'updated' : 'created'; | |
$message = $modx->getChunk($chunkname,$placeholders); | |
$userIds = $modx->getCollection('modUserGroupMember', array('user_group' => $usergroup)); | |
foreach ($userIds as $userId) { | |
$user = $modx->getObject('modUser',$userId->get('member')); | |
if ($user) { | |
$user->sendEmail($message, $emailoptions); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment