Support » Plugin: Edit Flow » [Plugin: Edit Flow] Code to partially turn off auto-subscribe

  • Resolved mcstevem


    Can you share the full code snippet that would turn off auto-subscribe? Even better, that would turn off auto-subscribe for users editing a post, but leave it enabled for users adding an editorial comment? (That would get me past the Catch-22 where I can’t unsubscribe myself because doing so is editing a post, which re-subscribes me …) I’ve seen the ef_notification_auto_subscribe_current_user filter listed on the Notifications page of the EditFlow site, but not being a developer I don’t know the full syntax that would need to be added to functions.php to achieve my aims.

    Thanks, and I’m loving the updated plugin for our university news site.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Scott Bressler


    If you don’t want to auto-subscribe yourself either when adding a comment or when editing the post, simply add the following to functions.php:

    add_filter( 'ef_notification_auto_subscribe_current_user', '__return false' );

    If, instead, you only want to turn off auto-subscription for one of those two actions, you’d do something like the following:

    function efx_dont_auto_subscribe_for_editorial_comments( $auto_subscribe, $subscription_type ) {
      if ( $subscription_type === 'comment' )
        return false;
      return $auto_subscribe;
    add_filter( 'ef_notification_auto_subscribe_current_user', 'efx_dont_auto_subscribe_for_editorial_comments', 10, 2 );

    To instead turn off auto-subscription only when editing a post (rather than posting an editorial comment), change the first line of the function to:
    if ( $subscription_type === 'subscription_action' )

    Hope that helps!


    Plugin Author Scott Bressler


    I’ve added a page explaining a solution to this question in even more detail on our web site here:

    Plugin Author Scott Bressler


    Steve, did this code work for you?

    Scott, I’ve been in meeting hell since I posted the request. I’m hoping to try out the code this afternoon, so that I can include it in training sessions I’ll be presenting next week.

    I added the code to functions.php, reversing the situation so that it would disable auto-subscribes for post changes but keep them for comments, and it worked exactly as desired. Thanks!

    The piece that isn’t quite as expected is that the original post author is no longer auto-subscribed when the post it first created (part of the problem reported by hermy65 in a separate thread). Now that there’s a way to allow users to unsubscribe themselves, I’d lobby to restore the auto-subscription of author upon creation, as the author is the person most likely to want to know about changes or comments.

    Plugin Author Daniel Bachhuber


    Intriguing… I’m out of town but will take a more detailed look early this coming week.

    Plugin Author Daniel Bachhuber


    As it turns out, this is a bug and regression 🙂 I’m working on a solution now and it will be out in v0.7.1. Sorry for the inconvenience.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Edit Flow] Code to partially turn off auto-subscribe’ is closed to new replies.