ID] ) && is_array( $options[$current_user->ID] ) ) { $value = isset( $options[$current_user->ID][$option] ) ? $options[$current_user->ID][$option] : null; } else { $value = null; } } if ( $value == null ) { $value = $default; } return $value; } /** * Updates a setting. * * @param string $option the option's id * @param mixed $new_value the new value */ function update_option( $option, $new_value ) { $current_user = wp_get_current_user(); if ( !empty( $current_user ) ) { $options = get_option( 'affiliates_plugin' ); if ( !is_array( $options ) ) { $options = array( $current_user->ID => array() ); } $options[$current_user->ID][$option] = $new_value; update_option( 'affiliates_plugin', $options ); } } /** * Deletes a setting. * * @param string $option the option's id */ function delete_option( $option ) { $current_user = wp_get_current_user(); if ( !empty( $current_user ) ) { $options = get_option( 'affiliates_plugin' ); if ( isset( $options[$current_user->ID][$option] ) ) { unset( $options[$current_user->ID][$option] ); update_option( 'affiliates_plugin', $options ); } } } /** * Deletes all settings. */ function flush_options() { delete_option( 'affiliates_plugin' ); } } ?>