Title: Using PD with WP Users
Last modified: October 23, 2017

---

# Using PD with WP Users

 *  Resolved [elitevacations](https://wordpress.org/support/users/elitevacations/)
 * (@elitevacations)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/)
 * I have added a custom field with the title of User Login, show it as hidden and
   added the default data as current_user->user_login. I have set the field to appear
   in the Sign Up form. I have set the sign up form as available only to logged 
   in users.
 * I am using the XYZ Php Code snippets plug in referred to by another user above
   and pasted the php code as shown in the above instructions of:
    [insert_php] 
   $current_user = wp_get_current_user(); echo do_shortcode(‘[[pdb_list filter=”
   user_login=’ . $current_user->user_login . ‘”]]’); [/insert_php] I have pasted
   that code without the [insert_php] opening and closing tags. The snippet is active.
 * I have used the signup page to create 2 new users and added differing details
   to each. I have checked the PD and see that each user now has their WP username
   inserted in their record in the User Login field.
 * All looks good so far.
 * I have created a page, that is also only accessible when a user is logged in 
   where I would like users to view their own entry. I have pasted in the filter
   of [pdb_list filter=”user_login=’ . $current_user->user_login . ‘”] on that page.
 * When a logged in user visits that page they have a list of ALL the records presented
   to them and not just their own.
 * I have been trying to figure this out for 2 days now, and I have come to the 
   conclusion that the records are being created correctly, but I must be using 
   the filter incorrectly.
 * Any help would be much appreciated. The plug in is just great for the community
   event I am helping to manage, but I need entrants to be able to access their 
   own details and print them off.
 * Thank you very much
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fusing-pd-with-wp-users%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/#post-9613128)
 * OK, there were a couple of typos in that article due to a change in the code 
   display plugin I’m using. these have been fixed, but just to be clear, your PHP
   snippet should be:
 *     ```
       <?php
       $current_user = wp_get_current_user();
       echo do_shortcode('[pdb_list filter="user_login=' . $current_user->user_login . '"]');
       ?>
       ```
   
 * and that would be wrapped in whatever “use PHP in the content” shortcode you’re
   using.
 * Now, if that’s not working, there are two things to check. First, check the shortcode
   string by simply echoing it out:
 *     ```
       <?php
       $current_user = wp_get_current_user();
       echo '[pdb_list filter="user_login=' . $current_user->user_login . '"]';
       ?>
       ```
   
 * That should show the correct shortcode with the user’s login in the filter. That’s
   probably the issue, since it’s showing all the records, that indicates there 
   is a problem with the filter: either the field name is wrong or for some reason
   the user_login value isn’t coming in.
    -  This reply was modified 8 years, 7 months ago by [Roland Barker](https://wordpress.org/support/users/xnau/).
 *  Thread Starter [elitevacations](https://wordpress.org/support/users/elitevacations/)
 * (@elitevacations)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/#post-9613428)
 * Thank you very much for the response.
    I have used new snippet code you have 
   sent me. The one I had from your tips page had a double set of square brackets.
   I have copied the `[pdb_list filter="user_login=' . $current_user->user_login.'"]`
   to the list page. That is the only thing on that list page. I have checked that
   the User Login field title actually reads user_login when a record is generated.
   All I get now is a blank screen on the list page.
 * I have not been able to echo out the details in the code you sent as I don’t 
   really know where to put that code to make it work.
 * It’s driving me crazy!
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/#post-9614395)
 * OK, that code needs to go into your snippet, because it’s PHP. It won’t work 
   directly on the page in that form.
 *  Thread Starter [elitevacations](https://wordpress.org/support/users/elitevacations/)
 * (@elitevacations)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/#post-9616397)
 * Thank you for the help.
    I have pasted in the `<?php $current_user = wp_get_current_user();
   echo ‘[pdb_list filter=”user_login=’ . $current_user->user_login . ‘”]’; ?>` 
   To mysnippet plug in.
 * I have pasted the code into another snippet plug in, just in case that one is
   not working, and the result is the same.
 * Then viewed the list page where I have the `[pdb_list filter="user_login=' . 
   $current_user->user_login . '"]` filter.
 * There is nothing shown at all, no errors it is as though something is not working,
   or there is something else required.
 * If I remove current_user request from the filter, and replace it with an actual
   user like `[pdb_list filter="user_login=Chris"]` I get the correct listings associated
   to that user.
 * Any ideas please?
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/#post-9616692)
 * Check your syntax in the snippet, there is probably an error. Make sure the quotes
   are “straight” sometimes copying code can give fancy quotes…also you don’t need
   the php tags in a snippet.
 *  Thread Starter [elitevacations](https://wordpress.org/support/users/elitevacations/)
 * (@elitevacations)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/#post-9617144)
 * Got it – Finally:)
    Found a wobbly character, and updated the php snippet plug
   in. Happy Days! Thank you very much for the help

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Using PD with WP Users’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [elitevacations](https://wordpress.org/support/users/elitevacations/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/using-pd-with-wp-users/#post-9617144)
 * Status: resolved