Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

calculator only registred user 31.07.2017 17:41

Hi,

Plaese suggestion for script to insert in to tab "code", for allowed only registred user to use calculator.
Thank you

Re: calculator only registred user 31.07.2017 21:02

Hi,
you have access to all php functions and also to Joomla core classes at your code tab, so you could use the default user object:

$user = JFactory::getUser(); // Get the user object

if ($user->id != 0)
{
// you are logged in
}
else
{
// you are NOT logged in
}


But for the purpouse of restrict the access to calculator form, you have the better option of using default joomla permissions and choose the article or the menu option of the calculator to be accesible only for registered users, at menu options.

Regards
Moonsoft Team
www.moonsoft.es

Re: calculator only registred user 02.08.2017 17:27

Hi,
Thank you for reply,
i tried put the script il tab code but not work.

Re: calculator only registred user 03.08.2017 08:56

Hi,
the above seems valid php code according to joomla docs, we share the official page where you can check how user object can be recovered and handled:


https://docs.joomla.org/Accessing_the_current_user_object

please note you can also use 'guest' property in order to find out if user is currently logged in. (Check 'Determining Status' section to see the code)

If you have problems with the php coding, remember you can use the default menu settings from joomla in order to restrict the access to individual menus.

Hope this helps
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect
FaLang translation system by Faboba

Our clients' feedback