• Resolved Brad Mettee

    (@bmettee4)


    Hi,

    I figured out how/why some people are seeing double e-mails on a post Update. We’re using Customify theme and Profile Builder. Enabling either would cause the problem.

    When the Update button is hit, the post.php script gets called two times. The first time does the content update, the second time does Meta data updates. Both times trigger the ‘publish_to_publish’ action.

    In the bnfw->update_post function, add the following test:

        	if ( isset($_GET) && count($_GET) > 0 && isset($_GET['meta-box-loader']) )
    			{
    			return;
    			}
    

    This will prevent meta-data updates from triggering a second e-mail.

    I’ve only debugged this one occurance, so if anyone is having problems with double emails someplace else, this may or may not solve it.

    Hope this helps,

    Brad M.

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter Brad Mettee

    (@bmettee4)

    Also found what might be another, unrelated, problem:
    helpers.php
    function bnfw_get_user_select_class indicates to use Ajax for additional users when user_count > 100
    function bnfw_render_users_dropdown will use Ajax when user_count > 200

    Shouldn’t these two counts match?

    Plugin Author bnfw

    (@voltronik)

    Hi @bmettee4,
    Thanks for getting in touch and your suggestions.

    Let me take a look and test to see how I get on. I’ll get back to you soon.

    Hi.
    The same problem with double emails also occurs when bnfw is used in combination with plugin “Restrict Content”.
    After the normal post update, in versions befor 5.0, it used to be a ajax call like this:
    REQUEST_URI: “/site49/wp-admin/admin-ajax.php?action=oembed-cache&post=8”
    and this update was stopped by:
    public function on_shutdown() {
    if ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) {
    return;
    }

    In wp 5.0 this update is changed to
    REQUEST_URI: “/site50/wp-admin/post.php?post=126&action=edit&meta-box-loader=1&_wpnonce=38032602d7&_locale=user”
    and causes double email.

    Plugin Author bnfw

    (@voltronik)

    Thanks @terjeb, that’s helpful.

    Thread Starter Brad Mettee

    (@bmettee4)

    Over the weekend I found a second value being used, “meta_box” also gets used, but under different circumstances (doesn’t look like they’ll both be used at the same time). I think the wordpress core has had some additions that aren’t consistent.

    My override line is now:
    if ( isset($_GET) && count($_GET) > 0 && (isset($_GET['meta-box-loader']) || isset($_GET['meta_box'])) )

    Plugin Author bnfw

    (@voltronik)

    Thanks @bmettee4, that’s also helpful.

    I’m also getting the double email issue. Not sure if this is of any help to you, but for me, it seemed to start sending double emails when WordPress introduced the new editor. When I switched to the classic editor, the double emails stop.

    • This reply was modified 5 years, 10 months ago by takkischitt.
    Plugin Author bnfw

    (@voltronik)

    Hi @takkischitt,
    Thanks, that’s helpful.

    @bmettee4 @terjeb Are either of you using the new Block Editor (Gutenberg)?

    I installed “Classic Editor” plugin, and in settings/writing forced use of classic editor.
    The http-req containing “meta-box-loader” is no longer issued from WP.
    No double emails received!!!

    Thread Starter Brad Mettee

    (@bmettee4)

    We’re using Gutenberg for main blog entries, and TinyMCE for a custom post type. Duplicates only occur when using Gutenberg AND Customify theme or Profile Builder. Basically it seems to be Gutenberg and meta blocks from any theme or plugin.

    Plugin Author bnfw

    (@voltronik)

    Hi @bmettee4,
    That’s helpful.

    Plugin Author bnfw

    (@voltronik)

    Hi @bmettee4 @terjeb @takkischitt,
    Are you able to get in touch via https://betternotificationsforwp.com/contact so that I can send you a beta version of the plugin to test?

    @voltronik

    I’ve sent you a message via the ‘PR / News’ option of the ‘Contact’ page on betternotificationsforwp.com

    Cheers

    @voltronik

    Sent you a reply regarding the beta version to the ‘hello@…’ email address.

    Cheers

    Thread Starter Brad Mettee

    (@bmettee4)

    Beta seems to work fine. No more duplicates sent on post, or custom post type, updates.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Double email on Post update’ is closed to new replies.