Skip to:
Content
Pages
Categories
Search
Top
Bottom

How I can add conditional profile fields to BuddyPress?


  • edvard1
    Participant

    @edvard1

    Hello all forum members. Recently I encountered the need to add here such fields for profiles, including registration of a new account. Record, give an example. There is a single choice field for the country. And there is a plural list with cities. And it is necessary to make so that cities vary depending on a choice of the country. Well, or so that just changed the field. Found at the moment such a plugin: https://buddydev.com/plugins/conditional-profile-fields-for-buddypress/. But for some reason it does not work for me, maybe this problem arises because of my theme. In advance thanks to all responded =)

Viewing 1 replies (of 1 total)

  • melhergui
    Participant

    @melhergui

    Hi @edvard1 it’s not your theme. The plugin is broken since BP 2.9.1.

    I was having problems with multiple checkboxes and made it work like this:

    File: /conditional-profile-fields-for-buddypress/assets/bp-conditional-field.js

    line 114: jQuery.each( $selected, function (index, $el ) {
    to:       jQuery.each( [$selected], function (index, $el ) {

    And…

    lines 350 to 369:

    var parent_div = jq( jq( element ).parents( '.editfield' ).get(0) );
          
            //;find its parent having class edit field
            if ( !match ) {
                //if the condition did not match, reverse visibility condition
                
                if ( visibility == 'show' ) {
                	visibility = 'hide';
                    
                } else {
                	visibility = 'show';
                }    
            }
            
            if ( !visible ) {
                parent_div.show();
            } else {         
                parent_div.hide();
            } 

    To:

    var parent_div = jq( jq( element ).parents( '.editfield' ).get(0) );
            visible = jq(parent_div).is(':visible');
    
            //;find its parent having class edit field
            if ( match ) {
                //if the condition did not match, reverse visibility condition
                if ( !visible ) {
    	            parent_div.show();
    	        } else {         
    	            parent_div.hide();
    	        }  
            }  

    Hope it helps!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar