Wednesday 22 April 2015

To setup up lastest CiviCRM on Joomla 3 plus version

If you are trying to install the latest CiviCRM on Joomla 3+, sometime you may stuck whilst installing the CRM component. In such instance, please add the below code on project .htaccess file and try to install again.

php_value upload_max_filesize 20M
php_value post_max_size 256M
php_value max_input_time 200

php_value memory_limit 128M
php_value register_globals off
php_value max_execution_time 600

Hope that helps! :-)

Tuesday 21 April 2015

Error Handling on Joomla 3+

On latest version of Joomla (version 3+), the JError class has been depreciated and force to use the default PHP Exception which can be used as below:

/**
 * Function to verify the user access permission.
 * @return bool Return 'TRUE' if user has access, else throw an error.
 * @throws Exception
 */
protected function hasAccessPermission()
{    
 // Fetch the any user session.
 $user = JFactory::getUser(); 
 
 try {        
  /* if not logged in, prompt error. */
  if (!$user->get('guest')) 
  {
   /* Write your code here.. */
            return true;
  } 
  else {
   throw new Exception("You don't have permission to access this page. Please click here to Login for access.");
  }
 } 
 // Catch any exception
 catch (Exception $e) {
  // Display the message and exit;
  jexit($e->getMessage());
 }
}