ID, 'post_id' ); } // add the meta box only if reservations are enabled if ( get_option( 'dbem_rsvp_enabled' ) && $em_event->can_manage( 'manage_bookings', 'manage_others_bookings' ) ) { add_meta_box( 'aem-event-referral-rate', __( 'Affiliates', 'affiliates-events-manager' ), array( __CLASS__, 'meta_box_affiliates' ), 'event', 'normal', 'high' ); // We do not add it to recurring events (posts of type 'event-recurring') as these can't really be booked. // Recurring events just create normal events and that is where we would set a rate. } } /** * Meta box output * * @param WP_Post $post */ public static function meta_box_affiliates( $post ) { echo '
'; echo esc_html( _n( 'This specific rate applies to this event', 'These specific rates apply to this event.', count( $rates ), 'affiliates-events-manager' ) ); echo '
'; $odd = true; $is_first = true; echo ''; echo esc_html( __( 'This event has no specific applicable rates.', 'affiliates-events-manager' ) ); echo '
'; } if ( current_user_can( AFFILIATES_ADMINISTER_OPTIONS ) && !empty( $post ) && !empty( $post->post_status ) && $post->post_status !== 'auto-draft' ) { echo ''; $url = wp_nonce_url( add_query_arg( array( 'object_id' => $post->ID, 'integration' => 'affiliates-events-manager', 'action' => 'create-rate' ), admin_url( 'admin.php?page=affiliates-admin-rates' ) ) ); echo sprintf( '', esc_url( $url ) ); echo esc_html__( 'Create a rate', 'affiliates-events-manager' ); echo ''; echo '
'; } else { echo ''; echo esc_html__( 'Once you save this event, you can create a rate from here.', 'affiliates-woocommerce' ); echo '
'; } echo '