If you update your hosting to v7.1 & more - you can look same notification 'Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; plgContentJw_sigpro has a deprecated constructor in .../www/plugins/content/jw_sigpro/jw_sigpro.php on line 19'

This code fix this problem you need Open plugins/content/jw_sigpro/jw_sigpro.php find this code in line 28:

function plgContentJw_sigpro(&$subject, $params)
	{
		parent::__construct($subject, $params);
		// Define the DS constant under Joomla! 3.0
		if (!defined('DS'))
		{
			define('DS', DIRECTORY_SEPARATOR);
		}
	}

 And replase it to this code:

public function __construct(&$subject, $params) {
	parent::__construct($subject, $params);
	// Define the DS constant under Joomla! 3.8.2+
	if (!defined('DS')){
		define('DS', DIRECTORY_SEPARATOR);
	}
}

Awesome - it work done! :-)

If you see same problem with jw_sig.php  - just download free new plugin from GitHub and install it: https://github.com/joomlaworks/simple-image-gallery

To continue with the tips to improve Joomla website performance, in the previous part, I had introduced how to use caching and .htaccess Optimization Rules, in this part, I will show you some other tips and hope you find it useful.

Joomla Compression

This is also an effective feature to optimize your website performance. When you enable this feature, the web page will be compressed and of course, the compressed page will take less time to load. Here is the way to enable Joomla Compression:

If you want to check the speed of your Joomla website, let’s start with speed test first. It can be said that site speed is one of the most important factors that affect directly a site performance. All your effort put into user-friendly interface, conversion rate optimization, high-quality content, and other things will not make sense if your page takes visitors too much time for loading.

Of course, I do not deny that Joomla is one of the most powerful CMS and the best choice for any business owners who want to have websites easily but it had better improve your site speed continuously. You can increase the speed of your Joomla site by using its inbuilt features and follow the tips I will mention in this article.

During 2017, we have heard a lot of opinions that this year has been too gloomy for Joomla. However, we think that this year is so important because it is the stepping stone for the explosion in 2018 when we prepare to welcome Joomla! 4.0 and Joomla! Framework 2.0. In addition to introducing several new features, including a fully rebuilt Media Manager, an enhanced event dispatching system, and new security features such as support for prepared SQL statements, we have also been doing some routine maintenance and paying off some of our project’s technical debt by retiring deprecated code and raising the minimum supported software stack. And, with this released version, we also require PHP 7.

// Unset unwanted Scripts - by name
$unset_scripts = array(
	'k2',
	'...',
);
foreach($this->_scripts as $name=>$script)
{
	if (!preg_match('#(' . implode('|', $unset_scripts) . '#i', $name))
	{
		continue;
	}
	unset($this->_scripts[$name]);
}

or if you use joomla v3.8.1 you can try this php code:

<?php
	$doc = JFactory::getDocument();
	unset($doc->_scripts[JURI::root(true) . '/media/system/js/mootools-more.js']);
	unset($doc->_scripts[JURI::root(true) . '/media/system/js/mootools-core.js']);
	unset($doc->_scripts[JURI::root(true) . '/media/system/js/core.js']);
	unset($doc->_scripts[JURI::root(true) . '/media/system/js/modal.js']);
	unset($doc->_scripts[JURI::root(true) . '/media/system/js/caption.js']);
	unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery.min.js']);
	unset($doc->_scripts[JURI::root(true) . '/media/jui/js/jquery-noconflict.js']);
	unset($doc->_scripts[JURI::root(true) . '/media/jui/js/bootstrap.min.js']);
?>

if you wand disable all js & css scripts - use code:

$doc->_scripts     = null;
$doc->_script      = null;
$doc->_styleSheets = null;

 

joomla 3.6.4 default template c215a

To disable scripts you can insert here the php code in the head pattern

<?php
unset($this->_scripts[$this->baseurl.'/media/system/js/mootools-core.js'], 
	$this->_scripts[$this->baseurl.'/media/system/js/mootools-more.js'],
	$this->_scripts[$this->baseurl.'/media/system/js/core.js'],
	$this->_scripts[$this->baseurl.'/media/jui/js/bootstrap.min.js'],
	$this->_scripts[$this->baseurl.'/media/jui/js/jquery.min.js'],
	$this->_scripts[$this->baseurl.'/media/jui/js/jquery-noconflict.js'],
	$this->_scripts[$this->baseurl.'/media/jui/js/jquery-migrate.min.js'],
	$this->_scripts[$this->baseurl.'/media/system/js/caption.js']);
if( isset($this->_script['text/javascript']) ) {
        $this->_script['text/javascript'] = preg_replace('\.addEvent\(\'load\',\s*(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']);
        if( empty($this->_script['text/javascript']) )
        unset( $this->_script['text/javascript'] );
};
?>

In new version Kunena 4x copyright location in root_folder/libraries/kunena/view.php

Find function on line 729 and replace it with my version or comments line 9 and 20:

