Product Support

Participant Login

Provides username/password access to edit a Participants Database record.

Product Setup

To configure the plugin for use, start by making sure your “Participant Record Page” is correctly configured by visiting the “Record Form” tab in the main Participants Database settings. This tells the login form which page to go to when the login is accepted.

Setting up the Participant Record Page

Configure the Login Form

On the Participant Login settings page, you can configure the form to show one or two fields that the user will need to fill in to access their editable record. The first field is called the “Username” field, and it is used as the primary identifier. This can be an email address, an ID number of some kind, or really anything that can be used to uniquely identify the user.

The second field is called the “Password” field, but it can also be anything you want. It is usually used to verify the user, especially if the Username field is something that would be generally known, such as an email address. It is also possible to set up the form to use only a single input field by unchecking the “Require Password” checkbox. When this is unchecked, only the Username field will be shown in the form. You might do this if your username field was something only the user would know, such as an ID number.

When selecting the field to use for the password field, it is important understand that “password” type fields store the password in encrypted form, which means an administrator cannot know what the password is. If you need to be able to tell people what their password is, use a text-line field for your password field, then you will be able to look up their password because it will be stored in plaintext.

Create Your Login Page

Once you have configured the login form, you should create a page that will be the login page. On that page, place the [pdb_login] shortcode to show the login form. It is possible to use a custom template for the login form if you need.

This shortcode will accept the following attributes to configure how it looks and works:

  • template for using a custom template
  • record_page to set the page (use the page name or ID) that the user goes to after successfully logging in; that page must have the [pdb_record] shortcode.
  • login_button_text to set the text on the submit button for the login form

Persistent Login

When using the “Extended Access” preference, the user is automatically forwarded to the record edit page from the login page for 24 hours after successfully logging in. This period can be changed using a code filter.

Logout

To end the persistent login before it expires, you can use a logout link. You may need to use this if you have users that must have access to more than one record. The logout URL is simply the login URL with “?pdb-logout” appended to it. For example, if your Participants Database login page is at /pdb-login, your logout link would look like this:

/pdb-login?pdb-logout

If you are not using pretty permalinks, you need to do it slightly differently. For example, if your login page is on a page with an ID of 2034, your logout link would look like this:

/?p=2034&pdb-logout

It’s a good idea to put the logout link in a menu somewhere where the user can find it.

Product Settings

Login Form Settings

Username Field

Selects the field that holds the username. This could be an email address, a made-up username, or even a member ID number. If the password is not required, this will be the only field shown. This field should hold a value that uniquely identifies the record. If more than one record matches the value, the first record found will be used.

Username Not Found Feedback Message

Message to show if the username does not match any record.

Username Field Extra Attributes

This setting provides a way to add attributes to the username input element. This can be used to add client-side validation to the input, which can be helpful to users typing in the correct thing for the input. It can also be used to add simple javascript interactivity to the input.

This setting uses the same format as the “attributes” setting in the field definition: name::value,name::value etc. Because the comma is used to separate attributes, you must use the HTML entity , to represent the comma if it is in the value.

To set up a client-side validation, use the required and pattern attributes. The link provides the details on using the pattern attribute. Here is a simple example setting:

pattern::[a-z]{3,20},required,title::username must be all lowercase letters between 3 and 20 characters

That pattern will only accept lowercase letters and the length of the input must be at least 3 characters and no more than 20. You can use the “title” attribute to add a message to the pop-up that is seen when the validation fails.

Require Password

If this is checked, both the username and the password must match an existing record for the login to be accepted. If unchecked, no password will be required, and a correct entry into the username field will take the user to the record edit screen. Be careful with this, it could allow data to be changed by unauthorized persons.

Password Field

This is where you set the field that is used for your”password.” This field can be a “Text Line” type or a “Password” type field. If the field you want to use does not appear in the selector, you should either create it if it doesn’t exist or change its form element type to one that is valid for this setting.

If you select a text-line field for this, it will be stored in the database as plaintext. This will often be the case if you are using something like a customer ID for this field. If you use a “password” type field, the password will be encrypted in the database when the user saves their password.

It is important to understand that you cannot switch from or to a password field after the record data has been entered. Changing the field type cannot encrypt or decrypt passwords, so if there is data in this field, it will become incompatible with the field type. If the password field is empty, that is OK, the password will be saved in the correct format when the user enters it.

Login Button Text

This is where you can set the text that is shown on the login form submit button.

Bad Password Feedback Message

Message shown if the password doesn’t match the value in the database.

If checked, a cookie is stored on the user’s browser when they successfully log in, so tha when they are directed to the record edit page, the URL does not show the private ID of the record. This can also be used to allow the user to bypass the login for a while if the setting below is set.

