• Resolved Skevdude

    (@skevdude)


    Hello,

    I’ve already found an old topic concerning this option/problem.
    Click here to see topic

    The solution at that time (1 year ago) was:

    Hi Sev,

    I hadn’t thought to make this possible, but you could modify the main script to print the private id on the frontend.

    In participants_db.php on line 565 find:

    if ( $set == 'admin_column' && self::$plugin_settings->get_option( 'show_pid' ) ) $column_set[0] = 'private_id';

    change this (to disable the backend check) to this:

    /*if ( $set == 'admin_column' && self::$plugin_settings->get_option( 'show_pid' ) ) */ $column_set[0] = 'private_id';

    Now [pdb_list] shortcode will publish links to the record edit page for each record listed.

    But i can’t find where te edit the code so that ‘edit’ links are included at the [pdb_list] pages.

    Can someone please help me?

    https://www.ads-software.com/plugins/participants-database/

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

    (@xnau)

    Check out this blog post with an easier way to do this: https://xnau.com/adding-an-edit-record-link-to-the-frontend-list/

    Thread Starter Skevdude

    (@skevdude)

    Thanks for the superfast answer.
    Already have it running
    But i can’t understand where in the code to put the “edit” link (page with [pdb_record] i presume?)

    Plugin Author xnau webdesign

    (@xnau)

    The edit link is a field you create for the purpose of holding the link. There is no coding involved in that part. This is explained in the tutorial, you create a “hidden” field with a default value that will be your link text. It’s just a placeholder.

    That field won’t be hidden if you include it in the fields presented in the list.

    You don’t have to do it that way, if you want to put the edit link on another field, you can, but I included this technique in the tutorial because it gives you a way to make it clear what the link does.

    Thread Starter Skevdude

    (@skevdude)

    I understand that completely, and it’s already functioning like that. Only thing is that the link it generates is pointed to https://currentsite/currentpage/?pid=%5Bprivate_id%5D

    I want to link it to the page that contains the [pdb_record] file, or else I can’t edit the data.
    (like https://currentsite/editpage?pid=%5Bprivate_id%5D )

    Thread Starter Skevdude

    (@skevdude)

    Also, I have a problem deleting Datafield groups and unused datafields. If I press the red X they disappear, but after pressing ‘update’ they reappear.

    Plugin Author xnau webdesign

    (@xnau)

    You need to tell the plugin which page the [pdb_record] shortcode is on. That is under the Record Form tab on the settings page.

    Your problem in the admin is probably some kind of javascript conflict with another plugin.

    If you run the Manage Database Fields page with the developers tools open to the console, you may see some kind of error when you attempt to delete a field. If you could report what you see in the console here, I can probably help.

    Hi, Im trying to follow your guide here:
    https://xnau.com/adding-an-edit-record-link-to-the-frontend-list/

    But it doesnt seem to work or im doing it wrong.

    In “Manage Database Fields” this is my settings:
    Name: edit_link
    Title: Edit Link
    Default: Edit
    Form Element: Text-Line
    Display Column: 8
    Read Only: X

    Then i added this code to pdb-list-default.php in
    wp-content/themes/themename/templates/

    <tbody>
    <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
        <?php $field = 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 = $field->get_edit_link();
            }
            $this->field->print_value();
            ?>
          </td>
      <?php endwhile; // each field ?>
      </tr>
    <?php endwhile; // each record ?>
    </tbody>

    I can see the text Edit in [pdb_list] but its not clickable. What have i done wrong?

    Where should i add the link to the page which [pdb_record] is in?

    Plugin Author xnau webdesign

    (@xnau)

    Looks like you’re doing everything right. Can you share a link so I can see what it’s doing?

    Thread Starter Skevdude

    (@skevdude)

    You need to tell the plugin which page the [pdb_record] shortcode is on. That is under the Record Form tab on the settings page.

    It works!

    I already specified the page, but after applying settings for the second time it referres to the right page.

    Still finding out why i can’t delete datafields, but I’ve discovered a new problem:

    On the admin record list page, the link for editing the user database also refers to the “front-end” edit page? (and no longer stays in admin pages)

    I’ve updated to the most recent PtDb version this morning.

    Got it to work now,

    The problem was that i had two site in my ftp and i changed the wrong one ??

    Thanks for the help!

    Thread Starter Skevdude

    (@skevdude)

    Update to my previous post:

    Before, clicking on a record in the admin field, linked to:
    https://www.currentsite/wp-admin/admin.php?page=participants-database-edit_participant&id=1

    Now it links to the page that contains the [pdb_record] shortcode.
    Because I’ve specified which fields users in front-end can change using the ‘fields’ option, Admin users cannot view or edit all neccessary fields like this.

    Plugin Author xnau webdesign

    (@xnau)

    When you say “clicking on a record in the admin field” I’m not sure I know what you mean. Are you talking about in the list of records in the admin, you can click on the “pencil” and edit the record. That has stopped working?

    Thread Starter Skevdude

    (@skevdude)

    Yes xnau,

    The pencil has disappeared. I can click on the space where is used to be, then I’ll get to the right edit page.

    I also don’t have any icons on the manage datafields page or at any other page.

    If I reinstall the plugin, my data will be gone?
    Including the custom data entry fields?

    Plugin Author xnau webdesign

    (@xnau)

    I don’t think reinstalling the plugin will solve anything. This sounds like a conflict with another plugin. Those icons are just part of the WP 3.8 admin style, but if you are using a plugin that styles the admin, there could be a conflict. Are you using the latest WP version?

    Hi xnau,

    I was trying to add the edit link in the front end version but I might be doing something wrong. I can get the column on the list showing “Edit”. No problem up to there.
    The issue comes when I try to use the template to make “Edit” clickable to redirect to the page where the [pdb_record] is located.

    This is the replaced code in the template as shown in my uploaded template. Here says edit_record instead of edit_link as it is the field name in my db.

    <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_record') {
              $this->field->link = $record->get_edit_record();
            }
            $this->field->print_value();
            ?>
          </td>
      <?php endwhile; // each field ?>
      </tr>
    <?php endwhile; // each record ?>
          </tbody>

    In the settings page for the record, “record form settings” tab, the page where [pdb_record] is selected.
    Where and how should I place the link to the page containing the [pdb_record]? Mine would be https://www.pagename.com/?page_id=286
    Thank you in advance

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Edit records in frontend [pdb_list]’ is closed to new replies.