Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mgaide

    (@mgaide)

    Fair enough. I’m trying to help someone who says that the edit link stopped working and upon further inspection the edit page doesn’t render anything.

    The edit link issue: Based on my understanding of the plugin, you would need a template to get the edit link to work. Based on the history, this page hasn’t been updated in years, but I don’t see how the edit link would work:
    [pdb_list orderby=”group_and_team_assignment” order=”asc” sort=”true” list_limit=”500″ search=”true” fields=”view_link,approved,group_and_team_assignment,position_assigned,first_name,last_name,email,date_to_report,edit_link”]

    Edit page not rendering issue: I updated the Single Record Page setting to point to the edit page and noticed no columns rendered. Upon further inspection I found that template above and noticed the group iterator wasn’t returning anything. But maybe it’s not rendering anything because of the first issue?

    My goal was to fix what was supposedly once working, but it’s a bit of a mystery to me how this ever worked. Some added info – not all volunteer records display a view and edit link on the list and some have a URL vs VIEW or EDIT. I assume that’s just because some of the records don’t have EDIT or VIEW persisted in those fields. I’ll keep digging, but any pointers would be appreciated.

    Thread Starter mgaide

    (@mgaide)

    Not seeing anything come back from that. I don’t have a lot of experience with this plugin, or WP to be honest, just trying to help someone out. Here’s the template code that’s not showing anything. Anything jump out?

    <?php
    $admin_mode = false; // set this to true to enable admin mode
    
    $postmeta = get_post_meta(get_queried_object_id());
    $readonly_fields = explode(',', str_replace(' ', '', current($postmeta['readonly_fields'])));
    $admin_fields = explode(',', str_replace(' ', '', current($postmeta['admin_fields'])));
    
    $admin = $admin_mode ? current_user_can('manage_options') : false;
    ?>
    <div class="wrap <?php echo $this->wrap_class ?>">
      <?php // output any validation errors
      $this->print_errors();
      ?>
    
      <?php
      // print the form header
      $this->print_form_head()
      ?>
    
      <?php while ($this->have_groups()) : $this->the_group(); ?>
      <?php $this->group->print_title() ?>
      <?php $this->group->print_description() ?>
    
        <table  class="form-table">
    
          <tbody class="field-group field-group-<?php echo $this->group->name ?>">
    
            <?php
            while ($this->have_fields()) : $this->the_field();
    
              if (!$admin && in_array($this->field->name, $readonly_fields)) {
                $this->field->readonly = 1;
              } else {
                $this->field->readonly = 0;
              }
              if ($admin || !$admin && !in_array($this->field->name, $admin_fields)) :
                ?>
    
                <tr class="<?php $this->field->print_element_class() ?>">
    
                  <th><?php $this->field->print_label() ?></th>
                  <td id="<?php $this->field->print_element_id() ?>" class="<?php echo $this->field->readonly === 1 ? 'readonly-field' : '' ?>">
    
                    <?php
                    if ($this->field->readonly && !$admin_field) {
                      printf('<input type="hidden" name="%s" value="%s" />', $this->field->name, $this->field->value);
                      echo PDb_FormElement::get_field_value_display($this->field);
                    } elseif (!$admin_field) {
                      $this->field->print_element();
                    }
                    ?>
    
          <?php if ($this->field->has_help_text()) : ?>
                      <span class="helptext"><?php $this->field->print_help_text() ?></span>
          <?php endif ?>
    
                  </td>
    
                </tr>
    
                <?php
              else : printf('<input type="hidden" name="%s" value="%s" />', $this->field->name, $this->field->value);
              endif;
            endwhile;
            ?>
    
          </tbody>
    
        </table>
    
    <?php endwhile; // group loop  ?>
      <table class="form-table">
    
        <tbody class="field-group field-group-submit">
    
          <tr>
            <th><h3><?php $this->print_save_changes_label() ?></h3></th>
        <td class="submit-buttons">
    <?php $this->print_submit_button('button-primary'); // you can specify a class for the button  ?>
        </td>
        </tr>
    
        </tbody>
    
      </table><!-- end group -->
    
    <?php $this->print_form_close() ?>
    
    </div>
Viewing 2 replies - 1 through 2 (of 2 total)