Vox Populi(x) forum

Alexandria Book Library => Supporto (Support) => Topic started by: alex_n on 27 January 2016, 19:30:14

Title: loadbook plugin problem
Post by: alex_n on 27 January 2016, 19:30:14
Hi all! I try to load a book into Joomla (vers. 3.4.8 + ABOOK 3.1.0) article with {loadbook id=NNN} plugin code. When I click "Save" button such error

Fatal error: Call to undefined method JApplicationAdministrator::getParams() in Z:\home\localhost\www\gse\components\com_abook\helpers\route.php on line 107

appears. Articles saves, but have been blocked. In site front-end views book appears normally. Any ideas how to fix this code:


                //Create the link
                $link = 'index.php?option=com_abook&view=author&id='. $id;
      $app = JFactory::getApplication('site');
line107     $params = $app->getParams(); //Will rise an error if uncommented

      $itemid= $params->get("author_itemid");
                if ($itemid!=''){
                        $link .= '&Itemid='.$itemid;
                }elseif ($item = self::_findItem($needles)) {
                        $link .= '&Itemid='.$item;
                }

                return $link;
        }
Title: Re: loadbook plugin problem
Post by: alex_n on 03 February 2016, 08:35:15
Hi to all!
I fixed this problem and more (when user in back-end press cancel in tag add or author add, he has got a blank screen and must refresh page manually)
replace above post code in helpers/route.php by this fragment - all works correctly :)
               
         //Create the link
                $link = 'index.php?option=com_abook&view=author&id='. $id;
   //   $app = JFactory::getApplication();
   //   $params = $app->getParams('com_component1');
      
      $params = JComponentHelper::getParams('com_content');
      $test = $params->get('site');
      
      //   $app = JFactory::getApplication('site');
      //       $params = $app->getParams();

      $itemid= $params->get("author_itemid"); //
                if ($itemid!=''){
                        $link .= '&Itemid='.$itemid;
                }elseif ($item = self::_findItem($needles)) {
                        $link .= '&Itemid='.$item;
                }

                return $link;
        }
Title: Re: loadbook plugin problem
Post by: federica on 26 February 2016, 12:56:30
Hi alex_n,
try to come back to old code and change from
$app = JFactory::getApplication('site');
to
$app = JFactory::getApplication();

It is works?