AtD_update_options

Saves set of user options specified by $name from POST data.

Description

AtD_update_options( $user_id, (string) $name ); 

Parameters (2)

0. $user_id
The user id.
1. $name (string)
The name.

Usage

  1. if ( !function_exists( 'AtD_update_options' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/after-the-deadline/config-options.php'; 
  3.  
  4. // The user id. 
  5. $user_id = null; 
  6.  
  7. // The name. 
  8. $name = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = AtD_update_options($user_id, $name); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/after-the-deadline/config-options.php  
  1. function AtD_update_options( $user_id, $name ) { 
  2. /** We should probably run $_POST[name] through an esc_*() function... */ 
  3. if ( isset( $_POST[$name] ) && is_array( $_POST[$name] ) ) { 
  4. $copy = array_map( 'strip_tags', array_keys( $_POST[$name] ) ); 
  5. AtD_update_setting( $user_id, AtD_sanitize( $name ), implode( ', ', $copy ) ); 
  6. } else { 
  7. AtD_update_setting( $user_id, AtD_sanitize( $name ), ''); 
  8.  
  9. return;