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?
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.
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.