membership_record_level_move

The Membership 2 membership record level move function.

Description

membership_record_level_move( $fromlevel_id, $tolevel_id, $user_id ); 

Parameters (3)

0. $fromlevel_id
The fromlevel id.
1. $tolevel_id
The tolevel id.
2. $user_id
The user id.

Usage

  1. if ( !function_exists( 'membership_record_level_move' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/addons/newsstream.php'; 
  3.  
  4. // The fromlevel id. 
  5. $fromlevel_id = null; 
  6.  
  7. // The tolevel id. 
  8. $tolevel_id = null; 
  9.  
  10. // The user id. 
  11. $user_id = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = membership_record_level_move($fromlevel_id, $tolevel_id, $user_id); 
  15.  

Defined (1)

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

/app_old/membershipincludes/addons/newsstream.php  
  1. function membership_record_level_move($fromlevel_id, $tolevel_id, $user_id) { 
  2.  
  3. global $wpdb; 
  4.  
  5. $table = membership_db_prefix($wpdb, 'membership_news'); 
  6.  
  7. // Get the information 
  8. $user = new WP_User( $user_id ); 
  9. $fromlevel = new M_Level( $fromlevel_id ); 
  10. $tolevel = new M_Level( $tolevel_id ); 
  11.  
  12. $message = sprintf(__( '<strong>%s</strong> has moved from level <strong>%s</strong> to level <strong>%s</strong>', 'membership' ), $user->display_name, $fromlevel->level_title(), $tolevel->level_title() ); 
  13.  
  14. $wpdb->insert( $table, array( 'newsitem' => $message, 'newsdate' => current_time('mysql') ) ); 
  15.