コード例 #1
0
 /**
  * Create a session between this user and a given EP group
  *
  * @param int $wp_post_id This is used for setting the session key
  * @param string $ep_group_id
  */
 public function create_session($wp_post_id, $ep_group_id)
 {
     // Sessions are user-post specific
     $session_key = 'ep_group_session_id-post_' . $wp_post_id;
     $this->ep_session_id = get_user_meta($this->wp_user_id, $session_key, true);
     if (empty($this->ep_session_id)) {
         $this->ep_session_id = Participad_Post::create_ep_group_session($ep_group_id, $this->ep_user_id);
         if (!is_wp_error($this->ep_session_id)) {
             update_user_meta($this->wp_user_id, $session_key, $this->ep_session_id);
         }
     }
     if (!empty($this->ep_session_id)) {
         // @todo This does not work across domains!
         // @todo Better expiration?
         setcookie("sessionID", $this->ep_session_id, time() + 60 * 60 * 24 * 365 * 100, "/");
     }
 }
コード例 #2
0
 /**
  * Create a session between this user and a given EP group
  *
  * @param int $wp_post_id This is used for setting the session key
  * @param string $ep_group_id
  */
 public function create_session($wp_post_id, $ep_group_id)
 {
     // Sessions are user-post specific
     $session_key = 'ep_group_session_id-post_' . $wp_post_id;
     $this->ep_session_id = get_user_meta($this->wp_user_id, $session_key, true);
     if (empty($this->ep_session_id)) {
         $ep_session_id = Participad_Post::create_ep_group_session($ep_group_id, $this->ep_user_id);
         if (!is_wp_error($ep_session_id)) {
             $this->ep_session_id = $ep_session_id;
             update_user_meta($this->wp_user_id, $session_key, $this->ep_session_id);
         }
     }
     if (!empty($this->ep_session_id)) {
         // @todo Better expiration?
         // It's not possible to set cross-domain cookies. But
         // this filter will let you adjust for EP on a separate
         // subdomain
         $cookie_domain = apply_filters('participad_cookie_domain', '');
         setcookie("sessionID", $this->ep_session_id, time() + 60 * 60 * 24 * 365 * 100, '/', $cookie_domain);
     }
 }
コード例 #3
0
 /**
  * Catches and process AJAX save requests
  *
  * @since 1.0
  */
 public function save_ajax_callback()
 {
     check_admin_referer('participad_frontend_nonce');
     $p_post = new Participad_Post('wp_post_id=' . $_POST['post_id']);
     $p_post->sync_wp_ep_content();
     die;
 }