1. Home
  2. Third-Party
  3. Profile Builder Pro integration

Profile Builder Pro integration

With Profile Builder Pro, Cozmolabs launched a plugin that pushed your websites user forms to the next level. It is the all-in-one solution for your user management.

Since Profile Builder Pro also supports custom user meta fields, you may wonder why they are not sent with our webhook triggers by default. This happens because the custom meta is registered after we are firing the actual webhook. 

To also send the custom user meta of Profile Builder Pro, you can simply paste the following piece of code into the functions.php file of your theme. 

add_action( 'user_register', 'wpwhpro_add_llms_user_register', 5, 1 );
add_action( 'profile_update', 'wpwhpro_add_llms_user_register', 5, 1 );
function wpwhpro_add_llms_user_register( $user ){

    if( empty( $user ) || ! is_numeric( $user ) ){
        return;
    }

    $form_fields = apply_filters( 'wppb_change_form_fields', get_option( 'wppb_manage_fields' ), array() );
    if( ! empty( $form_fields ) && is_array( $form_fields ) ){
        foreach( $form_fields as $single ){
            if( isset( $single['meta-name'] ) && ! empty( $single['meta-name'] ) ){
                if( isset( $_REQUEST[ $single['meta-name'] ] ) && ! empty( $_REQUEST[ $single['meta-name'] ] ) ){

                    switch( $_REQUEST[ $single['meta-name'] ] ){
                        case 'ironikus-delete':
                            delete_user_meta( $user, $single['meta-name'] );
                            break;
                        case 'ironikus-clear':
                            update_user_meta( $user, $single['meta-name'], '' );
                            break;
                        case 'ironikus-default':
                            if( isset( $single['default-value'] ) ){
                                update_user_meta( $user, $single['meta-name'], $single['default-value'] );
                            }
                            break;
                        default:
                            update_user_meta( $user, $single['meta-name'], $_REQUEST[ $single['meta-name'] ] );
                            break;
                    }

                }
            }
        }
    }
}
Updated on October 18, 2021

Was this article helpful?

Related Articles