Support » Plugin: Participants Database » editable database

  • Resolved nikstabm

    (@nikstabm)


    I would like to edit the records (launch pdb_record) from the database (pdb_list). Is there a way to do this with the plug in currently? Would I need to edit the plug in?

    What I would like to do is when a link is clicked in the database on the front end (pdb_list) that would normally launch pdb_single, I would like it to launch pdb_record so they can edit the database. In the back end this is possible by clicking on the private_id field. I can make the private_id field visible on the front end, but it does not have a link like it does in the back end.

    Thanks!

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

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

    (@xnau)

    You need to create a custom template, then put this code into the template, right after the line with “$this->the_field()” in it:

    <?php if ($this->field->name = 'private_id') {
       $record_page = get_permalink($this->options['registration_page']);
       $private_link = $record_page . (strpos($record_page,'?') ? '&' : '?' ) . http_build_query(array('pid'=>$this->field->value));
       $this->field->value = sprintf('<a href="%s">%s</a>',$private_link,'Edit');
    } ?>

    The string “Edit” can be whatever you want to be the clickable text.

    Thanks for the fast response!

    I’m looking in participants-database/classes/Template_Item.class.php and cannot find “$this->the_field()” . Am I looking in the right place?

    I am not sure what you are referring to in creating a new template. It seems to me that I need to edit pdb_list.class.php and add in the functionality you created above. The only class I found $this->;the_field() is in the pdb_shortcode.class.php. Would I need to create a new shortcode to output the database with a link that is editable?

    Plugin Author xnau webdesign

    (@xnau)

    nikstabm,

    Read this page on creating custom templates. You’re basically copying the default list template (templates/pdb-list-default.php) into your WP theme directory and then editing that file. There’s no need to edit the plugin core files.

    Hi Xnau

    Thanks for all the support and prompt responses.

    I had the same request as nikstabm and was able to add
    <?php if ($this->field->name = ‘private_id’) {
    $record_page = get_permalink($this->options[‘registration_page’]);
    $private_link = $record_page . (strpos($record_page,’?’) ? ‘&’ : ‘?’ ) . http_build_query(array(‘pid’=>$this->field->value));
    $this->field->value = sprintf(‘%s‘,$private_link,’Edit’);
    } ?>

    and bang it works on [pdb_list template=”test” fields=”first_name,private_id”]

    Now private_id is a link but unfortunately first_name is displaying as Edit.
    All i need is the name displayed with the link (that now works).
    WP version 3.5.1
    PDB Version 1.4.9.1

    Thank you

    P.S. been through hundreds of WP plugins and have never seen a plugin as comprehensively documented as yours. Really good work.

    Plugin Author xnau webdesign

    (@xnau)

    You have a tiny littler error in your code: in the first line, the “if” statement should read

    <?php if ($this->field->name == 'private_id') {

    The double equals sign “==” is used to indicate a comparison, a single “=” indicates an assignment, which always resolves to true. So it was applying your modification to all fields.

    Thank you, much appreciated and it works.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘editable database’ is closed to new replies.