BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 25211

    Hi Tosin,
    Thank you for the reply.

    Although it is fine to do that, I will rather write a function. If you check, there are 3 things which vary field id, value and error message.

    You can remove the previous code and use the following instead.

    
    
    // forces user to select a specific select field value on registration page.
    add_action( 'bp_signup_validate', function () {
    	bd_tosin_validate_signup_field( 4448, 'I accept', 'This is a required field. You must accept.' );
    
    	// You can uncomment the below function and specify your value. Repeat it as you need.
    	// bd_tosin_validate_signup_field( 2, 'some other value', 'Your error message' );
    	// bd_tosin_validate_signup_field( 2, 'some other value', 'Your error message' );
    
    } );
    
    /**
     * Validates BuddyPress signup field.
     *
     * Makes sure that the user entered value is same as the expected value. If not, the specified error will be shown.
     *
     * @param int $field_id
     * @param string $expected_value expected value to match.
     * @param string $error_message Error message to be shown if the values do not match.
     *
     * @return void
     */
    function bd_tosin_validate_signup_field( $field_id, $expected_value, $error_message = 'Please try again, the value did not match our expectation' ) {
    
    	if ( ! isset( $_POST[ 'field_' . $field_id ] ) ) {
    		return; //should never happen if the field is marked as required.
    	}
    
    	$input_value = wp_unslash( $_POST[ 'field_' . $field_id ] );
    
    	if ( strtolower( $expected_value ) !== strtolower( $input_value ) ) {
    		buddypress()->signup->errors[ 'field_' . $field_id ] = $error_message;
    	}
    }
    

    And you can use it for as many fields as you need.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25211
  • Keymaster
    (BuddyDev Team)
    Posts: 25211

    Hi Eric,

    Welcome to BuddyDev support forums.

    Thank you for letting us know. we will be exploring and updating as needed.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25211
    Brajesh Singh on in reply to: [Resolved] Suggestion #44779

    Hi Tosin,
    thank you for the suggestion.

    Our Profile Data Control already does it.

    Please have a look.
    https://buddydev.com/plugins/buddypress-profile-data-control/

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25211
    Brajesh Singh on in reply to: [Resolved] Buddypress conditional registration #44769

    Hi tosin,
    Please use the following code

    
    
    // forces user to select a specific select field value on registration page.
    add_action( 'bp_signup_validate', function () {
    	$field_id       = 4448; // Your select field id.
    	$accepted_value = 'I accept'; // please change with the value you want to accept.
    
        if ( ! isset( $_POST[ 'field_' . $field_id ] ) ) {
    		return; //should never happen if the field is marked as required.
    	}
    
    	$selected_val = $_POST[ 'field_' . $field_id ];
    
    	if ( strtolower( $accepted_value ) !== strtolower( $selected_val ) ) {
    		buddypress()->signup->errors[ 'field_' . $field_id ] = __( 'This is a required field. You must accept.', 'buddypress' );
    	}
    
    } );
    

    please make sure to update the variable $accepted_value with the actual value which you have used for your selectbox.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25211

    Hi Michael,
    Thank you for your question.

    1. You may use the following css to hide the popular option

    
    .widget_bp_core_members_widget .bp-separator:nth-child(4){
    	display:none;
    }
    .widget_bp_core_members_widget  #popular-members {
    	
    	display:none;
    }
    
    

    2. Yes, It is doable via ajax but I don’t see any existing solution. You will probably need to develop it as a custom solution.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25211

    Hi Greg,
    Thank you.

    I see the reason why that did not work. The site archive page templates do not use our bundled template. It comes from your theme and it seems to me they have it hardcoded. I will be looking into the theme this weekend and get back to you with a proper suggestion.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25211

    Hi Greg,
    Thank you for the reply.

    1. can you please tell me which theme are you using? We do have some of the template specific to theme, so I will check and get back to you. I am assuming the screenshot of post list is from user’s profile? or is it from your site archive page?

    2. sure

    Please let me know and I will assist.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 25211
    Brajesh Singh on in reply to: Profile tab settings #44762
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 25211
    Brajesh Singh on in reply to: registration form plugin #44761

    Hi Fabien,
    Thank you.

    1. I am not sure. I don’t think there is any plugin that works with native wp registration(wp-signup.php or the dashboard->Users->Add New)

    2. That means it is a compatibility issue with PostSMTP and you should report it to them.

    3. As details in other topic, Please contact the theme provide for the assistance.

    I am sorry, I am not being much helpful here as all the 3 issues are related to some compatibility/feature with 3rd party code.

    Regards
    Brajesh