Changeset 7130
- Timestamp:
- 04/18/2018 09:22:07 PM (7 years ago)
- Location:
- sites/trunk/wp15.wordpress.net/public_html/content
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wp15.wordpress.net/public_html/content/mu-plugins/miscellaneous.php
r7079 r7130 11 11 namespace WP15\Miscellaneous; 12 12 use DateTime; 13 use TGGRSourceFlickr, TGGRSourceGoogle, TGGRSourceInstagram, TGGRSourceTwitter; 13 14 14 15 defined( 'WPINC' ) || die(); … … 16 17 add_filter( 'map_meta_cap', __NAMESPACE__ . '\allow_css_editing', 10, 2 ); 17 18 add_filter( 'tggr_end_date', __NAMESPACE__ . '\set_tagregator_cutoff_date' ); 19 add_filter( 'wp_insert_post_data', __NAMESPACE__ . '\moderate_tagregator_posts' ); 18 20 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\register_assets', 1 ); 19 21 add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\register_assets', 1 ); … … 61 63 62 64 /** 65 * Set new Tagregator posts to `pending`, so they can be manually approved before being displayed. 66 * 67 * The `#WP15` hashtag is shared with other, non-WordPress meanings, and sometimes has content that would be 68 * inappropriate for an official WP site. So, we need to manually approve the posts before they're published. 69 * 70 * @param array $post_data 71 * 72 * @return array 73 */ 74 function moderate_tagregator_posts( $post_data ) { 75 $tagregator_post_types = array(); 76 $moderator_actions = array( 'edit', 'editpost', 'inline-save' ); 77 $modules = array( 'TGGRSourceFlickr', 'TGGRSourceGoogle', 'TGGRSourceInstagram', 'TGGRSourceTwitter' ); 78 79 foreach ( $modules as $module ) { 80 if ( defined( "$module::POST_TYPE_SLUG" ) ) { 81 array_push( $tagregator_post_types, $module::POST_TYPE_SLUG ); 82 } 83 } 84 85 if ( 'publish' !== $post_data['post_status'] || ! in_array( $post_data['post_type'], $tagregator_post_types, true ) ) { 86 return $post_data; 87 } 88 89 if ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $moderator_actions, true ) ) { 90 return $post_data; 91 } 92 93 $post_data['post_status'] = 'pending'; 94 95 return $post_data; 96 } 97 98 /** 63 99 * Register style and script assets for later enqueueing. 64 100 */ -
sites/trunk/wp15.wordpress.net/public_html/content/themes/twentyseventeen-wp15/page-live.php
r7106 r7130 15 15 <?php esc_html_e( 'Join the conversation by using #WP15 on your favorite social networks.', 'wp15' ); ?> 16 16 17 <?php if ( current_user_can( 'manage_options' ) ) : ?>18 <p style="color:darkred">Don't forget to enable this for logged-out visitors once moderation is in place.</p>19 17 <?php echo do_shortcode( '[tagregator hashtag="#WP15"]' ); ?> 20 <?php endif; ?>21 18 </div> 22 19
Note: See TracChangeset
for help on using the changeset viewer.