Extended Access

This sets the cookie to stay valid for 24 hours, allowing them to bypass the login for that period of time. This requires the the “Use Cookie” setting be selected as well. When a user with such a cookie visits the Participant Login page, they will be immediately redirected to their record edit screen. The 24-hour period can be changed to another value by using a code filter.

Password Recovery Settings

Provides a way to send the direct link to the user’s record so their password can be changed or recovered. This requires the the “Resend Private Link” functionality in Participants Database be correctly configured. This does not send the password or set a new password, it functions in the normal way for Participants Database: it provides the recipient with a private link to edit their record. They may use that link to change their password if they wish.

Lost Password Form Shortcode

This shortcode is used to generate the lost password form. This setting allows you to customize the shortcode, primarily so that a custom template may be used. the default value here is [pdb_request_link].

Password recovery works by emailing the user a “private link” which can be used to access their record edit page, bypassing the login form. When checked, this setting will change the private ID every time it is used to access the record edit page. This keeps the private link secure because it can only be used once. Don’t use this if your users need to be able to use a static URL to access their record edit page. This setting has the effect of changing the private ID code every time the record is saved.

F.A.Q.

Is it possible to use the login form to show a list of records?

If you want to only show the list of records to people who are registered, you can set the destination of the login form to the page with the list shortcode. You can use the “record_page” attribute in the shortcode to direct the user to any page, for example:

[pdb_login record_page="show-list"]
How does the "brute-force" protection work?

Every time the form is tried, the attempt is recorded with a timestamp and and the user’s IP. If there are over 10 attempts in a hour from a single IP, that IP is not allowed any more attempts for an hour.

Can I change the number of login attempts are allowed before the IP is shut out?

Yes, it quires the use of a filter callback. The number of attempts allowed is filtered by pdb-login_max_attempts and defaults to 10. The time within which this number of attempts is allowed is filtered by pdb-login_attempt_timeframe and defaults to 1 hour in seconds, or 3600.

What if someone loses or forgets their password?

The plugin uses the “Resend Private Link” function that Participants Database uses. There is a setting to include the link in the login form. If someone doesn’t know their password, when they click the link and enter their identifying information (usually an email) a “private link” is sent to them that they can use to access their record. They can change their password at that time if they wish.

How secure is the login form?

The login form provides a reasonable amount of security for non-critical applications. While security is very important to the design and operation of Participants Database, the plugin is not recommended for storing high-value information such as credit card numbers, social security numbers, passwords, etc.

The level of security when using this plugin is largely determined by it’s configuration by the administrator. Security is always a trade-off between convenience and how hard it is to break in. If you opt for convenience, it will be at the expense of security, that’s just how it works.

This plugin is designed to be useful in low-security situations where things link single-field logins and plaintext passwords are desirable. The security can be enhanced by using encrypted strong passwords, and hard-to-guess usernames that are not publicly viewable.

How do I use encrypted passwords?

The first thing to do is to use a “Password” type field for your designated password field in the Participant Login settings.

If you want to use encrypted passwords, you will need to give the user the opportunity to create one. The way this usually works is when the record is created, either by a signup submission or in the backend, the user will receive an email (given that this is properly configured) with their “private link” that takes them to their editable record. They can enter a password at that time, then after that, they can use the PDB login form to access their record.

It is also possible to include the password field in the signup form so that the user can set their password when they sign up.

The use of encrypted passwords is not compatible with the use of plaintext passwords, so if there are records in the database that already have a value for the designated password field, changing the field type to or from a password type field can cause problems. If you do that, the data will become invalid, and cannot be used to validate a login.

If you were using plaintext passwords and decide you need to change to using encrypted passwords, you must have your users go to their record using the private link, then enter a password. After that, they can use the password in the login form.

Is there any way to find out what someone's password is?

If you are using encrypted passwords, there is no way to know what the password is. In that case, the user must set a new password. If you are using plaintext passwords, then yes, no problem, the password will be visible to an administrator. The password will also be visible to the user when they edit their record.

How can I prevent the private ID from being seen in the URL after they log in?

In the Participant Login settings enable the “Use Cookie” setting. Now, when someone uses the login form, they will be directed to the record edit form without any indication of the record ID or private ID in the URL.

Is it possible to direct the user to a different page depending on a value in their record?

Yes, there is a filter that is used to get the URL of the page the user goes to after they successfully log in. The filter is ‘pdb-login_after_validate_submission’ and it passes in the user’s record and whether it was validated or not. (This means this can also be used to change where they go if the login wasn’t valid.)

I have created a simple plugin that demonstrates how this can be done:

Redirect PDB Login

You can download this demo plugin and make the changes needed to work for your situation.

How can I add a CAPTCHA to the login form?

