Support » Plugins and Hacks » Participants Database » [Resolved] Single Record – [pdb_single] – Hide Fields & Layout Issue

[Resolved] Single Record – [pdb_single] – Hide Fields & Layout Issue

  • Hi; firstly thank you very much for this brilliant plugin. I do have a couple of queries regarding the Single Record page though – the one that uses the [pdb_single] shortcode.

    1. Is is possible to hide certain fields from the Single Record page, perhaps by attaching “hide=field” parameters to the shortcode or something? I daren’t try it myself in case I break something! I want to prevent email and phone fields from showing for privacy purposes.

    2. The layout of the front-end page for Single Records (i.e. the one that anyone can view by clicking a link on the List) doesn’t seem to display quite right; the field and corresponding value are offset, and there are large gaps between the rows, something like this (without the dots, I’ve just put those in to format it):

    First Name:
    Last Name:

    Is this how it generally looks for everyone, or have I got something set up wrong? I’ve tested it on Chrome and IE and it’s the same on both. The demo on your own page looks how I would expect it to, so I’m hoping there’s something I can do to make it look like that.

    Thank you in advance for your help.


Viewing 14 replies - 1 through 14 (of 14 total)
  • incubouk,

    Take a look at the single record template, it explains how to exclude fields using a custom template. Info on how to use templates will be found here: http://xnau.com/work-2/wordpress-plugins/participants-database/using-the-participants-database-plugin/#templates

    The layout of the shortcode output will be affected by your theme stylesheet. You will need to inspect the elements (using something like FireBug on Firefox) to see how the stylesheet CSS is affecting it, then create rules to make it look the way you want it to.


    Thank you very much for your quick reply Roland, and apologies for not noticing the ‘Single Record Templates’ section – that’s exactly what I was looking for. I read through all the help notes several times, but somehow managed to overlook the bit I needed every time!

    The stylesheet / CSS business is all above me unfortunately. I’m using the Graphene theme; if there’s anyone else out there who uses that theme and this plugin, and has worked out how to fix the layout of the Single Record page, I’d be very grateful if you could let me know.

    Many thanks.


    This is a pretty standard layout for definition lists, which is the HTML structure used in the single record template.

    What do you want it to do? If you share a link so we can see it, it’s a lot easier to help.

    All I’m looking for is for the field value to align to the field name, and for the rows to be closer together – just like it is on your demo page.

    This is how it currently looks on my site: http://www.incubo.org.uk/national-employment-database/recruiters/employee-record/?pdb=1326

    You’ll see what I mean, the layout is just a bit off for some reason. Thanks again for your help Roland.

    The fix is pretty simple: your theme stylesheet is adding a 10px margin to the top of the ‘dt’ elements. The change needs to be in your theme stylesheet. Either get rid of the rule altogether or override it with a rule that uses the wrap class of the shortcode:

    .entry-content .pdb-single dt { margin-top:0 }

    I suggest you check out Firefox with the FireBug extension….great way to learn how CSS works.

    That works perfectly; thank you so much Roland, you’re a legend.


    I am new and read this post and have a similar question. I did read the information about displaying only certain fields on a members profile record when someone comes in to check to see if they are one of our current members.

    In your instructions I see you said:

    Single Record Templates
    Templates for the single record shortcode include an array that can be used to prevent any fields from displaying. Let’s say you wanted to exclude the city, state and postcode. In that case the array would be filled with those names like this:
    $exclude = array(‘city’,’state’,’postcode’);
    These fields will now be excluded from the display. The template offers many other opportunities to customize the output of the [pdb_single] shortcode to match your theme.

    My question is where do I put this Array? I am not a coder so not sure. Would it be in the shortcode itself? On the page or do I have to go into the PHP file for this page or shortcode and add it there. If so can you tell me exactly where to add it.

    I am using your plug in now, had purchased QuForms, but that didn’t give me the access to the DB to add records, etc. Nice form however, will use it for other things.

    If I can get yours working the way I want it would be great. I have a number of pages set up already still a bit confused on the record display. I want one that will display the information for my viewing which would not be public and then one that would display the results of someones search that only contains a few fields only.

    Here is our registration page:


    Member Search Page: http://internationalpress.org/member-registration

    Member Details (result page of search) http://internationalpress.org/members-details

    I also have the link to their Profile Edit page too, that seems to be working fine.

    Also not getting an email on a new member, read your info on the SMTP mail plugins will try that. I have another plugin that deal with sending mail from the blog one is MyMail so will have to look for another good plug in the one you recommend doesn’t say it was updated for WP 3.5.1 so I didn’t install it.

    Will be making a donation tonight because I had searched for three days to finally find your plug-in…super if I can just configure it correctly now.



    Have you created a custom template by copying the default template (templates/pdb-single-default.php) into your theme directory? If not, this is the first step. Then, look at the file you copied, the plugin will use this file to show the record. In that file, you’ll see that array I’m talking about.

    Check the docs about creating templates, that should help you get set up.

    Thanks for getting back to me, hope you received my Pay Pal contribution, so happy I found your plug-in.

    Now I am not really that familiar with php code. This is what I did..I went and copied the templates/pdb-single-default.php code from the WP editor. I then opened my php program and created this file there and then uploaded it into my theme where the other template php pages were. I assume that was correct.

    Now on my membership application there large number of fields there, would I have to indicate each one I don’t want to show on a members search results page or is there an easier way to simply indicate the maybe 6 fields I do want to display?

    I am still not that clear even with all your instructions exactly where that code should be placed.

    Here is a link to what is showing now on my record:

    Member Details

    Now I want to create two pages for the display, one that I can see with all the fields and info and the other that would show up on the web for anyone to see a smaller amount of information.

    I could put my page in a private link not available for others to see…would that work?

    Then the other page with these limited fields showing on my Member Search Results Details Page…

    ID Photo, IPA ID, Expiration Date,IPA Title,Title, First Name, Last Name, City, State, County, Email, Resume-Bio, website, members profile,

    The ones I want to currently exclude would be:

    sign-up date, membership_level, username, password, age,address, address_2, zip, pone, mobile_phone, email_2, Skype, mailing_list, interests, business_name, occupation, reason_for_joining, other_reasons, how_did_you_hear, other, comments, approved, volunteered, ipa_credit, impress_credts, ipa_gold_credit, impress_gold_credit

    So you see there are a lot more I don’t want to display on a simple site search and I do want to display all of them for my viewing as an admin.

    Also is their a way to actually layout the page so it is neater looking then currently?

    As you can see now it is simply one long listing.

    I also noticed in the Source Field Groups there is a Signup Date, I put in the date in the Main Field, I suppose I can delete this one, is that correct? Would it serve any purpose to leave it there and what is the best date format to use that would be a global one?

    I have it set up now as: m/d/year or XX/XX/XXXX

    Will that be a problem.

    I have a few other questions, but getting this set up is key right now.

    Thanks for your help.


    Hi Len,

    Yes, I got your donation, thanks very much!

    So, for starters, I want to make sure you’ve got your template set up right. Your template should be a copy of the plugin template “pdb-single-default.php” and it should go into your theme directory in a directory named templates: /wp-content/themes/YOUR_THEME/templates/pdb-single-default.php

    The [pdb_single] shortcode will now be using this file.

    In the file, you will see the exclude array definition at the top. The easiest way to do what you want is to define the array based on the login status of the user. Replace the array declaration with something like this:

    if (is_user_logged_in()) {
       $exclude = array(); // this shows all the fields
    } else {
       $exclude = array('sign-up date', 'membership_level', 'username', 'password', 'age,address', 'address_2', 'zip', 'pone', 'mobile_phone', 'email_2', 'Skype', 'mailing_list', 'interests', 'business_name', 'occupation', 'reason_for_joining', 'other_reasons', 'how_did_you_hear', 'other', 'comments', 'approved', 'volunteered', 'ipa_credit', 'impress_credts', 'ipa_gold_credit', 'impress_gold_credit'); // hide these fields from other users

    Laying out the page is up to the WP theme, so you’ll have to edit your theme CSS to change the way it looks.

    I do suggest you delete any fields you are not using.

    The date format MM/DD/YYYY is a little bit problematic, PHP likes dates which contain a text month much better, but you can use that format if you use the “Strict Dates” setting.

    Yes, I did copy the entire page and uploaded it to the theme. I will give it a try by changing the array code as indicated and see how that goes.

    Now as far as login goes…If someone wants to verify a photographer or journalist is a current member of IPA, they would go to do a search based on the members name, ID number or other criteria. It is more a verification thing then anything else and would also contain a link to his website, a page on our site or even a link to his published articles.

    So these people would not login to see this information. I am going to set up a page on this site for each of our members, similar to what I did on our other site, you can see that here.

    Here is how the members would be located on the site:

    Photo Showcase

    Then an individual members page would look like this one.

    Photo Showcase • Len Rapoport

    This would be their portfolio of work on our site.

    So I thought your plug-in would be a great way to search for a member, then have the link to their profile page or articles or both.

    If I need to check a members info, I could do a simple search as well and see all the fields.

    Here is the code from your pdb-single file I copied and tried to put in the array before I got your answer.

    <?php while ( $this->have_groups() ) : $this->the_group(); ?>

    <div class=”section” id=”<?php echo Participants_Db::$css_prefix.$this->group->name ?>”>

    <?php $this->group->print_title( ‘<h2>’, ‘</h2>’ ) ?>

    <?php $this->group->print_description( ‘<p>’, ‘</p>’ ) ?>

    <?php while ( $this->have_fields() ) : $this->the_field();

    // skip any field found in the exclude array
    if ( in_array( $this->field->name, $exclude ) ) continue;

    $exclude = array( ‘city’,’state’,’country’ );

    // CSS class for empty fields
    $empty_class = $this->get_empty_class( $this->field );

    By the way, I thought that when I set up the DB, if you wanted a field to show you would put a number, any number in the column that says Admin Column and the Display Column would handle what would be displayed on a search and in the column order based on a number from 1 for first column to whatever.

    Did I miss something here?

    Thanks for your help, I am sure your answers will help others as well. I find that in the three years and two other WordPress sites and all the different plug-ins I have used, it really takes time to figure how each one works.


    OK..just added this to the PHP file:

    // skip any field found in the exclude array
    if ( in_array( $this->field->name, $exclude ) ) continue;

    $exclude = array( ‘sign-up date’, ‘membership_level’, ‘username’, ‘password’, ‘age’,’address’, ‘address_2’, ‘zip’, ‘phone’, ‘mobile_phone’, ’email_2′, ‘Skype’, ‘mailing_list’, ‘interests’, ‘business_name’, ‘occupation’, ‘reason_for_joining’, ‘other_reasons’, ‘how_did_you_hear’, ‘other’, ‘comments’, ‘approved’, ‘volunteered’, ‘ipa_credit’, ‘impress_credts’, ‘ipa_gold_credit’, ‘impress_gold_credit’ );

    // CSS class for empty fields
    $empty_class = $this->get_empty_class( $this->field );

    Now that this file was updated, I am still not seeing any difference in my display page.

    See after these changes….http://internationalpress.org/members-details?pdb=3


    You meed to move your array definition up to the top of the template and replace the one that is there. It has to be defined before the loop begins.

    Either I am dumb as a stump or I am doing something wrong…

    Here is the code now that I moved the array up on top. What am I missing now…



    * default template for displaying a single record
    * this is the new “WordPress style” template
    * each group with the “visible” attribute checked will display its fields in the order set
    * in the manage database fields page.
    * if there are specific fields you wish to exclude from display, you can include the “name” value of
    * the field in the $exclude array like this: $exclude = array( ‘city’,’state’,’country’ ); or whatever
    * you want. Leave it empty (like it is here) if you don’t want to exclude any fields.
    * this template is a simple demonstration of what is possible
    * for those unfamiliar with PHP, just remember that something like <?php echo $group->name ?> just prints out
    * the group name. You can move it around, but leave all the parts between the <> brackets as they are.

    // define an array of fields to exclude here

    // skip any field found in the exclude array
    if ( in_array( $this->field->name, $exclude ) ) continue;

    $exclude = array( ‘sign-up date’, ‘membership_level’, ‘username’, ‘password’, ‘age’,’address’, ‘address_2’, ‘zip’, ‘phone’, ‘mobile_phone’, ’email_2′, ‘Skype’, ‘mailing_list’, ‘interests’, ‘business_name’, ‘occupation’, ‘reason_for_joining’, ‘other_reasons’, ‘how_did_you_hear’, ‘other’, ‘comments’, ‘approved’, ‘volunteered’, ‘ipa_credit’, ‘impress_credts’, ‘ipa_gold_credit’, ‘impress_gold_credit’ );

    // CSS class for empty fields
    $empty_class = $this->get_empty_class( $this->field );


    <div class=”wrap <?php echo $this->wrap_class ?>”>

    <?php while ( $this->have_groups() ) : $this->the_group(); ?>

    <div class=”section” id=”<?php echo Participants_Db::$css_prefix.$this->group->name ?>”>

    <?php $this->group->print_title( ‘<h2>’, ‘</h2>’ ) ?>

    <?php $this->group->print_description( ‘<p>’, ‘</p>’ ) ?>

    <?php while ( $this->have_fields() ) : $this->the_field();

    // CSS class for empty fields
    $empty_class = $this->get_empty_class( $this->field );

    <dl class=”<?php echo Participants_Db::$css_prefix.$this->field->name.’ ‘.$this->field->form_element.’ ‘.$empty_class?>”>

    <dt class=”<?php echo $this->field->name.’ ‘.$empty_class?>”><?php $this->field->print_label() ?></dt>

    <dd class=”<?php echo $this->field->name.’ ‘.$empty_class?>”><?php $this->field->print_value() ?></dd>


    <?php endwhile; // end of the fields loop ?>


    <?php endwhile; // end of the groups loop ?>


    See for yourself, it is still showing the full record.

    Can you make the change in the above and just post it so I can simply copy it and try it?

    Thanks for your patience. Now if this works, I will still want to be able to pull the full record for my use. This one will be for public viewing.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] Single Record – [pdb_single] – Hide Fields & Layout Issue’ is closed to new replies.
Skip to toolbar