Support

  1. ggaillet
  2. Features Request
  3. Friday, January 17 2020, 11:45 PM
Hello.

I would like to make a field read only on the front end only for a given viewing access levels, and editable on the front end for another viewing access level (or group). Is there a way?
Thanks.
admin Accepted Answer
Admin
Hi,
this is not possible natively but there is a workaround:
- Create a field (for example with alias field_read) available for in user profile page (hidden in registration and edit profile form), this field will be available for all profiles
- Create another field with same name (for example with alias field_write) of previous available in Edit profile page (hidden in profile and registration page), this field will be available only for given viewing access levels
- Create a plugin that copy value from field_write to field_read

Basically "field_write" will be used only to change value in "field_read"

How to create this plugin?
- Download (at the end of docs page at http://docs.easy-profile.com/index.php/article/triggers ), install and enable (Extensions->Plugins) skeleton plugin
- Open the edit the file at /plugins/jsn/skeleton/skeleton.php
- Replace entire code with this
<?php

defined('_JEXEC') or die;

class PlgJsnSkeleton extends JPlugin
{
public function triggerProfileUpdate($user, &$data, $changed, $isNew)
{
if(!$isNew && isset( $data['field_write'] ) )
{
$data['field_read'] = $data['field_write'];
}
}
}
NOTE: this code is not tested and not supported, it is only for example purpose.
  1. more than a month ago
  2. Features Request
  3. # 1
ggaillet Accepted Answer
Thanks. Will try that.
  1. more than a month ago
  2. Features Request
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Online

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.