Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function my_add_user_role( $user_id, $role ) {
- if ( ! function_exists( 'wp_fusion' ) ) {
- return;
- }
- if ( 'enabled' == $role ) {
- wp_fusion()->user->user_register( $user_id );
- }
- }
- add_action( 'add_user_role', 'my_add_user_role', 10, 2 );
- add_action( 'set_user_role', 'my_add_user_role', 10, 2 );
- function my_wpf_user_register( $post_data, $user_id ) {
- $company_email = get_user_meta( $user_id, '_company_email', true );
- if ( ! empty( $company_email ) ) {
- $post_data['user_email'] = $company_email;
- }
- return $post_data;
- }
- add_filter( 'wpf_user_register', 'my_wpf_user_register', 10, 2 );
- add_filter( 'wpf_user_update', 'my_wpf_user_register', 10, 2 );
- function my_wpf_get_contact_id_email( $email_address, $user_id ) {
- $company_email = get_user_meta( $user_id, '_company_email', true );
- if ( ! empty( $company_email ) ) {
- $email_address = $company_email;
- }
- return $email_address;
- }
- add_filter( 'wpf_get_contact_id_email', 'my_wpf_get_contact_id_email', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement