WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
[resolved] Change Link in Template from ID to Private_ID (12 posts)

  1. PrfctGdess
    Member
    Posted 1 year ago #

    I've created a copy of the list-detailed.php template that I'm modifying to better suit my needs. I want to change this section (line 165):

    // add the record ID to the single record link
    $single_record_uri = Participants_Db::add_uri_conjunction($single_record_link) . 'pdb=' . $this->record->record_id;							
    
    /* print the opening tag of the single record link */
    echo '<a class="single-record-link" href="' . $single_record_uri . '" >';

    Instead of creating the link with the pdb=record_id, I want to use the pid=private_id.

    Essentially, I'm trying to make it list my records with links on each record, like it does out of the box. BUT, I want the links to go to an EDITABLE form for the record instead of just a view.

    Any help is appreciated (and if I'm totally off-base as to where I need to make this change, please let me know! I DO have a tendency to over-complicate things). TIA!!

    -------------------

    ** What I'm trying to accomplish **
    ** this is extra info, maybe not needed but... **
    What I'm setting up is a site where there will only be a handful of users (<10), but where each user needs access to modify multiple records. These are VERY non-technical users, so I don't want to give them administrator accounts on WordPress to edit from the back-end.

    I have it set up already where they log into their own area (i.e. they only see their own set of client data) and they can put in a new record. What I need is an easy way to edit existing records; a separate email with a private link for each entry is not feasible.

    http://wordpress.org/extend/plugins/participants-database/

  2. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    I don't have time to test this right now, but try this:

    $single_record_uri = Participants_Db::get_record_link($this->record->record_id);
  3. PrfctGdess
    Member
    Posted 1 year ago #

    I've messed around with variations on this theme, but when I do something like this:

    $single_record_uri = Participants_Db::add_uri_conjunction($single_record_link) . 'pid=' . $this->record->private_id;

    I just get a blank (i.e. it generates a link that reads "?pid=" ... it's not pulling the private ID for the records. Where do I need to look to make sure that array is actually pulling the private ID?

  4. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    OK, it wasn't as simple as I thought it would be, so it requires an extra step...try this:

    $participant_data = Participants_Db::get_participant($this->record->record_id);
    $single_record_uri = Participants_Db::get_record_link($participant_data['private_id']);
  5. PrfctGdess
    Member
    Posted 1 year ago #

    THANKS!! That didn't quite work,` but it was close enough that I was able to figure it out.

    What you posted will still make the link point back to the list page. If anyone else is reading this and wants to do the same thing, here's what worked for me:

    $participant_data = Participants_Db::get_participant($this->record->record_id);
    $single_record_uri = Participants_Db::add_uri_conjunction($single_record_link) . "pid=" . $participant_data['private_id'];

    Bravo xnau on a great plugin, and thanks for your help!!

  6. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    What I put there will go to the page defined in the settings as the "Participant Record Page" which for most installations is where the [pdb_record] shortcode will be placed. If that setting is not set, it will go back to the same page the link is on.

  7. PrfctGdess
    Member
    Posted 1 year ago #

    Ahhh, OK. That was my problem - I thought I had that set correctly, but it was pointing to a different page than I thought.

    What I posted actually points to the page I have set for the Single Record page in the List settings...on that page, I actually have the [pdb_record] shortcode. :-)

    I told you I have a tenancy to over-complicate things :-P

  8. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    It's cool...works either way, I just didn't want other users to be confused.

  9. Yourdigihands
    Member
    Posted 10 months ago #

    Hi, i have the same request and changed the list-detailed.php template. i changed line 165 into:
    // add the record ID to the single record link
    $participant_data = Participants_Db::get_participant($this->record->record_id);
    $single_record_uri = Participants_Db::add_uri_conjunction($single_record_link) . "pid=" . $participant_data['private_id'];
    /*

    But it still doenst work. When i klick on de lastname i stil go to the single_record page instead of the editable pdb_record.
    In the url it still shows de record ID and not the PID.

    What did i do wrong?

  10. xnau
    Member
    Plugin Author

    Posted 10 months ago #

    You need to make the link go to your participant record page instead of the singe record page. The part that has:

    Participants_Db::add_uri_conjunction($single_record_link)

    Is using the $single_record_link variable which is the single record page. If you don't want to use the singe record page for the single (non-editable) shortcode, just put the [pdb_record] shortcode on that page. If you want to send them to a different page, you have to change the variable to point to that page, there are several ways to do that, but the simplest is to just put it in as a string:

    Participants_Db::add_uri_conjunction('/edit-record')

    Where "edit-record" is the slug of your edit record page. Change that to be whatever you use on your site.

  11. mickeyx323
    Member
    Posted 2 months ago #

    EDIT: I am editing the plugin via wordpress.com.
    I am having the same problem as yourdigihands, with everything changed, it still links with pdb=1 instead of pid="some private code"

    I have my participant list page with [pdb_list]
    In the list display it is first name and "single record page" is pointing to the page that has [pdb_record].

    this is the area in the plugin with the changes.

    $participant_data = Participants_Db::get_participant($this->record->record_id);
    $single_record_uri = Participants_Db::get_record_link($participant_data['private_id']);

    echo '';

    Also, even if i change the line to:
    $single_record_uri = Participants_Db::add_uri_conjunction(http://www.google.com) . 'pdb=' . $this->record->record_id;

    it still takes me to the pdb=1 page

  12. PrfctGdess
    Member
    Posted 2 months ago #

    @mickeyx323 - this topic has been marked resolved. You'll be more likely to get a response if you start a new thread for your problem.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic