Joomla

Joomla { 25 }

Read 682 times Thursday, 28 April 2016 16:48
$params = JComponentHelper::getParams('com_users');

var_dump($params);

 

Read 2081 times Thursday, 28 April 2016 16:43
$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>';

 

Last modified on Thursday, 28 April 2016 16:47
Read 674 times Thursday, 28 April 2016 16:39
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;
Last modified on Sunday, 22 October 2017 23:17
Read 509 times Thursday, 28 April 2016 16:31
$menu	=  JSite::getMenu();
$item    =  $menu->getActive();

$params	= $menu->getParams($item->id);

$your-id = $params->get('params_name', 0);

 

Last modified on Thursday, 28 April 2016 16:34
Read 815 times Thursday, 28 April 2016 16:27
$uri = 'http://fredbloggs:itsasecret@www.example.com: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";

 

Read 552 times Thursday, 28 April 2016 16:02
include_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'ControllerName' . '.php' );
$controller = new ControllerName(); 
$controller->execute('task');

 

Read 707 times Thursday, 28 April 2016 15:39
<?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();
}
?>
Last modified on Thursday, 28 April 2016 15:42
Read 3043 times Tuesday, 26 April 2016 15:49

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';
	
Last modified on Tuesday, 26 April 2016 20:58
Page 2 of 2