membership_record_sub_move

The Membership 2 membership record sub move function.

Description

membership_record_sub_move( $fromsub_id, $fromlevel_id, $tosub_id, $tolevel_id, $to_order, $user_id ); 

Parameters (6)

0. $fromsub_id
The fromsub id.
1. $fromlevel_id
The fromlevel id.
2. $tosub_id
The tosub id.
3. $tolevel_id
The tolevel id.
4. $to_order
The to order.
5. $user_id
The user id.

Usage

  1. if ( !function_exists( 'membership_record_sub_move' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/addons/newsstream.php'; 
  3.  
  4. // The fromsub id. 
  5. $fromsub_id = null; 
  6.  
  7. // The fromlevel id. 
  8. $fromlevel_id = null; 
  9.  
  10. // The tosub id. 
  11. $tosub_id = null; 
  12.  
  13. // The tolevel id. 
  14. $tolevel_id = null; 
  15.  
  16. // The to order. 
  17. $to_order = null; 
  18.  
  19. // The user id. 
  20. $user_id = null; 
  21.  
  22. // NOTICE! Understand what this does before running. 
  23. $result = membership_record_sub_move($fromsub_id, $fromlevel_id, $tosub_id, $tolevel_id, $to_order, $user_id); 
  24.  

Defined (1)

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

/app_old/membershipincludes/addons/newsstream.php  
  1. function membership_record_sub_move($fromsub_id, $fromlevel_id, $tosub_id, $tolevel_id, $to_order, $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. $fromsub = new M_Subscription( $fromsub_id ); 
  10. $tosub = new M_Subscription( $tosub_id ); 
  11. $fromlevel = new M_Level( $fromlevel_id ); 
  12. $level = new M_Level( $tolevel_id ); 
  13.  
  14. $message = sprintf(__( '<strong>%s</strong> has moved from level <strong>%s</strong> on subscription <strong>%s</strong> to level <strong>%s</strong> on subscription <strong>%s</strong>', 'membership' ), $user->display_name, $fromlevel->level_title(), $fromsub->sub_name(), $level->level_title(), $tosub->sub_name() ); 
  15.  
  16. $wpdb->insert( $table, array( 'newsitem' => $message, 'newsdate' => current_time('mysql') ) ); 
  17.