• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Readonly ONLY for logged-in users

Readonly ONLY for logged-in users 4 years 2 months ago #40989

  • thefbi
  • thefbi's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 1
Hello,
i try to do a readonly field, but only for logged-in users.

I have this code in the default value for get data from user if logged in :
//<code>
$user   = JFactory::getUser();
$db   = JFactory::getDbo();
$userId  = $user->get('id');
 
// Is the user logged in?
if ($userId) {
  // Grab the value from the database.
    $db->setQuery("SELECT `firstname` FROM `#__jsn_users` WHERE `id`='".$userId."'");
    return $db->loadResult();
}
//</code>

So i have try to put this code in the attribute field :
if ($userId) {
    echo ' "readonly" '
}

So the field is readonly, but not only for logged-in users, for all users....

Have you an idea for the right code to put (if it is possible) ?

Regards

Joomla 3.9.24
RSForm Pro 2.3.20
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!