Hi folks,
I can't get my DBRead condition to work
If I use following condition it works fine, but this is too restrictive, because it would disable the form most of the users
When I tried to specifize the condition with the following code it works no more... the goal was to restrict the view of users of the usergroup with the id 16, but let everyone else who is not part of that group see all database entries
greetings
I can't get my DBRead condition to work
If I use following condition it works fine, but this is too restrictive, because it would disable the form most of the users
<?php
$user = JFactory::getUser();
return array( "text39" => $user->get('id'))
?>
When I tried to specifize the condition with the following code it works no more... the goal was to restrict the view of users of the usergroup with the id 16, but let everyone else who is not part of that group see all database entries
<?php
$user = JFactory::getUser();
if($user->get('groups') = 16) {
return array( "text39" => $user->get('id'))
}else {
return array()
}
?>
greetings
Hello gate,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
What decides if clientside validation is enabled?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
What decides if clientside validation is enabled?
P.S: I'm just an automated service😉
Hi gate,
If you are trying to block access to the form then you need an Authenticator action.
Or this is not what you are trying to do ?
Regards,
Max
If you are trying to block access to the form then you need an Authenticator action.
Or this is not what you are trying to do ?
Regards,
Max
Hi Max,
no, you've got it wrong.
I don't want to block the access to the form itself, but to the database entries, which are loaded into the form.
This condition compares the user-id with the database field "text39" and gives back all the database entries where they are matching, nontheless the usergroup.
But I want to use this condition only for users with the group-id '16', for every other user, the form should load all database entries. I thought the easiest way to accomplish this, was to use an "if-clause", but I can't get it to work correctly
greetings
no, you've got it wrong.
I don't want to block the access to the form itself, but to the database entries, which are loaded into the form.
<?php
$user = JFactory::getUser();
return array( "text39" => $user->get('id'))
?>
This condition compares the user-id with the database field "text39" and gives back all the database entries where they are matching, nontheless the usergroup.
But I want to use this condition only for users with the group-id '16', for every other user, the form should load all database entries. I thought the easiest way to accomplish this, was to use an "if-clause", but I can't get it to work correctly
greetings
Ok, I think $user->get('groups') returns an array, so you need to change your previous code to:
Regards,
Max
Later: fixed typos, Bob
if( in_array( 16, $user->get('groups') ) ) {
Regards,
Max
Later: fixed typos, Bob
This topic is locked and no more replies can be posted.
