mosConfig_ ... and other parameters

Moderator: mcsmom

Post Reply
bpatient
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jul 20, 2006 7:15 am

mosConfig_ ... and other parameters

Post by bpatient » Tue Feb 26, 2008 1:31 pm

Most of these info are scattered around the forum, apart from the last bit for user registration. That part took me a while to figure it out.

Code: Select all

	$mosConfig_live_site = JURI::base(true);   
Accessing configuration.php

Code: Select all

	
$mosConfig_sitename  = $mainframe->getCfg('sitename');	
$mosConfig_mailfrom  = $mainframe->getCfg('mailfrom');
$mosConfig_fromname  = $mainframe->getCfg('fromname');	

Locating the parameters from Global Configuration for user registration.
I found it easier to create an ini file to access the variables instead of using an array. Not sure if there are any performance issues. :pop :pop

Code: Select all

    


 $table =& JTable::getInstance('component');
$table->loadByOption( 'com_users' );

# create an ini file - easier to access the variables
file_put_contents("tmp/params.ini", $table->params);
$params = parse_ini_file("tmp/params.ini");
# delete the file
unlink("tmp/params.ini");

$mosConfig_allowUserRegistration = $params['allowUserRegistration'];
$mosConfig_useractivation = $params['useractivation'];

Code: Select all

 $my =& JFactory::getUser();
// $my->id now becomes
    $my->get('id');
I will be adding more, as I go along to this thread.
:pop

bpatient
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jul 20, 2006 7:15 am

Re: mosConfig_ ... and other parameters

Post by bpatient » Wed Feb 27, 2008 11:21 am

It appears that I've been taking the long way for the user configuration parameters.

An even easier way is this:

Code: Select all

	$usersConfig = &JComponentHelper::getParams( 'com_users' );
	$mosConfig_allowUserRegistration = $usersConfig->get( 'allowUserRegistration' );
	$mosConfig_useractivation  = $usersConfig->get( 'useractivation' );
Also, I've found an excellent thread http://forum.joomla.org/viewtopic.php?f=304&t=177581
listing most changes between 1.5 and 1.0 variables. :laugh:


Post Reply