monsterinsights_ajax_set_user_setting

Stores a user setting for the logged in WordPress User.

Description

monsterinsights_ajax_set_user_setting(); 

Usage

  1. if ( !function_exists( 'monsterinsights_ajax_set_user_setting' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = monsterinsights_ajax_set_user_setting(); 
  7.  

Defined (1)

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

/includes/admin/ajax.php  
  1. function monsterinsights_ajax_set_user_setting() { 
  2.  
  3. // Run a security check first. 
  4. check_ajax_referer( 'monsterinsights-set-user-setting', 'nonce' ); 
  5.  
  6. // Prepare variables. 
  7. $name = stripslashes( $_POST['name'] ); 
  8. $value = stripslashes( $_POST['value'] ); 
  9.  
  10. // Set user setting. 
  11. set_user_setting( $name, $value ); 
  12.  
  13. // Send back the response. 
  14. wp_send_json_success(); 
  15. wp_die(); 
  16.