Viewing 4 reply threads
  • Author
    Posts
    • #7849
      mikearsenault
      Participant

      Hello there!

      I am just starting to get into using the plugin for development, and I am already running into a few issues that I don’t know how to resolve:

      1. My customized field group is showing up no problems when I edit a user, but not when I create a new user. Is there a flag or something I have to set in order to make these fields show up on the new user form?

      2. The ‘value’ field doesn’t seem to work on select lists. I want the prov/state in my code below to default to Manitoba, but despite setting the value to Manitoba’s key value of ‘MB’, the first province in the list is the one that comes up.

      3. Is there a way using Piklist to remove or hide core wordpress user fields like Website?

      Here is my code, please let me know if there are answers to any of these issues as I can’t really make use of this plug-in on the strength of the documentation alone.

      <?php
      /*
      Title: FRCC Member Registration Information 
      */
      ?>
      
      <?php
      
        piklist('field', array(
          'type' => 'group'
          ,'field' => 'address_group'
          ,'label' => 'ADDRESS INFORMATION<br /><br /><span style="font-weight: normal;">Please enter your address information:</span>'
          ,'list' => false
          ,'fields' => array(
            array(
              'type' => 'text'
              ,'field' => 'address_1'
              ,'label' => 'Street Address'
              ,'required' => true
              ,'columns' => 6
              ,'attributes' => array(
                'placeholder' => 'Street Address'
              )
            )
            ,array(
              'type' => 'text'
              ,'field' => 'address_2'
              ,'label' => 'PO Box, Suite, etc.'
              ,'columns' => 6
              ,'attributes' => array(
                'placeholder' => 'PO Box, Suite, etc.'
              )
            )
            ,array(
              'type' => 'text'
              ,'field' => 'city'
              ,'label' => 'City'
              ,'required' => true
              ,'columns' => 6
              ,'attributes' => array(
                'placeholder' => 'City'
              )
            )
            ,array(
              'type' => 'select'
              ,'field' => 'prov-state'
              ,'label' => 'Prov/State'
              ,'required' => true
              ,'value' => 'MB'
              ,'columns' => 3
              ,'choices' => array(
              'Canada' => array(
              'first' => 'Alberta', 'second' => 'British Columbia', 'third' => 'Manitoba', 'NB' => 'New Brunswick', 'NL' => 'Newfoundland', 'NS' => 'Nova Scotia', 'NU' => 'Nunavut', 'ON' => 'Ontario', 'PE' => 'Prince Edward Island', 'QC' => 'Quebec', 'SK' => 'Saskatchewan', 'NT' => 'Northwest Territories', 'YT' => 'Yukon Territory', 'AA' => 'Armed Forces Americas', 'AE' => 'Armed Forces Europe, Middle East, and Canada'),
              'USA' => array(
              'AK' => 'Alaska', 'AL' => 'Alabama', 'AP' => 'Armed Forces Pacific', 'AR' => 'Arkansas', 'AS' => 'American Samoa', 'AZ' => 'Arizona', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DC' => 'District of Columbia', 'DE' => 'Delaware', 'FL' => 'Florida', 'FM' => 'Federated States of Micronesia', 'GA' => 'Georgia', 'GU' => 'Guam', 'HI' => 'Hawaii', 'IA' => 'Iowa', 'ID' => 'Idaho', 'IL' => 'Illinois', 'IN' => 'Indiana', 'KS' => 'Kansas', 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'MA' => 'Massachusetts', 'MD' => 'Maryland', 'ME' => 'Maine', 'MH' => 'Marshall Islands', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MO' => 'Missouri', 'MP' => 'Northern Mariana Islands', 'MS' => 'Mississippi', 'MT' => 'Montana', 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'NE' => 'Nebraska', 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NV' => 'Nevada', 'NY' => 'New York', 'OH' => 'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'PR' => 'Puerto Rico', 'PW' => 'Palau', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', 'VA' => 'Virginia', 'VI' => 'Virgin Islands', 'VT' => 'Vermont', 'WA' => 'Washington', 'WV' => 'West Virginia', 'WI' => 'Wisconsin', 'WY' => 'Wyoming')
            )
            )
            ,array(
              'type' => 'text'
              ,'field' => 'postal_zip'
              ,'label' => 'Postal/Zip Code'
              ,'required' => true
              ,'columns' => 3
              ,'attributes' => array(
                'placeholder' => 'Postal/ZIP Code'
              )
            )
          )
          
        ));
    • #7963
      lcwlfr
      Participant

      I am replying to bullet point #2, because I am encountering the same problem:

      value parameter doesn’t seem to wirk inside group fields… It has nothing to do with the select field, but with the fact that it is inside a group field.

      I guess it is a problem with value, since the output of a html field inside a group field only shows the field-label, not the actual html, which is also set using value.

      <?php
      /*
      Title: Page builder
      Post Type: page
      order: 1
      */
      
      // Taken from the Piklist addons demo.
      
         piklist('field', array(
              'type' => 'select'
              ,'field' => 'module_selects'
              ,'label' => 'Select a Module'
              ,'columns' => 12
              ,'value' => 'module' //works!
              ,'choices' => array(
                'none' => 'Select a Module to add'
                ,'module' => 'Editor'
                ,'repeating_module' => 'Repeating Textarea'
              )
            ));
      
         piklist('field', array(
            'type' => 'html'
            ,'label' => 'html field label'
            ,'value' => '<i style="background-color: grey; color: #fff; padding: 5px;">HTML output</i>'
         ));
      
         piklist('field', array(
          'type' => 'group'
          ,'field' => 'module_group'
          ,'label' => 'Page Modules'
          ,'description' => 'Page Modules'
          ,'fields' => array(
            array(
              'type' => 'select'
              ,'field' => 'module_select'
              ,'label' => 'Select a Module'
              ,'columns' => 12
              ,'value' => 'module' //doesn't work inside a group field
              ,'choices' => array(
                'none' => 'Select a Module to add'
                ,'module' => 'Editor'
                ,'repeating_module' => 'Repeating Textarea'
              )
            )
            ,array(
               'type' => 'html'
               ,'label' => 'html field label'
               ,'value' => '<i style="background-color: grey; color: #fff; padding: 5px;">HTML output</i>' //doesn't work inside a group field
            )
            ,array(
              'type' => 'editor'
              ,'field' => 'module_editor'
              ,'columns' => 12
              ,'options' => array(
                'wpautop' => true
                ,'media_buttons' => false
                ,'tabindex' => ''
                ,'editor_css' => ''
                ,'editor_class' => true
                ,'teeny' => false
                ,'dfw' => false
                ,'tinymce' => true
                ,'quicktags' => true
              )
              ,'conditions' => array(
                array(
                  'field' => 'module_group:module_select'
                  ,'value' => 'module'
                )
              )
            )
            ,array(
              'type' => 'textarea'
              ,'field' => 'module_title'
              ,'label' => 'Module title:'
              ,'columns' => 12
              ,'add_more' => true
              ,'attributes' => array(
                'class' => 'large-text'
                , 'rows' => 2
              )
              ,'conditions' => array(
                array(
                  'field' => 'module_group:module_select'
                  ,'value' => 'repeating_module'
                )
              )
            )
          
          )
        )); 
      Attachments:
      You must be logged in to view attached files.
    • #7972
      Steve
      Keymaster
    • #8007
      bhushanjawle
      Participant

      Hi @Steve. I tried the latest RC however the new post created is stored as post_type = ‘revision’ instead of custom post type.
      Just posted an update here and found this to be more recent discussion hence adding here.
      Can you please confirm if I am passing the parameters the right way ?
      Thanks

    • #8008
      mikearsenault
      Participant

      I am ok with keeping this thread here but the 5-week response jag meant we pulled out of using Piklist at all on our project 4 weeks ago. Cheers, fellahs!

Viewing 4 reply threads
  • You must be logged in to reply to this topic.