Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. function wpf_sync_course_url( $user_id, $course_id, $access_list, $remove ) {
  2.  
  3.     if ( ! $remove ) {
  4.  
  5.         $update_data = array( 'ld_course_url' => get_the_permalink( $course_id ) );
  6.  
  7.         wp_fusion()->user->push_user_meta( $user_id, $update_data );
  8.  
  9.     }
  10.  
  11. }
  12.  
  13. add_action( 'learndash_update_course_access', 'wpf_sync_course_url', 10, 4 );
  14.  
  15. function add_course_url_field( $meta_fields ) {
  16.  
  17.     $meta_fields['ld_course_url'] = array(
  18.         'label' => 'Course URL',
  19.         'group' => 'learndash_progress',
  20.     );
  21.  
  22.     return $meta_fields;
  23.  
  24. }
  25.  
  26. add_filter( 'wpf_meta_fields', 'add_course_url_field' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement