SHARE
TWEET

Untitled

a guest Jun 10th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('frm_setup_edit_fields_vars', 'frm_remove_selected', 20, 2);
  2. add_filter('frm_setup_new_fields_vars', 'frm_remove_selected', 20, 2);
  3. function frm_remove_selected($values, $field){
  4.     if ( in_array( $field->id ==6, array(range(0,60)) ) ) {
  5.         $used = FrmEntryMeta::get_entry_metas_for_field( $field->id );
  6.         if ( $used ) {
  7.             $used_vals = array();
  8.            
  9.             foreach ( $used as $u ) {
  10.                 if ( is_array( $u ) ) {
  11.                     foreach ( $u as $item ) {
  12.                         $used_vals[] = $item;
  13.                         unset($item);
  14.                     }
  15.                 } else {
  16.                     $used_vals[] = $u;
  17.                 }
  18.                 unset($u);
  19.             }
  20.             if ( $field->type == 'data' ) {
  21.                 foreach ( $used_vals as $u ) {
  22.                     if ( isset($values['options'][$u]) ) {
  23.                         unset($values['options'][$u]);
  24.                     }
  25.                     unset($u);
  26.                 }
  27.             } else {
  28.                 $values['options'] = array_diff( $values['options'], $used_vals );
  29.             }
  30.         }
  31.     }
  32.     return $values;
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top