The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Change a specific field to read only after update
Change a specific field to read only after update so they can only update that field once.
So I found the following from the knowledge base but it does not work even after I change the $form_id number to match my form. And I do not know how to target specific fields on the forms... but either way this hook is not changing any of the fields into read only anyway after one update
add_filter('frm_user_can_edit', 'check_user_edit_entry', 10, 2);
function check_user_edit_entry($edit, $args){
$form_id = is_numeric($args['form']) ? $args['form'] : $args['form']->id;
if ( $form_id == 5 ){ //change 5 to the ID of your form
if ( is_numeric( $args['entry'] ) ) {
$entry = FrmEntry::getOne( $entry );
} else {
$entry = $args['entry'];
}
if ( ! current_user_can('administrator') && $entry->created_at != $entry->updated_at ) {
$edit = false;
}
}
return $edit;
}
February 15, 2019 at 3:50 pm
MORE INFO:
I have a view after form submission and i want specific users that can update those views to be able to do the following:
The fields I want updated
field: approved amount
field: account info
The users I want allowed to update:
users: rick & morty
rick & morty can adjust only the "approved amount" field
users: walter & jesse
walter & jesse can adjust only the "account info" field
The fields (approved amount and account info) are set as read only and I want them to be editable by the above users for their respective allowed fields.
Also if possible to allow them to edit that specific field only once as well on top of that.
Discussion closed.