Problem with action override
Author | Posts |
---|---|
May 13, 2013 at 8:17 am 3535 | |
Tareq Hasan | Hi,
First of all - that is great plugin.
I have a problem with add_action...
I want to send e-mail to administrator when task is added without anybody in assign.
My code:
The problem is that the mail reaches two times. How I can fix that? |
May 14, 2013 at 7:58 am 3585 | |
Tareq Hasan | Are you sure this mail reaches twice? It shouldn’t, otherwise the default mail also should be sent twice. |
May 15, 2013 at 12:05 pm 3650 | |
kpodemski | Unfortunately, after adding the add_action all messages reach several times. |
May 15, 2013 at 3:06 pm 3680 | |
Tareq Hasan | Thats really weird, every hooks should be fired only once. |
May 15, 2013 at 3:48 pm 3681 | |
kpodemski | Yep, my goal is to have e-mail to blog admin after every action, after add task, after add comment etc. |
May 16, 2013 at 9:41 pm 3726 | |
kpodemski | You could look at it? Unfortunately, for some reason, the action is called twice, and I do not want to make changes directly in your code and then lose them after the update… |
May 16, 2013 at 9:49 pm 3729 | |
Tareq Hasan | Haven’t found the time yet, my be try not using the |
May 16, 2013 at 10:08 pm 3731 | |
kpodemski | Ok, I test & changed the subject in its my overwritten function that uses like you handled wp_mail… The conclusion is that they are sending two emails, the first being sent my way, and your second. Looks like the WordPress doesn’t remove action and my action is second added to same hook 🙁 !!!UPDATE!!! I get it! Instead of remove_action I use that function: https://github.com/herewithme/wp-filters-extras/ First example working fine. |
May 16, 2013 at 10:14 pm 3733 | |
Tareq Hasan | Try increasing or decreasing the priority of the remove action hook. |
May 16, 2013 at 10:23 pm 3735 | |
kpodemski | Unfortunately, another problem is that after edit project even selected the “Notify collaborators” added the co-worker does not receive notification with link to project etc. I see there is no function for “cpm_project_update” hook, of course I’m going to add that function by myself but I think is must have for next version of plugin. |
May 16, 2013 at 10:28 pm 3736 | |
Tareq Hasan | Why don’t you fork the plugin in github and send a pull request? Also if you think there should be some features in the plugin, feel free to contribute. |
May 16, 2013 at 10:36 pm 3737 | |
kpodemski | Yep, I’ll do it as soon as I finish my code that improves your plugin. The elements to be added in my version: |
May 16, 2013 at 10:41 pm 3738 | |
Tareq Hasan | Also take a look here |