Making WordPress.org


Ignore:
Timestamp:
04/01/2016 08:53:57 PM (10 years ago)
Author:
iandunn
Message:

WordCamp Post Type: Add a log entry when new sites are created.

Location:
sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/views/common/metabox-log.php

    r2794 r2876  
    1919                                        <th><?php echo esc_html( ucwords( str_replace( '_', ' ', $entry['type'] ) ) ); ?></th>
    2020                                        <th><?php echo esc_html( $entry['user_display_name'] );                        ?></th>
    21                                         <th><?php echo esc_html( $entry['message'] );                                  ?></th>
     21                                        <th><?php echo wp_kses(  $entry['message'], wp_kses_allowed_html( 'data') );   ?></th>
    2222                                </tr>
    2323                        <?php endforeach; ?>
  • sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php

    r2861 r2876  
    197197                        }
    198198                }
    199                
    200                 // todo add log entry when site created
    201199
    202200                $this->validate_and_add_note( $post_id );
  • sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php

    r2730 r2876  
    100100                }
    101101
    102                 $url = parse_url( $url );
    103                 if ( ! $url || empty( $url['scheme'] ) || empty( $url['host'] ) ) {
     102                $url_components = parse_url( $url );
     103                if ( ! $url_components || empty( $url_components['scheme'] ) || empty( $url_components['host'] ) ) {
    104104                        return;
    105105                }
    106                 $path = isset( $url['path'] ) ? $url['path'] : '';
     106                $path = isset( $url_components['path'] ) ? $url_components['path'] : '';
    107107
    108108                $wordcamp_meta     = get_post_custom( $wordcamp_id );
    109109                $lead_organizer    = $this->get_user_or_current_user( $wordcamp_meta['WordPress.org Username'][0]  );
    110110                $site_meta         = array( 'public' => 1 );
    111                 $this->new_site_id = wpmu_create_blog( $url['host'], $path, 'WordCamp Event', $lead_organizer->ID, $site_meta );
     111                $this->new_site_id = wpmu_create_blog( $url_components['host'], $path, 'WordCamp Event', $lead_organizer->ID, $site_meta );
    112112
    113113                if ( is_int( $this->new_site_id ) ) {
     
    117117                        // Configure the new site at priority 11, after all the custom fields on the `wordcamp` post have been saved, so that we don't use outdated values
    118118                        add_action( 'save_post', array( $this, 'configure_new_site' ), 11, 2 );
     119
     120                        add_post_meta( $wordcamp_id, '_note', array(
     121                                'timestamp' => time(),
     122                                'user_id'   => get_current_user_id(),
     123                                'message'   => sprintf( 'Created site at <a href="%s">%s</a>', $url, $url ),
     124                        ) );
    119125                }
    120126        }
Note: See TracChangeset for help on using the changeset viewer.