// line 749
final public function poweredBy()
	{
		if ($this->inLayout)
		{
			throw new LogicException(sprintf('HMVC template should not call %s::%s()', __CLASS__, __FUNCTION__));
		}
		/* In here we are comment credits
		$credits = '<div style="text-align:center">';
		$credits .= JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view;=credits', JText::_('COM_KUNENA_POWEREDBY'), '', '', 'follow', array('style'=>'display: inline; visibility: visible; text-decoration: none;'));
		$credits .= ' <a href="https://www.kunena.org" rel="follow" target="_blank" style="display: inline; visibility: visible; text-decoration: none;">'.JText::_('COM_KUNENA').'</a>';
		if ($this->ktemplate->params->get('templatebyText'))
		{
			$credits .= ' :: <a href ="'. $this->ktemplate->params->get('templatebyLink').'" rel="follow" target="_blank" style="text-decoration: none;">' . $this->ktemplate->params->get('templatebyText') .' '. $this->ktemplate->params->get('templatebyName') .'</a>';
		}
		$credits .= '</div>';
		*/
		$credits = '';
	}
// end in line 749

Its work well!

Krikor say "This is unrelated of the recent updates. This is to either a template issue (unclosed HTML tags) or if it happens only in particular items, it means that there are unclosed HTML tags in these items."

Try go to administrator, System -> Global Configuration -> Server -> Error Reporting: select "None"

$mainframe = JFactory::getApplication();
echo $mainframe->getCfg('sef');

 

<?php
// получаем параметры компонента com_users
$params = JComponentHelper::getParams('com_users');
// устанавливаем требуемое значение
$params->set('guest_usergroup', '1');
// записываем измененные параметры в БД
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->update($db->quoteName('#__extensions'));
$query->set($db->quoteName('params') . '= ' . $db->quote((string)$params));
$query->where($db->quoteName('element') . ' = ' . $db->quote('com_users'));
$query->where($db->quoteName('type') . ' = ' . $db->quote('component'));
$db->setQuery($query);
$db->execute();
?>

In this example, it is important to pay attention to the reduction of the variable $params to string. As a result of this reduction JRegistry object it will be converted into JSON format and you want to record in the field params #__extensions table.

<?php
// SEF-link
$url = 'http://www.site.com/index.php/using-joomla/parameters';
$uri = JURI::getInstance($url);
$app = & JFactory::getApplication('site');
$router = & $app->getRouter();
$vars = $router->parse($uri);
$parts = array();
foreach($vars as $k => $v) {
    $parts[] = $k . '=' . $v;
}
// non SEF link
$nonSefUrl = JURI::base() . 'index.php?' . implode('&', $parts);
?>

 

$params = JComponentHelper::getParams('com_users');
var_dump($params);

 

$catid = JRequest::getInt( 'catid', 1, 'get' );
$articleid = JRequest::getInt( 'id', 1, 'get' );

Or you can use enother choise

$uri = JURI::getInstance();
$app = & JFactory::getApplication('site');
$router = & $app->getRouter();
$getParams = $router->parse($uri);
echo '<pre>'; print_r ($getParam); echo '</pre>';

 

public static function getUserId($username)
{
    $db = JFactory::getDbo();
    $query = $db->getQuery(true)
        ->select($db->quoteName('id'))
        ->from($db->quoteName('#__users'))
        ->where($db->quoteName('username') . ' = ' . $db->quote($username));
    $db->setQuery($query, 0, 1);
    return $db->loadResult();
}

And you can use JUserHelper:

$username = 'admin';
$userId    = JUserHelper::getUserId($username);
echo $userId;
Thursday, 28 April 2023 16:31

How I can get params from joomla menu

$menu	=  JSite::getMenu();
$item    =  $menu->getActive();
$params	= $menu->getParams($item->id);
$your-id = $params->get('params_name', 0);

 

Thursday, 28 April 2023 16:27

How can parse URL in joomla

$uri = 'http://fredbloggs:[email protected]:8080/path/to/Joomla/index.php?task=view&id;=32#anchorthis';
$u =& JURI::getInstance( $uri );
echo 'URI is ' . $u->toString() . "\n";
$u->parse( 'https://www.example.com/joomla/index.php' ); echo 'URI is ' . $u->toString() . "\n";

 

<?php
$user_  = JFactory::getUser();
$db     = JFactory::getDBO();
    // Get user group
foreach($user_->groups as $group){
    $query  = ' SELECT title FROM #__usergroups ';
    $query .= ' WHERE id = ' . $group;
    $db->setQuery( $query );
    echo 'User Group: ' . $db->loadResult();
}
?>

Check on the user group membership in joomla:

	/*
	* Function 
	*/
function getAccess($groups=array(), $user_id=0)
	{
		if ($user_id == 0) $user_id = JFactory::getUser()->id;
		echo $user_id;
		if (count($groups) == 0 || $user_id == 0) return false;
		return (count(array_intersect(JFactory::getUser($user_id)->getAuthorisedGroups(), $groups))>0);
	}
// Print groups user id 
	print_r($user_id = $user->getAuthorisedGroups());
// Output Group Access Permissions
    $groups = array(18, 8);// an array of groups separated by commas
    if(getAccess( $groups)) echo 'Access granted to groups 18 and 8';
	

In the template index.php is sufficient to indicate the following code:

$document = &JFactory;::getDocument();
$document->setGenerator('');

 Or, as I did - after calling jdoc head prescribe its own installation of the generator:

<jdoc:include type="head" />
<?php $this->setGenerator('Hooray Orthodox dunce!'); ?>