Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Better Notifications to work with WP User Frontend Pro WordPress

  • SOLVED

I'm looking for a snippet that allows the plugin (https://wordpress.org/plugins/bnfw/) to work with WP UsercFront End Pro.

For example when a post is created or updated with WP Front End Pro BNFW doesn't pick up that a new post has been created or updated etc. (this is just an example, IMPORTANT: I want ALL of BNFW notifications to work with WPFEP.

https://wordpress.org/plugins/bnfw/
https://wedevs.com/docs/wp-user-frontend-pro/

Answers (2)

2018-10-08

Reigel Gallarde answers:

Can you please try this:

https://pastebin.com/raw/Gc0tFc5g
(code pasted for readability)


Reigel Gallarde comments:

above code assumes, bnfw is already setup... and you have added a notification for post.


Reigel Gallarde comments:

let me know what else missing in above code.
I'm not a user of wp-user-frontend-pro so I might have missed something with your "I want ALL of BNFW notifications to work with WPFEP"


pjeaje comments:

does this include custom posts as well?


Reigel Gallarde comments:

any post type created by wp-user-frontend-pro.


pjeaje comments:

Thanks, let me test it...


pjeaje comments:

It didn't work, no emails sent by BNFW.


Reigel Gallarde comments:

Can you try that "Send Me a Test Email" button. Just right above Save button on your screenshot.

Also, sometimes emails are delayed.


pjeaje comments:

The test works the post from WPUF pro doesn't work


pjeaje comments:

my email log plugin hasn't logged any emails either


pjeaje comments:

i'm using this to log my outgoing emails...

https://wordpress.org/plugins/email-log/


pjeaje comments:

Sorry, it now works. Let me do a bit more testing


Reigel Gallarde comments:

I'm still reading the code.
As far as I can see where the code is going, BNFW is scheduling mails from posts.. but not on other events like comments, track back, ping back, new users and others.


pjeaje comments:

Problem: When updating a post it also sends out the BNFW notification for a newly created post for the updated post as well.


Reigel Gallarde comments:

this line is for updating post...
add_action( 'wpuf_edit_post_after_update', 'wpufe_update_post' ); // updating post
remove it if not needed..


pjeaje comments:

I do need it. The problem is, when I update a post it also resends the new post notification


Reigel Gallarde comments:

I see... I realized there's another function for updating post...
So new code is now this:
https://pastebin.com/raw/ksWrx5e8


pjeaje comments:

Problem: the updated post notification is being sent out twice.


Reigel Gallarde comments:

Do you have only this 2 action hooks?

add_action( 'wpuf_add_post_after_insert', 'wpufe_new_post' ); // inserting new post
add_action( 'wpuf_edit_post_after_update', 'wpufe_update_post' ); // updating post


pjeaje comments:

Yes


Reigel Gallarde comments:

I've read the code and can't seem to find out why...
there are only 2 action hooks for WP User Frontend.
And these are:
wpuf_add_post_after_insert for new inserted post
wpuf_edit_post_after_update for updated post.

our function wpufe_new_post is calling new post function notifications of BNFW
while wpufe_update_post is calling update post function...

The only thing I cant think of right now is that the notification might have been there even without our wpuf_edit_post_after_update hook.


pjeaje comments:

It sends out the exact same "customised" BNFW notification twice so it can't come from another source?


Reigel Gallarde comments:

Have you tried removing our hook for the update? See if it's not sending this "customised" BNFW notification.
Or maybe, can I have a look at your notification settings?
Maybe delete your old settings and create a new one?

I have checked and there's only one do_action wpuf_edit_post_after_update in the WP User Frontend source code.
Our code can't be called more than once, unless we have more than one action hook of which we only have one.


pjeaje comments:

ok... it appears BNFW picks up the WPUF pro post updates but not the post creations


Reigel Gallarde comments:

That's good to hear...
So seems everything is working now?


pjeaje comments:

problem: now there is no BNFW post creation notification???


Reigel Gallarde comments:

this should be the one that fires it.
add_action( 'wpuf_add_post_after_insert', 'wpufe_new_post' );


pjeaje comments:

Sorry my mistake on the last problem it all seems to work now.

2018-10-08

Arnav Joy answers:

is it possible if you can provide access to live site to work?