loadbook plugin problem

Started by alex_n, 27 January 2016, 19:30:14

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

alex_n

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;
        }

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

alex_n

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;
        }

federica

Hi alex_n,
try to come back to old code and change from
$app = JFactory::getApplication('site');
to
$app = JFactory::getApplication();

It is works?
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]