Viewing 7 reply threads
  • Author
    Posts
    • #8695
      openmic
      Participant

      Hi. I am trying to get a piklist editor form to show data pulled from another source.

      This is the piklist form:
      piklist(‘field’, array(
      ‘type’ => ‘editor’
      ,’label’ => __(‘Content’, ‘musik’)
      ,’description’ => __(‘This is a content of the artist.’, ‘musik’)
      ,’field’ => ‘content’
      ,’options’ => array (
      ‘wpautop’ => true,
      ‘media_buttons’ => true,
      ‘shortcode_buttons’ => true,
      ‘teeny’ => false,
      ‘dfw’ => false,
      ‘quicktags’ => true,
      ‘drag_drop_upload’ => true,
      ‘tinymce’ => array(
      ‘resize’ => false,
      ‘wp_autoresize_on’ => true
      )
      )
      ));
      I need the Description in bold to pull it’s data from an EDD form which is as below:
      $userdata[‘description’] = $values[‘user_bio’];

      I tried – ,’description’ => __(‘$userdata[‘description’] = $values[‘user_bio’];’, ‘musik’)
      but that didn’t work and the guides just show how to use a shortcode.

      Any help would be appreciated,
      Thank You

    • #8696
      openmic
      Participant

      Thought I had it but nope
      I do love working with piklist even if it takes an old dog a bit longer to get it 🙂

    • #8697
      Steve
      Keymaster

      Is the data from EDD already saved to the db? If so, where?

    • #8703
      openmic
      Participant

      Yes it is – usermeta = description
      I initially thought that the piklist field would pick it up as Description but it isn’t

    • #8704
      Steve
      Keymaster

      And where is the editor field displaying? On the user page? Post page?

    • #8706
      openmic
      Participant

      The user_bio displays on the EDD user dashboard.

    • #8707
      openmic
      Participant

      This is the Front end render code –
      /** Returns the User_Bio to render a field in frontend */
      public function render_field_frontend( $user_id = -2, $readonly = -2 ) {
      if ( $user_id === -2 ) {
      $user_id = get_current_user_id();
      }

      if ( $readonly === -2 ) {
      $readonly = $this->readonly;
      }
      $user_id = apply_filters( ‘fes_render_user_bio_user_id_frontend’, $user_id, $this->id );
      $readonly = apply_filters( ‘fes_render_user_bio_readonly_frontend’, $readonly, $user_id, $this->id );
      $value = $this->get_field_value_frontend( $this->save_id, $user_id, $readonly );
      $required = $this->required( $readonly );
      $req_class = $required ? ‘required’ : ‘rich-editor’;

      $output = ”;
      $output .= sprintf( ‘<fieldset class=”fes-el %1s %2s %3s”>’, $this->template(), $this->name(), $this->css() );
      $output .= $this->label( $readonly );
      $rows = isset( $this->characteristics[‘rows’] ) ? $this->characteristics[‘rows’] : 8;
      $cols = isset( $this->characteristics[‘cols’] ) ? $this->characteristics[‘cols’] : 50;
      ob_start(); ?>
      <div class=”fes-fields”>
      <?php
      if ( isset( $this->characteristics[‘rich’] ) && $this->characteristics[‘rich’] == ‘yes’ ) {
      $options = array( ‘editor_height’ => $rows, ‘quicktags’ => false, ‘editor_class’ => $req_class );
      wp_editor( $value, $this->name(), $options );

      } elseif ( isset( $this->characteristics[‘rich’] ) && $this->characteristics[‘rich’] == ‘teeny’ ) {
      $options = array( ‘editor_height’ => $rows, ‘quicktags’ => false, ‘teeny’ => true, ‘editor_class’ => $req_class );
      wp_editor( $value, $this->name(), $options );
      } else { ?>
      <textarea class=”textareafield<?php echo $this->required_class( $readonly ); ?>” id=”<?php echo $this->name(); ?>” name=”<?php echo $this->name(); ?>” data-required=”<?php echo $required; ?>” data-type=”textarea”<?php $this->required_html5( $readonly ); ?> placeholder=”<?php echo esc_attr( $this->placeholder() ); ?>” rows=”<?php echo esc_attr( $rows ); ?>” cols=”<?php echo esc_attr( $cols ); ?>”><?php echo esc_textarea( $value ) ?></textarea>
      <?php } ?>
      </div>
      <?php
      $output .= ob_get_clean();
      $output .= ‘</fieldset>’;
      return $output;
      }

    • #8709
      Steve
      Keymaster

      I’m still not 100% clear what you are trying to do, but in the Piklist demos we have an example of displaying a user’s profile in a front end form.

      Hopefully, this helps >

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