Tutorial for plugin ?

By Djulia - April 10, 2010

Hello,

You can check if the email of the administrator is correct in CMSB ( General Settings > Email Settings) ?

You can also check that the function mail works correctly ?
http://www.php.net/manual/en/function.mail.php

Djulia

Re: [Djulia] Tutorial for plugin ?

I'm building my own plugin that will allow the admin to send a pre-formatted email to new users once they have activated their account. I'd like to display a message after the email has been sent. Can I call an alert function and pass it some text for the message so it will show on top of the page like the "Record saved." message?

Thanks for your help
Mike
Graphic Lingoes
www.graphiclingoes.com

Re: [GraphicLingoes] Tutorial for plugin ?

By Djulia - September 8, 2010

Hi [font "Verdana"]Mike,

It is not preferable to create your function with (in) the Membership plugin ?

If not, you can detail your approach ?

Thanks,
Djulia

Re: [Djulia] Tutorial for plugin ?

By GraphicLingoes - September 8, 2010 - edited: September 8, 2010


Hi [font "Verdana"]Mike,

It is not preferable to create your function with (in) the Membership plugin ?




Hi Djulia,

I'm not creating a function in the Membership Plugin, I have created my own plugin and uploaded it to the plugins folder and activated it. My question is, is there a function that I can call that will allow me to reproduce a confirmation alert such as the "Record saved." alert that shows at the top of the screen when a record is saved. I know what css class is being used to create the look and feel of the alert and I have been able to echo html code with the css class applied to a div to show my alert at the bottom of the screen, but I would rather show the alert at the top. Any ideas on how to do this, right now in my custom plugin I'm using applyFilter to "execute_econds" hook so html I echo shows in the footer.

Does this make sense?
Thanks

Graphic Lingoes
www.graphiclingoes.com

Re: [GraphicLingoes] Tutorial for plugin ?

Okay, so I found the function "notice($message)" that sets the notice for the "displayAlertsAndNotices()" function but when I add that to my code it doesn't seem to work? I'm adding "notice("Email sent.")". Any ideas?
Graphic Lingoes
www.graphiclingoes.com

Re: [Djulia] Tutorial for plugin ?

By GraphicLingoes - September 8, 2010 - edited: September 8, 2010

Thanks Djulia,

I came up with something very similar, but have also been stumped as to how to get it to show at the top of the screen. Logic would tell me that if I use the notice($message) approach that the displayAlertsAndNotices() function should know what to show, but my guess is the clearAlertsAndNotices() function is being called somewhere after I set the message with notice($message).
Graphic Lingoes
www.graphiclingoes.com

Re: [GraphicLingoes] Tutorial for plugin ?

Okay, figured it out. Chris had explained to me in an earlier email to check out the hook names through out the system and I didn't comprehend it until now, anyway to get the message I needed I used the hook for "viewer_postinit" so in my plugin I have

addFilter('viewer_postinit', ena_setEmailSentNotice);

function ena_setEmailSentNotice() {
if(isset($_GET['_pluginAction']) && $_GET['_pluginAction'] == 'sendEmail') {
return notice('Email sent.');
}

This will not be the final code, but this is how I got the notice to show at the top of the page.
Graphic Lingoes
www.graphiclingoes.com

Re: [GraphicLingoes] Tutorial for plugin ?

By Djulia - September 8, 2010

Great ! :)

Your plugin seems interesting ! It will be public ?

There is a filter for record_saved_message (?).

Djulia

Re: [Djulia] Tutorial for plugin ?

Yes I'll make it public once it's completed. I saw the hook for "saved_message..." but that only works if there is a "save" variable in the url and since the action wasn't really a save I didn't want to cludge it together to work that way.
Graphic Lingoes
www.graphiclingoes.com