• Resolved myidea

    (@myidea)


    Hi, fist of all thanks 4 the awesome plugin!
    I have installed it on a demo site just to better understand how it works.

    My prj is very simple a complete private site (Private Only and Peter’s Login Redirect plugins installed) where 3 users 1 Admin and 2 Editors can insert data, view it, sort it, filter it and modify it.
    No need of registration email confirmation etc etc…
    Very very simple 🙂

    For insert data, view it, sort it, filter and modify from back end, no probl at all your plugin does it all.

    But what I need is to have a list [pdb-list] on a page where each record links to its specific [pdb_record] so users can modify the prevoously entered data.

    I have read topics on the support and your doc and followed step by step your instructions just to be sure, but unfortunately my “Edit” link sill don’t work.

    1) I made a copy of the pdb-list-default.php template and placed in the templates subfolder of my theme
    2) I created the Edit field
    3) I have modified the code of the pdb-list-default.php as you indicated in your doc
    4) I created pages for Inserting Viewing and Modifing the data
    5) I’ve set all Plugin options as you indicated

    I do visualize the “Edit” field but is not linkable and there is no way for me to edit data from the front end.

    By the way the theme is Twenty Twelve and the standard subfolder is page-template – I have also tried creating a templates folder, but in either way no success on displaing link.
    I have also deactivated all other plugins just to be sure
    But I really need your help, thanks!

    https://wordpress.org/plugins/participants-database/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Did you set the “participant record page” setting (record form tab) to point to the page with the [pdb_record] shortcode?

    If all the settings are correct, then to troubleshoot your setup, put something in your custom template to make it obvious whether the custom template is getting used, so you can be sure of that.

    Once you know your custom template is being used to display the list, make sure your code for grabbing your edit link is correct. Make sure it’s looking for the correct name of the field (not the title).

    This does work, it’s just a matter of getting all the details exactly right. The folder in your theme must be named “templates” for instance.

    Also, you should be using a child theme for your theme. It’s very easy and will save you headaches later. Put the “templates” folder in your child theme with your custom template in there.

    Thread Starter myidea

    (@myidea)

    thanks for the reply. 🙂

    Done: “participant record page” setting (record form tab) to point to the page with the [pdb_record]

    Done:”the folder in your theme must be named “templates” for instance.” that inside has the pdb-list.php
    I can find and edit the file in the theme editor in wordpress

    <?php
    /*
     *
     * template for participants list shortcode output
     *
     * this is the default template which formats the list of records as a table
     * using shortcut functions to display the componenets
     *
     * If you need more control over the display, look at the detailed template
     * (pdb-list-detailed.php) for an example of how this can be done
     *
     * Please note that if you have more than one list on a page, searching, sorting
     * and pagination will not work correctly.
     *
    */
    ?>
    <div class="wrap <?php echo $this->wrap_class ?>">
    <a name="<?php echo $this->list_anchor ?>" id="<?php echo $this->list_anchor ?>"></a>
    <?php
      /*
       * SEARCH/SORT FORM
       *
       * the search/sort form is only presented when enabled in the shortcode.
       *
       */
      $this->show_search_sort_form();
    
      /* LIST DISPLAY */
      /*
       * NOTE: the container for the list itself (excluding search and pagination
       * controls) must have a class of "list-container" for AJAX search/sort to
       * function
       */
    ?>
      <table class="wp-list-table widefat fixed pages list-container" cellspacing="0" >
    
        <?php
        // print the count if enabled in the shortcode
    		$this->print_list_count($wrap_tag = false);
        ?>
        <?php if ( $record_count > 0 ) : // print only if there are records to show ?>
    
          <thead>
            <tr>
              <?php /*
               * this function prints headers for all the fields
               * replacement codes:
               * %2$s is the form element type identifier
               * %1$s is the title of the field
               */
              $this->print_header_row( '<th class="%2$s" scope="col">%1$s</th>' );
              ?>
            </tr>
          </thead>
    
          <tbody>
    
    <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
        <?php $record = new PDb_Template($this); ?>
      <tr>
        <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>
          <td class="<?php echo $this->field->name ?>-field">
            <?php
            /*
             * put the edit link URL into the link property of the field
             */
            if ($this->field->name == 'edit_link') {
              $this->field->link = $record->get_edit_link();
            }
            $this->field->print_value();
            ?>
          </td>
      <?php endwhile; // each field ?>
      </tr>
    <?php endwhile; // each record ?>
    </tbody>
    
        <?php else : // if there are no records ?>
    
          <tbody>
            <tr>
              <td><?php if ($this->is_search_result === true)  echo Participants_Db::$plugin_options['no_records_message'] ?></td>
            </tr>
          </tbody>
    
        <?php endif; // $record_count > 0 ?>
    
    	</table>
      <?php
      /*
       * this shortcut function presents a pagination control with default layout
       */
      $this->show_pagination_control();
      ?>
    </div>

    I haven’t created a child theme for this site bc is just a demo to get to know better wich plugins I need and how they interact 🙂

    I have created the Edit Link record exactly as you said:
    Name edit_link
    Title Edit Link
    Default Edit
    Form element Text-line
    Display column 14
    Read Only yes

    to try first with the original code 🙂

    if ($this->field->name == 'edit_link') {
              $this->field->link = $record->get_edit_link();

    Still don’t work
    I know I am doing something wrong and/or not doing something but I really don’t get it 🙁

    Could it be bc the demo site is on a 3rd level domain?
    Bc I’ve also created a new 3rd level domain with new db only your plugin
    and basic settings but no Edit Link linkable in the display list …. 🙁

    I deactivated Private only plugin so now the demo site is viewable

    I really appreciate your plugin and your help!
    Thanks a lot!!!

    Plugin Author xnau webdesign

    (@xnau)

    Your template must be named pdb-list-default.php

    check out the page on using custom templates for an explanation of the naming scheme for templates if you want to name it something different.

    Thread Starter myidea

    (@myidea)

    You are right!!!! That was it!!!
    Still can’t believe I was so dumb!!!
    Thank you thank you thank you!!!

    Ps I even feel more dumb bc I read the template creation documentation and output with the [pdb_list template=templatename]

    Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘frontend list single record edit link’ is closed to new replies.