• Hi.
    With help from PMPro I’ve been able to create a plugin for a custom dropdown-field in my user-profile-form. This field is set to be required so my users jobtitle will appear in their profile.
    This is the code for this plugin:

    //we have to put everything in a function called on init, so we are sure Register Helper is loaded
    function my_pmprorh_init()
    {
      //don't break if Register Helper is not loaded
      if(!function_exists("pmprorh_add_registration_field"))
      {
        return false;
      }
    
      //define the fields
      $fields = array();
      $fields[] = new PMProRH_Field("stilling", "select", array("profile"=>"only", "required"=>true, "options"=>array("Animat?r","Art Director","Casting Director","Designer 3D","Designer Grafisk","Designer Interaksjon", "Designer Interi?r", "Designer Kl?r", "Designer Kostymer", "Designer M?bel", "Designer Scene", "Designer Web","Dirigent","Fotofraf Film","Fotofraf Natur","Fotofraf TV","Gitarist", "Grafiker", "Kameramann", "Keyboeardis", "Klipper", "Komponist", "Location Scout", "Makeup Artist", "Makeup/FX Artist", "Manusforfatter", "Modell Mann", "Modell Kvinne", "Musiker Folkemusikk", "Musiker Korps", "Musiker Orkester", "Musikkpedagog", "Musikkterapeut", "Organist", "Pianist", "Produksjonsassistent", "Programmerer Spill", "Programmerer Web", "Props Manager", "Regiss?r", "Scenograf",  "Scripter", "Skuespiller Mann", "Skuespiller Kvinne", "Tegner", "Teksforfatter","Tekniker Lyd", "Tekniker Lys", "Tekniker Studio", "Trommeslager", "Trykker", "Video-kunstner", "Vokalist Klassisk","Vokalist Kor",  "Vokalist Metal","Vokalist Rap", "Vokalist Rock"),   "select2options"=>"maximumSelectionSize: 1"));
      pmprorh_add_registration_field("after_email_fields", $fields);
    
      $fields[] = new PMProRH_Field("kj?nn", "select", array("options"=>array("mann"=>"Mann", "kvinne"=>"Kvinne")));
    
      //add the fields into a new checkout_boxes are of the checkout page
      foreach($fields as $field)
        pmprorh_add_registration_field("checkout_boxes", $field);
    
      //that's it. see the PMPro Register Helper readme for more information and examples.
    }
    add_action("init", "my_pmprorh_init");

    I’ve also created a custom form for an advanced search page within my site. This is the code for the radiobuttons:

    <form id="search" name="searchform" method="get" action="<?php bloginfo("url"); ?>">
    <section id="searchMain">
    <input type="search" id="s" name="s" title="Search Blog" placeholder="Search My Website" />
    <button type="submit" value="search" id="searchsubmit">Search</button>
    </section>
    </form>
    <section id="searchOptions">
    <input type="radio" value="all" name="post_type" id="searchOptionsAll" checked /> <label for="searchOptionsAll">S?k i alle</label><br />
    <input type="radio" value="categories" name="post_type" id="searchOptionsCategories" /> <label for="searchOptionsCategories">S?k kun i kategorier</label><br />
    <input type="radio" value="users" name="post_type" id="searchOptionUsers" /> <label for="searchOptionsUsers">S?k i profiler</label><br />
    </section>
    </form>

    Now: HOW can I have the plugin-fields become a search-parameter in the advanced search-form? Or at least have the userprofile which fits the search show up on the resultpage?

  • The topic ‘Link custom form-fields to result-page’ is closed to new replies.