BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23895

    Brajesh,

    The theme I use is not custom (https://wordpress.org/themes/editor/). However, I did switch it back to the default theme to check (Twenty Nineteen) and unfortunately, the problem still persists. I’ve tried disabling plugins as well and I could not seem to isolate the problem.

    I see in class-bp-signup.php, line 362, you set the user_status = 2 to mean that the account has not been activated.

    
    public static function add_backcompat( $user_login = '', $user_password = '', $user_email = '', $usermeta = array() ) {
    		global $wpdb;
    
    		$user_id = wp_insert_user( array(
    			'user_login'   => $user_login,
    			'user_pass'    => $user_password,
    			'display_name' => sanitize_title( $user_login ),
    			'user_email'   => $user_email
    		) );
    
    		if ( is_wp_error( $user_id ) || empty( $user_id ) ) {
    			return $user_id;
    		}
    
    		// Update the user status to '2', ie "not activated"
    		// (0 = active, 1 = spam, 2 = not active).
    		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_status = 2 WHERE ID = %d", $user_id ) );
    
    

    As a temporary fix while I try to figure out the root of the problem, is it possible (in the offhand chance that a user is able to login without activation) to check if the user_status == 2, then redirect them to a custom page? Alternatively, in https://example.com/wp-admin/users.php?page=bp-signups, the page generates the IDs of all the accounts that are not activated yet. Is there a way for me to fetch the user IDs for those who are not activated yet? If so, could you provide me with some guidance on how I may approach this?

    I know how to redirect them to a custom page prompting them to activate their account, I am just having problems with trying to check to see if the user is “not activated”.

    Thank you so much in advance.

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23885

    Brajesh,

    I am using the Editor Theme: https://wordpress.org/themes/editor/

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23880

    Brajesh,

    Thank you so much for your help. I was able to figure out how to translate the text with the link you provided.

    As a follow-up, do you know why the confirmation of “your new cover image was uploaded successfully.” is not triggered every time?

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23762

    Brajesh,

    I am avoiding adding unncessary plugins and I am not too familar with poedit.
    However, I was able to find where the warning text is located at:

    
         // Set warning messages. 
            $strings['cover_image_warnings'] = apply_filters( 'bp_attachments_cover_image_ui_warnings', array( 
                'dimensions' => sprintf( 
                        __( 'For better results, make sure to upload an image that is larger than %1$spx wide, and %2$spx tall.', 'buddypress' ),  
                        (int) $cover_dimensions['width'],  
                        (int) $cover_dimensions['height'] 
    

    However, it is under /bp-core/bp-core-attachments.php so I am not going to change it as editing core files is not recommended.

    Is there a way for me to change the text through filters in bp-customs.php? If so, may you provide some guidance on how to do so? Users have said that not having a confirmation after uploading their cover image caused confusion and they were unaware that it was successfully uploaded until they returned back to their profile.

    Thank you so much!

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23577

    Brajesh,

    Would it be possible to make it compatible with WP HTML Mail plugin?
    https://wordpress.org/plugins/wp-html-mail/

    Thank you so much!

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23569

    Brajesh,

    Yes it clarified things for me. Someone suggested changing the core files to this:

    $email->get( ‘content_plaintext’, ‘replace-tokens’ )

    $email->get( ‘content_html’, ‘replace-tokens’ )

    Do you recommend this? And if not, do you know of any good 3rd party smtp plugins that won’t conflict with BP?

    Thanks!
    `

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23189

    Brajesh,

    I found out what was filtering the validation as well and fixed it. It works perfectly now!

    Thank you so much for your help!

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23159

    Brajesh,

    I am not using it on multisite. This is what I see upon typing the word ‘image’ it in: http://prntscr.com/nshmb1
    This is what happens after I press ‘register’: http://prntscr.com/nshnsy
    And upon typing the word image again, this happens: http://prntscr.com/nsho2e

    I am quite unsure as to why this is happening.

    Thank you!

    P.S: I originally had modified the code to allow a minimum of 3 character letters but I changed it back to see if that could be causing the error. Unfortunately, the error still happened.

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23144

    Brajesh,
    Thank you so much for helping me with this.

  • Participant
    Level: Initiated
    Posts: 11
    Mocha on #23124

    Brajesh,

    I have contacted the developer and will let you know as soon as I get their replay. In the mean time I restricted the usernames by inserting the following code into functions.php

    function wpsnippet_validate_username($valid, $username) {
        $restricted = array('profile', 'directory', 'domain', 'download', 'downloads', 'edit', 'editor', 'email', 'ecommerce', 'forum', 'forums', 'favorite', 'feedback', 'follow', 'files', 'gadget', 'gadgets', 'games', 'guest', 'group', 'groups', 'homepage', 'hosting', 'hostname', 'httpd', 'https', 'information', 'image', 'images', 'index', 'invite', 'intranet', 'indice', 'iphone', 'javascript', 'knowledgebase', 'lists','websites', 'webmaster', 'workshop', 'yourname', 'yourusername', 'yoursite', 'yourdomain', 'mod');
        $pages = get_pages();
        foreach ($pages as $page) {
            $restricted[] = $page->post_name;
        }
        if(!$valid || is_user_logged_in() && current_user_can('create_users') ) return $valid;
        $username = strtolower($username);
        if ($valid && strpos( $username, ' ' ) !== false) $valid=false;
        if ($valid && in_array( $username, $restricted )) $valid=false;
        if ($valid && strlen($username) < 5) $valid=false;
        return $valid;
    }
    add_filter('validate_username', 'wpsnippet_validate_username', 10, 2);
     
    function wpsnippet_registration_errors($errors) {
        if ( isset( $errors->errors['invalid_username'] ) )
            $errors->errors['invalid_username'][0] = __( 'ERROR: Invalid username.', 'wpsnippet' );
        return $errors;
    }
    add_filter('registration_errors', 'wpsnippet_registration_errors');
    

    Taken from:
    https://wp-snippet.com/snippets/how-to-restrict-usernames-in-wordpress-without-a-plugin/

    However, the same issue happens where a blacklisted username (mod) first shows as available: https://prnt.sc/nrpy0p,
    then it shows it as being blocked AFTER I click register: http://prntscr.com/nrpygr

    Could you kindly provide some guidance as to why this happens?
    Thank you so much.