예제 #1
0
 /**
  * Tests if the current page is the Edit Event page
  *
  * @return bool whether it is the Edit Event page.
  * @author Paul Hughes
  * @since 1.0.1
  */
 function tribe_is_community_edit_event_page()
 {
     if (!class_exists('Tribe__Events__Community__Main')) {
         return false;
     }
     return Tribe__Events__Community__Main::instance()->isEditPage;
 }
예제 #2
0
파일: Main.php 프로젝트: TakenCdosG/chefs
        /**
         * displays the saved venue dropdown in the event metabox
         * Used to be a PRO only feature, but as of 3.0, it is part of Core.
         *
         * @param int $post_id the event ID for which to create the dropdown
         */
        public function displayEventVenueDropdown($post_id)
        {
            $venue_id = get_post_meta($post_id, '_EventVenueID', true);
            // Strange but true: the following func lives in core so is safe to call without a func_exists check
            $new_community_post = tribe_is_community_edit_event_page() && !$post_id;
            $new_admin_post = 'auto-draft' === get_post_status($post_id);
            if (!$venue_id && ($new_admin_post || $new_community_post)) {
                $venue_id = $this->defaults()->venue_id();
            }
            $venue_id = apply_filters('tribe_display_event_venue_dropdown_id', $venue_id);
            ?>
			<tr class="saved-linked-post">
				<td style="width:170px"><?php 
            printf(__('Use Saved %s:', 'the-events-calendar'), $this->singular_venue_label);
            ?>
</td>
				<td>
					<?php 
            Tribe__Events__Linked_Posts::instance()->saved_linked_post_dropdown(Tribe__Events__Venue::POSTTYPE, $venue_id);
            $venue_pto = get_post_type_object(self::VENUE_POST_TYPE);
            if (current_user_can($venue_pto->cap->edit_posts)) {
                //Use Admin Link Unless on Community Events Editor then use Front End Link to Edit
                $edit_link = admin_url(sprintf('post.php?action=edit&post=%s', $venue_id));
                if (tribe_is_community_edit_event_page()) {
                    $edit_link = Tribe__Events__Community__Main::instance()->getUrl('edit', $venue_id, null, self::VENUE_POST_TYPE);
                }
                ?>
						<div class="edit-venue-link" <?php 
                if (empty($venue_id)) {
                    ?>
style="display:none;"<?php 
                }
                ?>
>
							<a data-admin-url="<?php 
                echo esc_url(admin_url('post.php?action=edit&post='));
                ?>
" href="<?php 
                echo esc_url($edit_link);
                ?>
" target="_blank">
								<?php 
                echo esc_html(sprintf(__('Edit %s', 'the-events-calendar'), $this->singular_venue_label));
                ?>
							</a>
						</div>
						<?php 
            }
            //end if
            ?>
				</td>
			</tr>
		<?php 
        }
예제 #3
0
 /**
  * If a removed organizer is being used as a default, change the default to
  * its replacement.
  *
  * @param int   $keep
  * @param array $replace
  *
  */
 private function update_default_organizers($keep, array $replace)
 {
     if ($this->default_organizer && in_array($this->default_organizer, $replace)) {
         $events = Tribe__Events__Main::instance();
         $events->setOption('eventsDefaultOrganizerID', $keep);
     }
     if ($this->default_community_organizer && in_array($this->default_community_organizer, $replace)) {
         $community = Tribe__Events__Community__Main::instance();
         $community->setOption('defaultCommunityOrganizerID', $keep);
     }
 }