• Resolved Sev

    (@severindauvergne)


    Hello Rolland,

    I was used to modify your plugin each time you was udating it in order to be able to display on the front end the Private ID link to allows to go to edit the participant data.
    I already wrote you on the topic, the main modification was to do this as explain in previous topic :
    Line 771 of plugin 1.4.7

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

    and also
    Line 802 of plugin 1.4.7

    $sql = "SELECT f.name
    		        FROM ".self::$fields_table." f ";

    But this one also is already modified like that in 1.4.7.

    Unfortunately this these modifications I can only see the Private_ID on front end but not the link that permit to jump to the edit page.

    Do you have any advice ?

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

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

    (@xnau)

    Sev,

    It’s always best to make these changes to a custom template, that way updates won’t erase your work.

    Here’s what I suggest…you’ll have to adapt this, but you’ll get the idea. First, get the private id for each record by putting this line after the line with $this->the_record() in it:

    <?php
       global $wpdb;
       $private_id = $wpdb->get_var('SELECT p.private_id FROM wp_participants_database p WHERE p.id ='.$this->record->record_id);
    ?>

    Now, you have to create your link. After the line with $this->the_field() in it, put something like this. You’ll have to change the name it’s looking for to the name of the field you want to be your link and you have to change “123” in get_permalink() to the ID of the page your [pdb_record] shortcode is on. If you are using a query string in your permalinks, you have to change the ‘?’ to ‘&’ because there can only one one ‘?’ in a URL.

    <?php
    $url = get_permalink(123).'?pid='.$private_id;
    if($this->field->name == 'private_link') $this->field->value = sprintf('<a href="%s">%s</a>',$url,$this->field->value);
    ?>

    Should do it for you, if I understand what you are trying to do.

    Thread Starter Sev

    (@severindauvergne)

    I am newbee regarding custom template… so I don’t even know where to edit that.
    I looked into my template and used the editor to find any of the lines you were referring to but did not found any $this->the_record() or $this->the_field().

    Could you give me the first steps ?

    Plugin Author xnau webdesign

    (@xnau)

    Sev,

    The template I am directing you to is a plugin template, not a WP theme template. In this case the template you would use as a starting point would be pdb-list-default.php

    How to work with custom plugin templates is explained here: https://www.ads-software.com/extend/plugins/participants-database/other_notes/

    Thread Starter Sev

    (@severindauvergne)

    Perfect, that works !
    And I also discovered a new way of working (in fact I should have read all your notes before….)
    I will now make all my modifications to the custom template !
    Thanks again for your precious help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Link to Private_ID in front end’ is closed to new replies.