Tutorial for plugin ?

By Djulia - September 8, 2010

This functions perfectly for me.

addFilter('record_saved_message', '_custom_record_saved_message', null, 1);

function _custom_record_saved_message($record_saved_message) {
return "Record saved ! Email sent !";
}

Djulia

Re: [Djulia] Tutorial for plugin ?

When did you call it? Did you have to save the record to get the message? I've added a link to the list so the message is a response to a click on the link not a save.
Graphic Lingoes
www.graphiclingoes.com

Re: [Djulia] Tutorial for plugin ?

By Chris - September 8, 2010

Hi folks,

It is thoroughly awesome that you two are working together and writing plugins!

It seems like you two have everything figured out already!

@GraphicLingoes: Using 'admin_head' instead of 'viewer_postinit' might be safer, since it's the closest hook before the call to displayAlertsAndNotices() in lib/menus/header.php

If you are super curious, you could try to figure out when and why your notice was getting cleared by either dumping out a backtrace from clearAlertsAndNotices(), or adding a trace lines before each call to it. Of course, that's not really going to help you solve the problem any better, maybe just understand why you had to solve it. ;)


Please let me know if either of you have any questions and keep up the great work! :D
All the best,
Chris

Re: [chris] Tutorial for plugin ?

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

Hi Chris,
thanks for the suggestion ("admin_head"). I've updated my code. I actually tried that earlier before I really understood the difference between addFilter and addAction and I kept getting wierd results because I wasn't returning anything with addFilter. Works perfectly now, thanks!
Graphic Lingoes
www.graphiclingoes.com

Re: [Djulia] Tutorial for plugin ?

@Djulia the plugin is public now see forum for more info. Thanks again for your help.

All the best, Mike.
Graphic Lingoes
www.graphiclingoes.com

By Djulia - September 10, 2010 - edited: September 10, 2010

Hi Mike,

Great work! :)

For my needs, I will add a condition :
if ($tableName != "accounts" || $record['isAdmin'] != 0) { return $actionLinks; }

It would be also interesting to add a condition for not to display the link if the email were already sent (?).
---
Thanks again for your contribution.

Djulia

Re: [Djulia] Tutorial for plugin ?

@Djuila I have an idea for how to make your suggestion work. I'll work on it today and upload the updated code later.

-
Graphic Lingoes
www.graphiclingoes.com

Re: [Djulia] Tutorial for plugin ?

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

Hi @Djuila,

Attached to this post is version 1.01 of the email new acount activated link plugin.

Changes:
Added code to plugin to check account to see if "email sent" field is true. If it is true the link is greyed out in the list and not clickable. NOTE: there is code in the comments on how to hide link completely if you need to.

Requirements:
To make this function work you must add a checkbox field to your accounts section called "activation_email_sent" If you type "Activation Email Sent" in the section editor it will create the "activation_email_sent" field name for you.

Hope this works for you!
Mike
Graphic Lingoes
www.graphiclingoes.com

By Chris - September 10, 2010

Awesome! :D
All the best,
Chris