Notice: CMSB v2.16 Beta!

34 posts by 6 authors in: Forums > CMS Builder
Last Post: August 28, 2012   (RSS)

By Djulia - August 24, 2012

>I can update emailTemplate_load()
It would be perfect! :)

>PS: Try emailTemplate_loadFromDB()
Yes, I think that it is advantageous to use this function.

The only thing which would oppose the use of emailTemplate_loadFromDB(), it is the use of an additional table.

Thanks!

Djulia

Re: [Djulia] Notice: CMSB v2.16 Beta!

By Dave - August 24, 2012

Try adding this line (in red) to /lib/common.php in emailTemplate_load()

function emailTemplate_load($options) {
...
$emailHeaders = array(
'from' => $FROM,
'to' => $TO,
'subject' => $SUBJECT,
'html' => $HTML,
);
if (array_key_exists('logging', $options)) { $emailHeaders['logging'] = $options['logging']; }
return $emailHeaders;
}


Also, note that logging is off by default and nothing will be logged at all unless you turn it on.

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

By Djulia - August 24, 2012

It is perfect! :)

Thanks again!

Djulia

Re: [Djulia] Notice: CMSB v2.16 Beta!

By Toledoh - August 24, 2012

LOL. I don't understand what half (3/4?) of this thread means, but it sounds like iTools have done a great job again. Thanks!
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Notice: CMSB v2.16 Beta!

By Djulia - August 25, 2012 - edited: August 25, 2012

Hi Tim,

Here an example which can help you to understand with my alertAdminLogin plugin.

If you activate option Send & Log, the email will be recorded in the cms__outgoing_mail table.

You must comment the lines for headers array with 'logging' = TRUE, otherwise the email is not sent.
If, you do not wish that the emails be recorded in the cms__outgoing_mail table, you must put 'logging' = FALSE.

In this example, I use the function sendMessage(). But, it would be possible to use the function emailTemplate_load(). I use this function in my AlertRecordSaved plugin. You can perhaps use this example for your try.

Dave modified the function so that it is possible also to use 'logging' = FALSE/TRUE.

Dave recommends to try the function emailTemplate_loadFromDB() which is more comfortable.
I think that Website Membership can help you to understand his use.

Djulia :)
Attachments:

alertadminlogin_002.php 2K

By Djulia - August 25, 2012 - edited: August 25, 2012

I think that I found the origin.

In common.php, it is necessary to remove the redundancy of code:

//replaces placeholders


These lines are normally replaced by the emailTemplate_replacePlaceholders() function ?

I also replaced placeholderListAsText and placeholderList with textPlaceholderList.

also : $defaultPlaceholders['settings.adminUrl'] = @$GLOBALS['SETTINGS']['adminUrl'];

That functions correctly for me.

Djulia

By Djulia - August 25, 2012

>No, only if you had set backgroundSend = 1.

Excuse my curiosity, but is it possible to give a value to backgroundSend since the function ?


Thanks again!

Djulia

Re: [Djulia] Notice: CMSB v2.16 Beta!

By Dave - August 27, 2012

Hi Djulia,

>>No, only if you had set backgroundSend = 1.

>Excuse my curiosity, but is it possible to give a value to backgroundSend since the function ?

Can you explain more, I'm not sure what you mean. If you don't specify a value then backgroundSend defaults to 0.

I added an option to emailTemplate_loadFromDB() in /lib/common.php to pass logging through as well (new code in red):

$passThruFields = array('attachments','headers','logging');
Dave Edis - Senior Developer
interactivetools.com

Re: [Djulia] Notice: CMSB v2.16 Beta!

By Dave - August 27, 2012

>In common.php, it is necessary to remove the redundancy of code

Thanks Djulia, those fixes you mentioned are exactly what was missing. I'll update the code, do some more testing, and release that for the next beta/release.

Thanks!
Dave Edis - Senior Developer
interactivetools.com