• Resolved indetailan10

    (@indetailan10)


    Hi, I please need to find out if there is a way to set the location as a required field on the user submitted advert?

    If there is a way – Please can someone help me out, if not is there a way we can request for the next update?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi, you can make the location required by adding the code below to your theme functions.php file

    
    add_filter( "adverts_form_load", "customize_adverts_add" );
    function customize_adverts_add( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "adverts_location" ) {
            $form["field"][$key]["validator"] = array();
            $form["field"][$key]["validator"][] = array( "name"=> "is_required" );
        }
      }
      return $form;
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Location Required Field’ is closed to new replies.