Is possible change the access to an element with validation php

javier94

Member
i have a checkbox element with 2 options... YES/NO.. 0/1
and i have another fileupload element..

what i need is.. if a value is 0... the element would be accessible, if the value is 1... the element will be not accessible, you can not make nothing..

i have thinking to make a validation.. with some php code.. like,

I would like that if the value of checkbox is 0 ----> the access of fileupload element will be "candidats" a access i have in joomla..

and if the value of checkbos is 1 --> the access of fileupload element will be " ajuntament" other acces i have in joomla.

but i don´t know how to relate with the code, what type of access will have the element.!!!

this would be possible? or maybe there is other way..

Thanks in advance!

Javier
 
I assume you want to change the access per user?

You need a user element in your form.
Create Joomla user group and Joomla access level
Set element access of your fileupload element

In you php code add/remove the the Joomla user group to/from your current user
Joomla\CMS\User\UserHelper::addUserToGroup($uid, $ugroup)
Joomla\CMS\User\UserHelper::removeUserFromGroup($uid, $ugroup)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top