1. add_action('formidable_shortcode_atts', 'frm_admin_readonly', 20, 2);
  2. function frm_admin_readonly( $atts, $all_atts ) {
  3. if ( $atts['readonly'] == 'administrator' || $atts['readonly'] == 'second-group') {
  4. global $frm_vars;
  5. if ( ($atts['readonly'] == 'administrator' && current_user_can('administrator')) ||
  6. ($atts['readonly'] == 'second-group' && current_user_can('second-group')) ) {
  7. $frm_vars['readonly'] = 'disabled';
  8. } else {
  9. $frm_vars['readonly'] = false;
  10. }
  11. }
  12. }