コード例 #1
0
 /**
  * Run the caching functionality that is executed on save post.
  *
  * @param int     $post_id The post_id.
  * @param WP_Post $post    The current post object being saved.
  */
 public function save_post($post_id, $post)
 {
     if (in_array($post->post_type, TribeEvents::getPostTypes())) {
         $this->cache->set_last_occurrence('save_post');
     }
 }
コード例 #2
0
 /**
  * Determine if the specified user can edit the specified post.
  *
  * @param int|null $id The current post ID.
  * @param string $post_type The post type.
  * @return bool Whether the use has the permissions to edit a given post.
  * @author Nick Ciske
  * @since 1.0
  * @deprecated since version 3.1
  */
 public function userCanEdit($id = null, $post_type = null)
 {
     // if we're talking about a specific post, use standard WP permissions
     if ($id) {
         return current_user_can('edit_post', $id);
     }
     if (empty($post_type) || !is_user_logged_in()) {
         return FALSE;
     }
     // only supports Tribe Post Types
     if (!in_array($post_type, TribeEvents::getPostTypes())) {
         return false;
     }
     // admin override
     if (is_super_admin() || current_user_can('manage_options')) {
         return true;
     }
     return $this->allowUsersToEditSubmissions;
 }