Normally, this is done automatically by the plugin when you set up your list. Take a look at the “Setup Guide” in the Participants Database admin menu, it explains how to set up the “Single Record Link” in the list.
If you want to show a link to an editable record, take a look at this article:
Adding an Edit Record Link to the Frontend List
I have previously created a list of members with a ‘Single Record Link’ that takes the user to a specific record for viewing and it works fine.
However what I want to do know is for the user to just view their own single record. I can view the record with [pdb_single record_id=152] but I want to replace the record_id with a parameter so that all users can see their own individual records.
I imported all my data into Participants Database and not sure if that might be causing a proble.
Thanks
What you need to do is use the logged-in user’s info (such as their user ID) to find their record ID in Participants Database. Once you have the their record ID, you can show them their record using some php:
<?php echo do_shortcode(‘[pdb_single record_id=’ . $pdb_record_id . ‘]’); ?>
Take a look at this article for more on how this can be done:
Using Participants Database with WordPress Users
I have almost solved this problem. I have copied the WP username to the PD username so that I have a link.
I can then user the WP command wp_get_current_user() which works fine and I can print out the current users username.
If I want to search and list the current users record (JIMMY) I can user the filter=”username=JIMMY”.
That works fine however when I use the filter=”username=” . $user_name it just doesn’t work – it lists ALL the records. What am I doing wrong with the filter command.
[insert_php]
$current_user = wp_get_current_user();
$user_name=$current_user->user_login;
echo do_shortcode(‘[pdb_list filter=”username=”.$user_name fields=”username,first_name,last_name”]’);
[/insert_php]
Many Thanks for your Help…
Check your quotes in the do_shortcode func….looks like you got a couple mixed up.
Right I’ve got it. The wp_get_current_user() was the function I needed and of course you one needs to get the inverted comma’s in the right place
[insert_php]
$current_user=wp_get_current_user();
$users_name=$current_user->user_login;
echo do_shortcode(‘[pdb_list filter=”username=’.$users_name.'” fields=”title,first_name,last_name,address_1,city”]’);
[/insert_php]
Many thanks