It is possible to add reCAPTCHA protection to the login form if you have the PDb reCAPTCHA add-on installed and working. You need to use a custom template, I have provided an example of the template you can use for this.

pdb-login-recaptcha.php

You will need to understand a bit about how custom templates are set up, ready this article for the details:

Using Participants Database Custom Templates

Once you have the template in the correct location, you can use that template in the login form with this shortcode:

[pdb_login template=recaptcha]

Support Discussions for Participant Login

  • Hi, I got the Confirm Password working now. I looked at the tutorial and am having problem understanding how to log out after you logged in. I know for some plugins out there once you logged in, the button would automatically change to logout. So easy for a user of the site. I don’t know how to do this. My WordPress programming skills is next to zero! I had no previous WordPress programming or any web programming skills. I am just learning to build my own website using WordPress and I managed to put some stuff together. For a 55 year old fart who had no previous web programming skills I think it was a good start. But I don’t understand how to do the logout. Please be detailed and specific as I am really a newbie.

    Thanks!!!!!!!

    • Hi Ron,

      This is explained in the docs for the add-on here: https://xnau.com/product_support/participant-login/#product-setup

      All you need to do is create a link on a page (or in your menu) that sends them to the login page with the additional ‘pdb-logout’ parameter. The exact code to use is in the docs. There’s really nothing complicated about it…just create a link to the login page with that extra parameter.

  • Ah OK. I just found out the Participants Login is in fact an add on for $5. OK. I see. I will buy it. Thanks.

    Different question now. I like to edit the registration form to ask the person signing up to enter the password twice but I like to be able to verify the 2nd confirmed password entered matches the first one entered in a previous field. How do I do this verification in the form? I know on the form you can do verification but I don’t know how.

    Thanks…
    Ron L
    Toronto

    • You can do this in the registration form by setting up another text field to verify the password. Then, in the validation for the field, select “regex/match” then in the input next to that type in the name of the field it has to match.

  • Hi, I am frustrated, I looked at the following documentation regarding creating a page for user login. I used the code of [[pdb_login]] as described in the documentation below, but the short code of [[pdb_login]] did not bring up a form. I tried just [pdb_login] i.e. not double square brackets and that did not work either. Second question. Once you help me get the above form to show up, could you also edit the form as well and how?

    Create a page that will be the login page. On that page, place the [[pdb_login]] shortcode to show the login form.

    Thanks…
    Ron L
    Toronto.

    • By the way, under the same documentation, it says also that “It is possible to use a custom template for the login form if you need”. The words “custom template” is in blue so I clicked on it but it took me to a tutorial page that does not exist.

      Thanks…
      Ron L
      Toronto

      Create a page that will be the login page. On that page, place the [[pdb_login]] shortcode to show the login form.

      It is possible to use a custom template for the login form if you need.

    • Hi Ron,

      Sorry about the confusion…I really appreciate your feedback, I didn’t realize there were problems with the documentation. I’ve fixed these issues.

      The correct shortcode is [pdb_login] (the double brackets are to prevent the shortcode from actually executing in the instruction text).

      You said you tried that, so if that is not showing your login form, I’d suggest first going to the plugin’s settings (under the Participants Database admin menu, it is labeled “Participant Login”) and make sure the settings are what you want.

      Also, it’s a good idea to check the shortcode in “text” mode to make sure no automatic formatting is changing the shortcode.

  • Hi there,

    How can I disable the private link, and force participants to use the login plugin only?

    • It’s not possible to disable the private link, but they don’t have to know that it can be used. Make sure your “thanks” email includes a link to the login form, and not the private link. The login form doesn’t show the private link, so they really have no way of knowing about it if you don’t tell them.

      The one problem is the private link recovery: that uses the private link…so if someone forgets their password and needs it re-sent, the plugin responds by sending them the private link. It’s possible to disable that, of course, but your users will have no way to get into an account if they don’t have the password.

  • keep getting an error where the page fails to load after clicking “save settings”. This only seems to occur when attempting to save changes in any of the tabs under “Settings” in Participants database. Any suggestions ? I can for example, save changes after updating fields under “manage database fields”.

    Thanks

    • Something like this is pretty difficult to diagnose without a look at the PHP error log. If you can see what is coming in on that when you try to save the settings, that would help a lot. You may need to set this up, it’s not standard on most hosting setups, I’ve found.

  • Hello, Roland!

    I am unable to select the field for my password. The drop down box on the General Settings tab of the plugin does not expand to show me the choices from my fields. Any suggestions?

    As always, thanks for your help.

    • Hi John,

      I know I need to improve the documentation about how that works. First, I want to make sure you’re looking at the right page, it’s not under the General settings tab, it is it’s own menu item in the Participants Database menu, called “Participant Login” On that page, you can select the fields that are used to make up the login form. The tricky part is the password field…if “Encrypt Passwords” is checked (the default) only password-type fields will be available to be selected for the password. If you uncheck the encryption preference, you can use any text field. You can call it “password” if you like, but the passwords will be stored in plaintext.

      • That fixed it, Roland! Thank you!
        PS: Can you recommend to a PHP-novice any plug-ins to customize forms? TY

        • Customizing a form can mean lot of different things, what exactly did you have in mind?

        • I want to be able to control the layout of the form and how it looks. The current default is kinda bland. Is there a way to dress it up?

        • In that case, you’ll need to set up some CSS rules to add the desired styling. If you’re unfamiliar with how to proceed with that, take a look at this article I’ve published which will guide you through it.

          Simple CSS Techniques for WordPress

  • Hi Roland,

    I downloaded the plugin and it worked great, but the next time I tried to log in and edit my site I got this message:
    Fatal error: Call to undefined method PDb_Base::get_id_by_slug() in /home2/davidulander/public_html/wp-content/plugins/participants-database/classes/PDb_Base.class.php on line 1202

    I don’t get any further. So now I can’t edit my site any more. Do you know how to solve the problem?

    Cheers, David

    • Did you have the plugin installed before a long time ago? This is a problem that comes up when there are still settings present from a much older version of Participants Database.

      Anyway, to get around this, you’ll need to edit a file in the plugin. In the plugin file editor, open participants-database.php. You’ll find this on line 308:

      add_action( 'admin_init', array(__CLASS__, 'reg_page_setting_fix') );

      comment that out by adding slashes like this:

      //add_action( 'admin_init', array(__CLASS__, 'reg_page_setting_fix') );

      now, go to the settings page and set the “Participant Record Page” to the page where you have your [pdb_record] shortcode (if you are using it).

  • Hi

    I would like to add the Participant Login to my site. I have a question first. Once the Participant is logged can I configure it so they first see their data, i.e. pdb_single. With a link on that page to go to their pdb_record to edit the data if they need to?

    Thanks in advance

    • Hi Debbie,

      It’s important to understand that Participant Database does not provide a login, so normally, there is no way to just show someone their record because we don’t know who they are. It is possible to link Participants Database to WordPress users so that a logged-in user may access their record. It does require some coding to set that up. I discuss this in this article: Using Participants Database with WordPress Users

  • A question: can [pdb_login] and [pdb_request_link] be used on the same page, or will this cause some kind of conflict?

    • Probably not, but there is no need to do that. Just enable “Show Lost Password Link” and the plugin will take care of showing the form. If you need to use a custom template, you can set that in the “Lost Password Form Shortcode” setting in the login plugin settings.

      • Hi,
        Until now, I had the ” Show Lost Password Link” enabled, but this also shows up on the form where a new member subscribes, which is a bit awkward / unnecessary.
        I think it seems more logical and looks better when you can immediately ask for the Lost Password Link on the same page where people who are already subscribed, have to log in.

        By the way, I have a http-request warning in my query monitor, no idea what it means. Hope it’s okay if I send you a print by mail. Might be the shortlink combination on one page causing problems after all ;-)

        • I believe you can turn that link off in the signup form and have it on in the login form. Turn it off for the signup form under the “signup form” tab in the main plugin settings.

          The 403 request response is expected in this case, so nothing wrong there.

  • Hi Roland,
    I want the private ID as a password, as this code also figures in the lost-password link. But the pid is not in the list I can choose from for the Password Field. Am I doing something wrong? The pid-field is marked as read-only, might that be the reason? Or is it that it’s not one of the fields in this specific form?
    I wonder if it would be better to make an extra field so users can choose their own password, but that might be confusing.

    • Thanks for pointing this out. Yes, you should be able to use the private ID for this purpose. I have just updated the plugin to allow this.

      • Sorry, I’ve updated the plugin, but that gives a problem: logging in gives this error:

        Fatal error: Using $this when not in object context in /var/www/vhosts/waternatuurlijk.nl/httpdocs/leden/wp-content/plugins/pdb-login/PDb_Login_Security.php on line 50

        I also tried on another browser with another members credentials (because of the cookie I enabled, page-back resulted in showing my personal info), but that gives the same problem. I deleted the Lost Password shortcode to be sure that the 2 shortcodes don’t cause this, but that has no effect on the error.
        The url is https://www.waternatuurlijk.nl/leden/login-leden/

        Hope you can help (no hurry, it’s still summer holidays, we hardly have any members that need to log in this week).

        • Thanks, overlooked that detail. I just posted an updated version that will fix that.

Got a Support Question?

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.