Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_custom_meta_field( $meta_fields ) {
- $membership_levels = get_posts(
- array(
- 'post_type' => 'llms_membership',
- 'nopaging' => true,
- 'fields' => 'ids'
- )
- );
- foreach ( $membership_levels as $id ) {
- $meta_fields[ 'llms_enrolled_' . $id ] = array( 'label' => 'Enrolled in ' . get_the_title( $id ), 'type' => 'date', 'group' => 'lifterlms' );
- }
- return $meta_fields;
- }
- add_filter( 'wpf_meta_fields', 'add_custom_meta_field', 20 );
- function added_to_membership( $user_id, $membership_id ) {
- if ( function_exists( 'wp_fusion' ) ) {
- wp_fusion()->user->push_user_meta( $user_id, array( 'llms_enrolled_' . $membership_id => time() ) );
- }
- }
- add_action( 'llms_user_added_to_membership_level', 'added_to_membership', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement