Fix for PI frontend cat/section select from url

From this forum post 

url format:
index.php?option=com_pi_pages_and_items&task=item&sub_task=new&pageId=888&item_type=custom_3&Itemid=63&section=1&category=40&hide_select=1


version 1.4.6
file:
administrator/components/com_pi_pages_and_items/admin/item.php
line: 55

 

 //check section access. don't check if from frontend, sections and category select will be filtered out
     if(!$class_pi->check_section_access_by_pageid($page_id) && !$frontend){
        
   



change to

 

     //check section access. don't check if from frontend, sections and category select will be filtered out
     if(!$frontend){
         if(!$class_pi->check_section_access_by_pageid($page_id)){
  

       
  

and add a } to close the extra if().

 


 line 67 (or 80 after you did the above ;-)#
 //get the section which the category belongs to    
         $class_pi->db->setQuery("SELECT id, section, name FROM #__categories WHERE id='$cat_id'");//name?
         $rows = $class_pi->db->loadObjectList();
         $row = $rows[0];
         $section_id = $row->section;
     }
 


change to

 
         //get the section which the category belongs to    
         $class_pi->db->setQuery("SELECT id, section, name FROM #__categories WHERE id='$cat_id'");//name?
         $rows = $class_pi->db->loadObjectList();
         $row = $rows[0];
         $section_id = $row->section;
     }
     
     //get category and section id from url
     if($frontend){
         $section_id = intval($class_pi->get_var('section', '' ));    
         $cat_id = intval($class_pi->get_var('category', '' ));
         $hide_page_select = $class_pi->get_var('hide_select', '' );
     }


line: 930

 


 if($frontend){
                             $pi_sections_array = $class_pi->get_sections();
 


change to

 

 if($frontend && !$hide_page_select){
                            $pi_sections_array = $class_pi->get_sections();

 
Follow Us On Twitter
spicy-sacerdotal