/**
  * Setup Query for User profile Galleries
  * 
  */
 public function setup_user_gallery()
 {
     if (mpp_is_enabled('members', bp_displayed_user_id()) && function_exists('bp_is_user') && bp_is_user()) {
         //is User Gallery enabled? and are we on the user section?
         $this->component = 'members';
         //initialize for members component
         $this->init();
         //in this case, we are on the gallery directory, check if we have it enabled?
     } elseif (mpp_has_gallery_directory()) {
         $this->setup_gallery_directory_query();
     }
     //finally setup galleries
     $this->setup_galleries();
 }
Ejemplo n.º 2
0
 public function setup_user_gallery()
 {
     if (mpp_is_active_component('members') && bp_is_user()) {
         //is User Gallery enabled? and are we on the user section?
         $user_id = bp_displayed_user_id();
         $this->component = 'members';
         $current_action = bp_current_action();
         if ($current_action == 'create' || $current_action == 'upload') {
             mediapress()->set_action($current_action);
             mediapress()->set_edit_action($current_action);
             return;
         }
         //Are we looking at single gallery? or Media?
         //current action in this case is checked for being  a gallery slug
         if ($gallery = mpp_gallery_exists($this->action_variables[0], $this->component, $user_id)) {
             //setup current gallery & gallery query
             mediapress()->current_gallery = mpp_get_gallery($gallery);
             mediapress()->the_gallery_query = new MPP_Gallery_Query(array('id' => $gallery->ID));
             $this->current_action = bp_action_variable(0);
             $this->current_manage_action = bp_action_variable(1);
             if (!empty($this->action_variables[1]) && $this->action_variables[1] == 'page' && $this->action_variables[2] > 0) {
                 $this->mpage = (int) $this->action_variables[2];
             }
         } else {
             if ($this->action_variables[0] == 'page' && $this->action_variables[1] > 0) {
                 $this->gpage = (int) $this->action_variables[1];
             }
             $args = array('user_id' => $user_id, 'component' => $this->component, 'status' => $this->accessible_statuses);
             if ($this->gpage) {
                 $args['page'] = absint($this->gpage);
             }
             //we are on User gallery home page(gallery list)
             //we do need to check for the access level here and pass it to the query
             //how about gallery pagination?
             mediapress()->the_gallery_query = new MPP_Gallery_Query($args);
             //set it is the user galleries list view
             mediapress()->is_gallery_home = true;
         }
         //in this case, we are on the gallery directory, check if we have it enabled?
     } elseif (mpp_has_gallery_directory()) {
         $this->setup_gallery_directory_query();
     }
 }