Changeset 5381
- Timestamp:
- 04/20/2017 12:17:27 AM (8 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r5365 r5381 172 172 } 173 173 174 // If the Mentor username changed, update the site 175 $mentor_username = $_POST[ wcpt_key_to_str( 'Mentor WordPress.org User Name', 'wcpt_' ) ]; 176 if ( $mentor_username !== get_post_meta( $post_id, 'Mentor WordPress.org User Name', true ) ) { 177 $this->add_mentor( $post, $mentor_username ); 178 } 179 174 180 // Post meta keys 175 181 $wcpt_meta_keys = WordCamp_Admin::meta_keys(); … … 327 333 return $values; 328 334 } 335 336 /** 337 * Add the Mentor as an administrator on the given site. 338 * 339 * @param WP_Post $wordcamp WordCamp post object. 340 * @param string $mentor_username Mentor's WP.org user login. 341 */ 342 protected function add_mentor( $wordcamp, $mentor_username ) { 343 $blog_id = get_wordcamp_site_id( $wordcamp ); 344 $new_mentor = get_user_by( 'login', $mentor_username ); 345 346 if ( ! $blog_id || ! $new_mentor ) { 347 return; 348 } 349 350 add_user_to_blog( $blog_id, $new_mentor->ID, 'administrator' ); 351 } 329 352 330 353 /** -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php
r5365 r5381 334 334 335 335 $meta = get_post_custom( $wordcamp_id ); 336 337 $mentor = get_user_by( 'login', $meta['Mentor WordPress.org User Name'][0] ); 338 if ( $mentor ) { 339 add_user_to_blog( get_wordcamp_site_id( $wordcamp ), $mentor->ID, 'administrator' ); 340 } 336 341 337 342 switch_to_blog( $this->new_site_id );
Note: See TracChangeset
for help on using the changeset viewer.