bu-ist / bu-versions

Make and save edits to published posts/pages in WordPress without immediately replacing the public content.
https://developer.bu.edu/bu-versions/
19 stars 5 forks source link

Email notifictions #8

Closed defunctl closed 10 years ago

defunctl commented 11 years ago

Feature Request: Send an email notifications when a clone has been created to Editors and Admins.

At the very least add some hooks so plugin authors could write a plugin to do this.

Thanks

unwrittendevin commented 11 years ago

I've had luck with this plugin to at least define which admin email to send notifications to: http://wordpress.org/plugins/email-post-changes/

I have my users set as contributors instead of the BU Section Editor role that comes with the suite of BU plugins

limeybloke commented 11 years ago

Any update on this...

The plugin is great but we Admin users to be notified. We're trying to manage a site with over 2000 pages in different custom post types. Without email notifications how would we ever know?

defunctl commented 11 years ago

I made something temporary for this but it does require hacking the source.

In bu-versions.php line 269:

        if ( 'default' == $page_template || in_array($page_template, $page_templates) ) {
            update_post_meta($post_id, '_wp_page_template',  $page_template);
        }

change it to:

        if ( 'default' == $page_template || in_array($page_template, $page_templates) ) {
            update_post_meta($post_id, '_wp_page_template',  $page_template);
            // hack: add an action to hook into once a clone is successfully completed
            do_action('bu_version_create', $post_id );
        }

I then created a small plugin to send notifications to all admins/editors or whichever roles you define, which is available here: https://gist.github.com/defunctl/6400343

Hope it helps.

limeybloke commented 11 years ago

So if you used the default WP role of Contributor would it not send email notifications anyhow?

Kind regards

Phil

Phil Shackleton Digital Director Mixd - Creative Digital and Print

Follow me on Twitter @Limeybloke

Tel: 01423 566043 Mobile: 07799113420 Web: www.mixd.co.uk

Follow us on Twitter @Mixd Join us on Facebook

On Sat, Aug 31, 2013 at 9:14 PM, defunctl notifications@github.com wrote:

I made something temporary for this but it does require hacking the source. In bu-versions.php line 269:

      if ( 'default' == $page_template || in_array($page_template, $page_templates) ) {
          update_post_meta($post_id, '_wp_page_template',  $page_template);
      }

change it to:

      if ( 'default' == $page_template || in_array($page_template, $page_templates) ) {
          update_post_meta($post_id, '_wp_page_template',  $page_template);
          // hack: add an action to hook into once a clone is successfully completed
          do_action('bu_version_create', $post_id );
      }

I then created a plugin to send notifications to all admins, which is available here: https://gist.github.com/defunctl/6400343

Hope it helps.

Reply to this email directly or view it on GitHub: https://github.com/bu-ist/bu-versions/issues/8#issuecomment-23613126

defunctl commented 11 years ago

It will only send notifications to the roles you specify on line 40 on dmg-versions-notifictions.php:

$roles = array('Administrator', 'Editor');
limeybloke commented 11 years ago

What I mean is if I don't use that plugin and just set the user role to be a Contributor would it not send emails by default?

Have you used this notification plugin in an production environment? How tested is it?

Ps thanks so much for helping!

Kind regards

Phil

Phil Shackleton Digital Director Mixd - Creative Digital and Print

Follow me on Twitter @Limeybloke

Tel: 01423 566043 Mobile: 07799113420 Web: www.mixd.co.uk

Follow us on Twitter @Mixd Join us on Facebook

On Sat, Aug 31, 2013 at 10:02 PM, defunctl notifications@github.com wrote:

It will only send notifications to the roles you specify on line 40 on dmg-versions-notifictions.php:

$roles = array('Administrator', 'Editor');

Reply to this email directly or view it on GitHub: https://github.com/bu-ist/bu-versions/issues/8#issuecomment-23613873

defunctl commented 11 years ago

I'm not sure what you mean. I'm not using http://wordpress.org/plugins/email-post-changes/. I am using my custom plugin which I have not yet tested in a full production environment, just a dev environment with about 10 testers. So far no issues. It's a small plugin, you can review the code and the hack to bu-versions is just to add an action to hook into once a clone was created.

limeybloke commented 11 years ago

Ok thanks

Ill take a look.

But what I was meaning is WP by default sends emails when a contributor submits a post for review. On that basis - rather than using the role Section Editor - if we use that role and the user create a revision would it then send the email?

I suppose what I am saying is the plugin revisions using the built in WP functionality?

Kind regards

Phil

Phil Shackleton Digital Director Mixd - Creative Digital and Print

Follow me on Twitter @Limeybloke

Tel: 01423 566043 Mobile: 07799113420 Web: www.mixd.co.uk

Follow us on Twitter @Mixd Join us on Facebook

On Sat, Aug 31, 2013 at 10:08 PM, defunctl notifications@github.com wrote:

I'm not sure what you mean. I'm not using http://wordpress.org/plugins/email-post-changes/. I am using my custom plugin which I have not yet tested in a full production environment, just a dev environment with about 10 testers. So far no issues. It's a small plugin, you can review the code and the hack to bu-versions is just to add an action to hook into once a clone was created.

Reply to this email directly or view it on GitHub: https://github.com/bu-ist/bu-versions/issues/8#issuecomment-23613954

mgburns commented 11 years ago

Labeling this ticket as an enhancement. Adding actions on version create / publish will come soon.