[SOLVED by Viebig] Custom UDT + Email Event after updating GC Block

A place to make for-pay "CMS made simple" job offerings
Locked
jwaldeck

[SOLVED by Viebig] Custom UDT + Email Event after updating GC Block

Post by jwaldeck »

Hi Guys! I've tried to post it all around the forum and even contacted some of the administrators, but couldn't get a response yet! :(

I successfully implemented this "Custom Content" rule as a Global Content block for my FE Users (like Calguy suggested here http://forum.cmsmadesimple.org/index.ph ... 416.0.html), but i need something a little more advanced and i couldn't think of how to apply it:

Sending an email to User after page update: Is it possible that, as soon as i finish editing this block and press "Submit" or "Apply", the system finds a user called "loginname", since i'm using the rule "$customcontent_loginname", and asks me (via ALERT or automatically via event after GCB update) if i want to send this user an email (any general txt would work, not custom), telling him that the page was updated?

I thought maybe some javascript "onSubmit", that activates a PHP SENDMAIL script... But since i'm not a developer, i don't know you exactly to achieve this, if there's a simple way to do it.

Or even simpler creating a UDT and adding it to the update event of "Global Content Block Update". But I can't make the system associate the GCB name with a existing FEU user to send him an email... Urgh!

Would that be possible? I really need it and am willing to pay if necessary.

Budget: USD 80,00 (via Paypal)

Thanks in advance!
jw
Last edited by jwaldeck on Thu Aug 21, 2008 2:19 am, edited 1 time in total.
SimonSchaufi

Re: Custom UDT + Email Event after updating GC Block

Post by SimonSchaufi »

Hi!
I have experience in UDTs and i know how to send Emails like that. If Mark cannot help you, i will!
jwaldeck

Re: [SOLVED by Viebig] Custom UDT + Email Event after updating GC Block

Post by jwaldeck »

Thanks to Viebig (http://forum.cmsmadesimple.org/index.php?action=profile;u=8724) this UDT was created, as follows:

Code: Select all

$username = $_POST['htmlblob'];
$assunto  = "Novo";
$bodytext = "Você for adicionado ".$username;

global $gCms;
$db = &$gCms->GetDb();
$sql = "SELECT `id` FROM `".cms_db_prefix()."module_feusers_users` WHERE `username`='".$username."'";
$result = $db->Execute($sql);
if($result)
{
	$row = $result->FetchRow();
	$sql = "SELECT `data` FROM `".cms_db_prefix()."module_feusers_properties` WHERE title='e-mail' AND userid = '".$row['id']."'";
	$result = $db->Execute($sql);
	$row = $result->FetchRow();
	$email = $row['data'];
}
$cmsmailer =& $gCms->modules['CMSMailer']['object'];
$cmsmailer->AddAddress($email);
$cmsmailer->SetBody($bodytext);
$cmsmailer->IsHTML(false);
$cmsmailer->SetSubject($assunto);
$cmsmailer->Send();
How to use it:

a) Create a "User Defined Tag" and save it
b) Go to "Extensions >> Events" and add this UDT to the "AddGlobalContentPost" event

Now, every time I add a new "Global Content Block" which has a existing FEU username, it sends him an email. This now can be added to the update event as well...

Remember to change the "WHERE title="e-mail" to your correct FEU input name.

Viebig, tks again for your help!
jw
viebig

Re: [SOLVED by Viebig] Custom UDT + Email Event after updating GC Block

Post by viebig »

great! assunto means subject
Locked

Return to “Help Wanted (commercial)”