How can I add a default min and max age range?

Home Forums BP Profile Search Forum How can I add a default min and max age range?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #10415 Reply
    Daniel Forteza
    Guest

    Hi Andrea,

    How can I add a default min and max age range? Any coding I should add?

    See snapshot: https://prnt.sc/qz8

    #10416 Reply
    andrea
    Keymaster

    Hi Daniel,

    Here is a sample code that you can add to your bp-custom.php:

    add_action ('bps_field_before_search_form', 'set_defaults');
    function set_defaults ($f)
    {
    	if ($f->code == 'field_4')
    	{
    		$f->value['min'] = 18;
    		$f->value['max'] = 99;
    	}
    }
    #10669 Reply
    Daniel
    Guest

    Hi,

    I would like to make the change for the age with a drop-down list in my type form. Can you tell me where the “bp-custom.php” file is located ?

    Thank you

    #10670 Reply
    andrea
    Keymaster

    Hi Daniel,

    bp-custom.php is located in wp-content/plugins, but if you don’t find it you can create it yourself.

    #10696 Reply
    Daniel
    Guest

    Thank you, Andrea!

    #10699 Reply
    andrea
    Keymaster

    You’re welcome!

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: How can I add a default min and max age range?
Your information: