-
-
Save Mark-H/2001155 to your computer and use it in GitHub Desktop.
<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> |
<?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); | |
} | |
} |
tommls
commented
Mar 8, 2012
via email
I must first learn how to get the whole array of resources for the context, then how to filter that by mode, then how to put that array into an email, then fire it at OnManagerLogout event, to get all the changed items (for the manager session). I'll update you whenever I finish it. Thank you, Tom
I thought I posted here, but looks like it didn't go through..
The frustration comes from you requesting a feature, me making time for it and handing it on a silver plate (well, almost) after which it doesn't even take you five minutes to put forward the next request, which takes an entirely different angle and makes me wonder if I shouldn't have spend time on something that apparently doesn't fit your needs anyway...
So, to answer your tweet, no I'm not mad. At time of my last post I was just frustrated for the above reason. I'm pretty sure someone else will find this gist some day (linked to it from my site) and see it's exactly what they needed.
Found your gist and it was exactly what I needed. Thanks!!!
This is exactly what I needed. Many thanks for this exceptional ground-work!