Conditional fields

BP Profile Search › Conditional fields

  • Author
    Post
  • #8560 Reply
    Henry
    Guest

    Hi Andrea,

    Thanks for creating such a great plugin. I’m aware it doesn’t yet support conditional field logic so was going to try to add it myself.

    Do you have any tips on the best way to approach this?

    #8561 Reply
    andrea
    Plugin Author

    Hi Henry,

    A good solution could be this plugin:

    https://buddydev.com/plugins/conditional-profile-fields-for-buddypress/

    To make it work with BP Profile Search forms, add this code to your bp-custom.php file, or at least in the page(s) where search forms are displayed:

    add_filter( 'bp_is_conditional_profile_field_active', '__return_true' );

    #8562 Reply
    Henry
    Guest

    Many thanks @andrea, that’s fantastic.

    Henry

    #8563 Reply
    Henry
    Guest

    I’ve been doing some testing this weekend, everything seems to be working great aside from a minor bug which results in fields not being hidden from the search form. I think the issue may relate to the Conditional Profile Fields for BuddyPress plugin. Posting the bug report here for reference:

    https://github.com/sbrajesh/conditional-profile-fields-for-buddypress/issues/8

    #8564 Reply
    andrea
    Plugin Author

    Thanks Henry for your feedback!

    Do you see the bug also in the members Edit Profile page, or only in BP Profile Search forms?

    #8565 Reply
    Henry
    Guest

    Hi Andrea,

    I see the bug in the edit profile page and on BP Profile Search forms.

    Hope this helps.

    #8566 Reply
    andrea
    Plugin Author

    Thank you! Then the issue is most likely unrelated to BP Profile Search, and I’m sure Brajesh will sort it out.

    #8567 Reply
    Henry
    Guest

    Yeah, I thought that too.

    Thanks again,
    Henry

    #8568 Reply
    MIchael
    Guest

    Hi Andrea,
    I have the same problem .
    As you say i add the text add_filter( ‘bp_is_conditional_profile_field_active’, ‘__return_true’ ); to bp-custom.php file but nothing happened.
    in the registration form the Conditional Profile Fields works perfect but in the BP search fields it is not .
    Can you please help .

    Thanks

    #8569 Reply
    andrea
    Plugin Author

    Hi Michael,

    Where is your bp-custom.php? It should be in the /wp-content/plugins/ directory.

    Alternatively, you can add that code to functions.php in your active theme directory.

    Please let me know.

    #8570 Reply
    Michael
    Guest

    Hi Andrea ,
    Thank you for your replay
    right my bp-custom.php located in wp-content/plugins

    This is that i have inside the bp-custom.php by default :

    cat /www/website/public/wp-content/plugins/bp-custom.php
    <?php
    if ( !defined( ‘BP_AVATAR_THUMB_WIDTH’ ) )
    define( ‘BP_AVATAR_THUMB_WIDTH’, 120 ); //change this with your desired thumb width

    if ( !defined( ‘BP_AVATAR_THUMB_HEIGHT’ ) )
    define( ‘BP_AVATAR_THUMB_HEIGHT’, 120 ); //change this with your desired thumb height

    if ( !defined( ‘BP_AVATAR_FULL_WIDTH’ ) )
    define( ‘BP_AVATAR_FULL_WIDTH’, 580 ); //change this with your desired full size,weel I changed it to 260 :)

    if ( !defined( ‘BP_AVATAR_FULL_HEIGHT’ ) )
    define( ‘BP_AVATAR_FULL_HEIGHT’, 580 ); //change this to default height for full avatar

    ?>

    #8571 Reply
    andrea
    Plugin Author

    Hi Michael,

    Your bp-custom.php looks good to me, you can simply add the custom code there or in your theme’s functions.php.

    Please make sure there is only a set of conditional fields in a page. For instance, if you are on the registration page and the registration form contains conditional fields, and the same conditional fields are in a BP Profile Search form inside a sidebar widget, the latter conditional fields won’t work. That’s a limitation of the Conditional Fields plugin.

    When you go to a different page instead, and there is only the BP Profile Search form in the sidebar widget, the conditional fields start working.

    If you still have problems, you could share the URL of your site, either publicly on this forum, or privately in my Contact page.

    #8576 Reply
    Michael
    Guest

    Many Thanks i will try .

Reply to: Conditional fields
My Information