WordPress.org

Making WordPress.org


Ignore:
Timestamp:
02/22/2018 04:41:31 PM (3 years ago)
Author:
iandunn
Message:

CampTix Tweaks: Open source functions from camptix-extras.

With this, there's nothing left in camptix-extras, so it's being removed.

See #221

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/camptix-tweaks.php

    r6575 r6714  
    33namespace WordCamp\CampTix_Tweaks;
    44use CampTix_Plugin;
     5use WP_Post;
    56
    67defined( 'WPINC' ) or die();
     
    2122add_filter( 'camptix_name_order',                            __NAMESPACE__ . '\set_name_order'         );
    2223add_action( 'camptix_form_edit_attendee_custom_error_flags', __NAMESPACE__ . '\disable_attendee_edits' );
     24add_action( 'transition_post_status',                        __NAMESPACE__ . '\log_publish_to_cancel', 10, 3 );
    2325
    2426// Miscellaneous
     27add_filter( 'camptix_beta_features_enabled', '__return_true' );
    2528add_action( 'camptix_nt_file_log',     '__return_false' );
     29add_action( 'init',                    __NAMESPACE__ . '\camptix_debug', 9          ); // CampTix does this at 10.
    2630add_filter( 'camptix_default_addons',  __NAMESPACE__ . '\load_addons'               );
    2731add_filter( 'camptix_capabilities',    __NAMESPACE__ . '\modify_capabilities'       );
     
    473477
    474478/**
     479 * Log when published attendees are cancelled.
     480 *
     481 * @param string  $to
     482 * @param string  $from
     483 * @param WP_Post $post
     484 */
     485function log_publish_to_cancel( $to, $from, $post ) {
     486    /** @var $camptix CampTix_Plugin */
     487    global $camptix;
     488
     489    if ( 'tix_attendee' !== $post->post_type || $to === $from ) {
     490        return;
     491    }
     492
     493    if ( 'publish' === $from && 'cancel' === $to ) {
     494        $camptix->log( 'Publish to cancel transition, possible bug.', $post->ID );
     495    }
     496}
     497
     498/**
     499 * Enable debugging info for super admins.
     500 *
     501 * It's not done for others because it can expose sensitive information.
     502 */
     503function camptix_debug() {
     504    if ( ! current_user_can( 'manage_network' ) ) {
     505        return;
     506    }
     507
     508    add_filter( 'camptix_debug', '__return_true' );
     509}
     510
     511/**
    475512 * Enable addons that are disabled by default
    476513 *
Note: See TracChangeset for help on using the changeset viewer.