Permissions by "field", Readonly Fields in Frontent Form

More
13 years 3 months ago #18255 by igcorreia
I cam across something I never expected to need, but now I do :D

I am creating a custom Type of content, and a I want to create a Filed called STATE, flexi already have a state condition but that is for Publish, Unpublished, Draft, etc.

I mean is I want to create a custom type of content called TICKET, and a custom Field called Status.

This status is a SELECT type and the options could be:
- Pending, on Delivery, on Approval by Marketing, how nows, anything could be there.

The problem I have is that I want to a simple user registered to add an article, but I only want to show the group of Support Manager this filed and only the Group Administrator could actually change this field.

Does this make sense? Is it possible with Flexiaccess?

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #18257 by ggppdk
FlexiAccess, currently has only view permission.

The simplest and quickest way to do this is to create a template override for the frontend submit/edit form like this:

1. CREATE THE TEMPLATE OVERRIDE

Create folder
'templates/mytemplate/html/com_flexicontent/items/'

inside the above folder copy file:
'components/com_flexicontent/view/items/tmpl/form.php'

2. Edit and customize the file like this:
2.a Find lines:
Code:
if(isset($field->html)){ echo $field->html; } else { echo $noplugin; }
and replace with:
Code:
if (isset($readonly_fieldnames($fieldname))) { JPluginHelper::importPlugin('flexicontent_fields', ($field->iscore ? 'core' : $field->field_type) ); $results = $dispatcher->trigger('onDisplayFieldValue', array( &$field, &$this->item )); echo @$field->display; } else { if(isset($field->html)){ echo $field->html; } else { echo $noplugin; } }

2.b Also at top of file put, just after:
defined( '_JEXEC' ) or die( 'Restricted access' );
put
Code:
$dispatcher = &JDispatcher::getInstance(); $readonly_fieldnames=('myfieldname1'=>'', 'myfieldname2'=>'', 'myfieldname3'=>'');

3. Go to the field configuration and set a default value(s) for your readonly fields, so that they will have an intial value.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #18283 by igcorreia
Thanks for the reply , we will give it a test.

I think I will wait for 1.7 with Flexi to see the new permission. In the new version with ACl, the permission is steel only for view?

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #18291 by ggppdk
Final v2.0 is at least a month away, maybe to use v1.5.6, also the solution i provided, will work very nicely for what you want.

Also there is a way to even override the form.xml file:
check this out:
forum.joomla.org/viewtopic.php?p ... 7#p2375649

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.372 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline