-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notify Community Team when new post is pending in Central #1058
base: production
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this - I think it would be better to have this as an mu-plugin, restricting it's use on central via a site id check (or similar), rather than it being ambiguous as a plugin and potentially activated on other WordCamp (or Event) sites.
I'll leave some other feedback inline on the PR.
* @param WP_Post $post Post object. | ||
*/ | ||
function send_notification_email( $new_status, $old_status, $post ) { | ||
if ( 'pending' === $new_status && user_can( $post->post_author, 'edit_posts' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure of the purpose of the edit_posts
check here - would that not be covered by edit privileges anyway?
wp_mail( '[email protected]', $subject, $message ); | ||
|
||
// Save a pointer that notification has been sent. | ||
update_post_meta( $post->ID, '_ncpp_sent', wp_date( 'Y-m-d H:i:s' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a method for clearing this on successful save, in case we switch between statuses such as:
draft => pending
pending => draft
draft => pending
pending => publish
Many WordCamp organisers do have a contributor role on the WordCamp Central website. That means they can write a post, but not publish it. When they are to publish that post, it goes to pending review status.
The team has witnessed a few times that the author doesn't know/understand that no one in Central is looking at pending posts automatically. That results in posts not being published (non at the moment) or delayed.
To avoid these situations, send notification to Community Team when the post status is changed to pending.
Fixes #718
Props @pkevan
Screenshots
How to test the changes in this Pull Request:
After merge & deploy