Advertisement
verygoodplugins

Untitled

Jul 9th, 2019
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. function add_enrollment_dates( $user_id ) {
  2.  
  3.     $update_data = array();
  4.     $student     = new LLMS_Student( $user_id );
  5.  
  6.     $membership_levels = get_posts(
  7.         array(
  8.             'post_type' => 'llms_membership',
  9.             'nopaging'  => true,
  10.             'fields'    => 'ids',
  11.         )
  12.     );
  13.  
  14.     foreach ( $membership_levels as $id ) {
  15.         $update_data[ 'llms_enrolled_' . $id ] = $student->get_enrollment_date( $id );
  16.     }
  17.  
  18.     wp_fusion()->user->push_user_meta( $user_id, $update_data );
  19.  
  20. }
  21.  
  22. add_action( 'wpf_batch_users_meta', 'add_enrollment_dates' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement