Skip to:
Content
Pages
Categories
Search
Top
Bottom

Avoid registration email without affecting BuddyBoss Invites


  • josecn
    Participant

    @josecn

    Hello
    I find many codes and plugins that help me to avoid the activation email when members join in the site, but when I tried these options affect the invitation system of buddyboss.
    For example, if I invite a user to join with a specific role “teacher” with the code the join as subscriber. I know I can change the role, but I want to know if it’s possible to automatically detect the role where I invite the user.
    “”function disable_validation( $user_id ) {
    global $wpdb;
    $wpdb->query( $wpdb->prepare( “UPDATE $wpdb->users SET user_status = 0 WHERE ID = %d”, $user_id ) );
    $users = $wpdb->get_results( “SELECT activation_key, user_login FROM {$wpdb->prefix}signups WHERE active = ‘0’ “); foreach ($users as $user) {
    bp_core_activate_signup($user->activation_key);
    BP_Signup::validate($user->activation_key); //fix roles
    $user_id = $wpdb->get_var( “SELECT ID FROM $wpdb->users WHERE user_login = ‘$user->user_login'”); $u = new WP_User( $user_id );
    $u->add_role( ‘subscriber’ );
    }
    } add_action( ‘bp_core_signup_user’, ‘disable_validation’ );
    add_filter( ‘bp_registration_needs_activation’, ‘__return_false’ );
    add_filter( ‘bp_core_signup_send_activation_key’, ‘__return_false’ );”
    Plugin name: BuddyPress Auto Activate Auto Login and BP Disable Activation Reloaded
    Thanks for the help

  • You must be logged in to reply to this topic.
Skip to toolbar