- add_action('formidable_shortcode_atts', 'frm_admin_readonly', 20, 2);
- function frm_admin_readonly( $atts, $all_atts ) {
- if ( $atts['readonly'] == 'administrator' || $atts['readonly'] == 'second-group') {
- global $frm_vars;
- if ( ($atts['readonly'] == 'administrator' && current_user_can('administrator')) ||
- ($atts['readonly'] == 'second-group' && current_user_can('second-group')) ) {
- $frm_vars['readonly'] = 'disabled';
- } else {
- $frm_vars['readonly'] = false;
- }
- }
- }