• bgrobertson

    (@bgrobertson)


    Hi, I am using PMPro Register Helper to add fields to checkout. I am trying to add a few checkboxes for users to select their interests. They are displaying correct on the page and they are displaying in the backend admin page, but the only problem is that even if a user only checks one box all are checked in their profile in the backend. Have I formatted checkboxes incorrectly? Here’s the code:

    $fields[] = new PMProRH_Field(
            "interests",              // input name, will also be used as meta key
            "checkbox",                 // type of field
            array(
               "text"=>"Swimming",
               "class"=>'interests',
               "profile"=>true    // show in user profile
            ));
        $fields[] = new PMProRH_Field(
            "interests",              // input name, will also be used as meta key
            "checkbox",                 // type of field
            array(
               "text"=>"Running",
               "class"=>'interests',
               "profile"=>true,    // show in user profile
               "showmainlabel"=>false
            ));
        $fields[] = new PMProRH_Field(
            "interests",              // input name, will also be used as meta key
            "checkbox",                 // type of field
            array(
               "text"=>"Cycling",
               "class"=>'interests',
               "profile"=>true,    // show in user profile
               "showmainlabel"=>false
            ));
        $fields[] = new PMProRH_Field(
            "interests",              // input name, will also be used as meta key
            "checkbox",                 // type of field
            array(
               "text"=>"Triathlon",
               "class"=>'interests',
               "profile"=>true,    // show in user profile
               "showmainlabel"=>false
            ));

    Thanks in advance!

    https://wordpress.org/plugins/paid-memberships-pro/

Viewing 1 replies (of 1 total)
  • Plugin Author Kim Coleman

    (@kimannwall)

    Yes – your “input name” needs to be unique. So you could update each to interests_running, interests_cycling, …

Viewing 1 replies (of 1 total)
  • The topic ‘Checkbox checked by default’ is closed to new replies.