Product Support

Participant Database WordPress User Profile

Expand the WordPress user profile with unlimited Participants Database fields. Automatically create a WP user account with a Participants Database signup form. Provide a frontend profile page for your WordPress users.

Product Setup

This plugin is primarily for the purpose of expanding the WordPress user account to include additional information which the user (or administrator) can edit on their profile page. It  provides several ways to connect a Participants Database record to a WordPress user. This works whether you already have WordPress users, or you have Participants Database records, or even if you have nothing to start with.

Start by Defining Your Data Fields

Unless you already have your Participants Database fields defined, you need to first set up the fields of data that will be stored with the user’s profile.

To do that, go to the Manage Database Fields page in Participants Database and define the fields you want for your users. Using field groups, you can define fields that are public, private (for the user only) or admin (only site admins will be able to see these). Once the fields have been defined, you can configure how it interacts with WordPress users and user registration.

You can define as many or as few extra fields as you want. Participants Database comes with a set of predefined fields, these can all be deleted if you don’t need them.

There are a few key fields in the WordPress user account that are usually linked to fields in the Participants Database record. This establishes synchronization between the two on these fields: First Name, Last Name, Email, User Login, and User Avatar (also known as the Profile Picture). It is not absolutely necessary to set up these fields, but it can be helpful to be able to see the user’s name, etc. in the Participants Database record.

To set this up, go to this plugin’s settings under the “WordPress User Profile/Participants Database Record Settings” heading. This is where you can determine which Participants Database fields relate to the core fields of the WordPress profile. In most cases, the defaults will be OK.

When a new WP user account is created from a Participants Database record (either an existing record or a new signup), the information in these fields will be used. The User Login field can be used as a way to let user determine their own user login name (this works for new signups only). In most cases, if this field is configured, it is for the purpose of showing the username in the PDB record.

Creating WordPress User Accounts

If you want new WP user accounts to be created automatically (there are several ways this can happen), check the “Create WordPress User Settings.” If you want the new users to get a welcome email, make sure “Send the WordPress New User Email” is checked. If you’ve got the Email Expansion Kit installed, you can also define your own welcome email. If you’re doing that, you can uncheck the setting so only the custom email gets sent.

Creating WP User Accounts with a Signup Form

If you’re starting from nothing with your membership, or you want to let new members register, you can use the Participants Database signup form to provide a way for your new members to sign up.

When a Participants Database signup form is submitted, you can set it up so that the person registering will be given a WP account. You can also set it up so that when they register, it stores their info but does not set up the WP account until the registration is approved.

When the registration is approved, the info from the signup is used to create the new account. The Participants Database record is now associated with the new WP account.

The signup form can have as many fields as you like, so your new accounts can be established with a full set of information.

Note that when this setting is used, a logged-in user won’t see the signup form because they already have an account.

Creating WordPress User Accounts on Approval

If you want to be able to approve the new user before granting them an account, you can use the approving records mechanism to create the user account. When a record is approved, a new WP user account will be created using the info in the signup submission. This can also be used to turn the user’s account access on and off. If a record id unapproved, the user won’t be able to log in. If the record is approved again, they will regain access.

Creating WordPress User Accounts Manually

If you’ve got people in Participants Database and you want to establish WordPress user accounts for them, you can easily do that on the admin List Participants page. Select the records you want to establish WP user accounts for, then select “create WordPress user account for record” then confirm the operation by clicking “apply.”

Select the users you want to establish accounts for, then use the “with selected” dropdown to select “Create WordPress user account for record” and click “apply.” Each of the people who got new user accounts will be sent the welcome email (with the login link) if you have that configured. It is probably a good idea to test this on a single user before doing it for a lot of them.

Starting with Existing WordPress Users

If you have WordPress users already registered and you want to give them expanded information storage in their account profile, it’s very easy. When the user visits their profile page, a new Participants Database record is created for them if it did not exist before. All the extra information that they enter on the profile page will be added to that record, which is now fully connected to the WP user.

The Profile Page

WordPress has a built-in profile page on the backend that is accessible to users where they can edit their profile info. This plugin can add Participants Database fields to that profile page. This is configured in the plugin settings under the “User Profile Settings” heading. There is a checkbox that enables this functionality.

You can also control which groups of Participants Database fields are shown in the profile. There is another setting where specific fields can be excluded.

When a logged-in WP user visits their profile page, the matching Participants Database record is used to add the extra fields. If there is no record for the user the “Create PDb Record for WP User” option creates a new record for them. That record is now attached to the WP user, and will be used to store their information.

Frontend Profile Page

If you want your users to be able to access their profile on a regular website page (instead of an admin page), you can do that using the [pdb_user_profile] shortcode. Just select or create a page for your profile and put the shortcode on that page. This is perfect if you don’t want your users going to the backend to edit their profile.

Placing the frontend user profile shortcode

 

When the frontend profile page is set up, the plugin automatically changes the user’s profile link to point to this page instead of the default profile page in the backend.

There are two built-in templates for the frontend user profile page. The default template is a responsive layout based on the Bootstrap framework. There is also a flexbox-based layout that can place the fields in columns and will generally be more compact. You can use the flexbox template by adding the name of the template to the user profile shortcode like this:

[pdb_user_profile template=frontend-profile-flexbox]

The frontend profile uses the same configuration settings as the backend profile page. The layout and appearance of the profile page is under the control of your WP theme. If you need to make changes to its appearance, you will need to use your own CSS rules to make the desired changes. The main Participants Database plugin has a place for your custom CSS rules in the settings.

It is also possible to create a custom template for the frontend user profile. The name of the template file must begin with “pdb-record-frontend-profile” and must be based on one of the two frontend profile template included in the plugin.

Using a Custom “Welcome” Email

If you have the Email Expansion Kit installed, you can easily create a custom email that goes out to the user when a new account is set up for them. If you are notifying your users this way, you should uncheck the “Send the WordPress New User Email” setting to avoid sending two emails.

This email must contain the “activation link” so that the user can activate their new account. This is a security feature that allows you to avoid putting a plaintext password in the email.

The user must visit the site using the activation link, where they will need to create a new password for themselves.

Here is an example content for your welcome email template:

Subject line:

Welcome, [first_name], your new user account has been activated!

Email body:

You user account has been established with the username [user_login].

To activate your account visit this link:

[activation_link]

After you have set your password, use this link to log in:

[login_link]

If you do want to send them the plaintext password, you can use the tag [user_pass]. They will be able to use that with their user login to log into the account immediately without changing their password.

Showing a List of Users

You can use the Participants Database list shortcode to show a list of your users, showing only users with a specific role. For example, to list all the subscribers, use

First Name Last Name Club Role City State Main Activity Photo
Debolt Edwin Member Tempe Arizona
danny lopez
Dale Byrne Volunteer Carlsbad California General Sports, Photography, Crafts, Arts & Hobbies, Knitting, Yoga, Rock Hounding, Organic Farming
Gabi Clayton
test test
Group FIBARO
mike s
Brett Bickham
JAIME PERALTA
Mark Hatter

You can also name more than one role there, for example:

First Name Last Name Club Role City State Main Activity Photo
Debolt Edwin Member Tempe Arizona
danny lopez
Dale Byrne Volunteer Carlsbad California General Sports, Photography, Crafts, Arts & Hobbies, Knitting, Yoga, Rock Hounding, Organic Farming
Gabi Clayton
test test
Group FIBARO
mike s
Brett Bickham
JAIME PERALTA
Mark Hatter

This will work to show both subscribers and members if you have a custom role named “member.”

Product Settings

User Profile Settings

Show PDb Fields in WP Profile

This is the overall enable switch for including the extra fields defined in Participants Database in the WordPress user’s profile page.

Profile Groups

Select which Participants Database field groups to include in the profile page. Only public and private groups will be available here.

Profile Excluded Fields

If there are specific fields within the selected field group that you wish to exclude, list them here. It should be a comma-separated list of Participants Database field names.

PDb Profile Title

This title is printed above the extra fields that Participants Database adds. Blank it out to show no title.

Create PDb Record for WP User

This determines whether a participants Database record should be assigned to the WP user if they visit their profile page and there is no PDB record associated with their account. In most cases, you will want this checked.

WordPress User/Participants Database Record Settings

These settings set up a correspondence between the key fields of the WordPress profile and the Participants Database record. These settings are optional, the plugin does not use these fields to determine which record belongs to the user. They are helpful, however, because it provides a readable way to know which WP user the PDB record belongs to.

These are configured by default to connect to the default fields in Participants Database if they exist.

First Name Field, Last Name Field, Email Field

These setting tell the plugin which PDB fields are connected to the WP user profile fields. In most cases, you won’t need to change these, they will be set up by default.

User Login Field

This setting provides a way to store the user login name in the PDB record. If the site was previously configured to use the user login as a way to identify which user the record belonged to, this setting should set that up automatically. This works by looking for a hidden field in the PDB field definitions that is set up to record the user’s user login name in a signup form.

User Avatar Field

This provides a way for the user to use a “local” avatar for their profile. Normally, WordPress would attempt to get the user’s avatar from Gravatar, but with this feature, the user can upload an image to use instead or if they don’t have a Gravatar image configured. This image will be used to identify the user anywhere on the site that the avatar is displayed.

This selection must be an “Image Upload” type field.

Create New WordPress User Settings

It is possible to use this plugin as a way to set up a WP user account for someone who is in a Participants Database record. This can happen in several ways, and these setting determine how that will work.

When a new WP user account is created, an email is sent to the person informing them of their new account, along with information to go to the site and set up their password. They will not be able to log in until they do this. This is standard WordPress functionality, but it can be overridden when using the Email Expansion Kit.

Create New WP User Mode

There are 3 ways a new WP user account is created in this plugin. This setting determines which one you want to use. If you don’t want WP user accounts to be created at all, use the “Manual” setting (which is the default).

When a new WP account is established by any method, an email is sent to the new account holder with their login instructions.

With the Manually setting, new WP user accounts can be created for people in Participants Database by using the “With Selected” function on the admin List Participants page. Note that you can always use the “With Selected” action, no matter what setting you have here.

The On Signup setting means that the WP user account is established immediately when the signup form is submitted.

The On Approval setting also works with the signup form, but instead of establishing the WP account immediately, it only does so when the record is approved. (See Approving Records for how this is configured in Participants Database). This setting also means that if you approve an unapproved record that was already in the database that does not have a WP account assigned to it, a new WP account will be created.

New WP User Role

This determines the role given to new WP users that are created by this plugin. If you  have custom roles defined, you will be able to assign new users to a custom role.

New User Login Name Source

When a new WP user is created, the account is given a username. This setting determines what information will be used to set up the account user name.

If you have a user login field defined, it is possible to let the person signing up determine their own username. The plugin will make sure it is unique.

Usernames cannot be changed once established.

The Name Fields setting creates the username by adding the last name to the first name, removing any illegal characters, and then lowercasing it. The Email Field setting uses the email address, stripping out the “@” and the domain. The User Login Field setting uses the value in the user login field (as defined in the “User Login Field” setting above) to create the username for the new account.

Send the WordPress New User Email

This preference determines whether the WordPress standard “welcome” email is sent to the new user when the account is established. If you are using the Email Expansion Kit to define a custom email for this purpose, you can uncheck this to prevent the built-in WordPress email from getting sent.

If you just don’t want that email going out at all or at a later time, you can uncheck this.

It’s always possible to resend the “welcome” email using the “With Selected” function on the admin List Participants page.

Deactivate WP User when Unapproved

When a record is unapproved (if it was approved before it was unapproved) the WP user account can be deactivated at the same time. The account is not deleted, it just becomes inactive and the person won’t be able to log in. This is done by setting the deactivated user’s role to “None.” If the record is approved again, the account will be reactivated, using the New WP User Role setting above to restore the user’s role.

Handle WP User Account on PDB Record Delete

When a Participants Database record is deleted, this setting determines what happens to the associated WP user account.

Deactivate means the account still exists, but the user will be unable to log in. Choose this if you think you may want to give the user access again in the future.

Do Nothing means they can still log in, but note that when they visit their profile page, a new Participants Database record will be created for them. The plugin doesn’t try to prevent that.

If you set it to Delete, the associated WP account will be deleted along with the PDB record. Admin accounts and accounts that have authored posts will not be automatically deleted.

Deactivated Account Message

This lets you define the error message that is shown to the user when they try to log in while their account is deactivated. You can include some simple HTML here.

F.A.Q.

Is it possible to use this add-on with Field Group Tabs to provide a tabbed interface for the frontend profile?

Yes, it requires the use of a special custom template. I’ve created an example of how this can be done, the template is available below.

Please read Using Participants Database Custom Templates so you understand how to install and use this custom template.

To use the template, set up your shortcode like this:

[pdb_user_profile template=frontend-profile-tabs tabs=true ]

You must (of course) have the Field Group Tabs add-on installed for this to work.

<?php
/**
* shows a WP user profile edit form with Participants Database fields in a tabbed interface
*
*/
global $PDb_WP_Users, $PDb_Frontend_Profile, $post, $wp;
/** @var \pdbwpu\Plugin $PDb_WP_Users */
/** @var \pdbwpu\Frontend_Profile $PDb_Frontend_Profile */
$profileuser = $PDb_Frontend_Profile->this_user();
// you can change the title of the WP Profile core group here
$core_group_title = 'WordPress Profile';
// this code sets up the main object and adds the WP Core group to it
$this_record = new PDb_Template( $this );
$core_group = array('wp-core' => (object) array('name' => 'wp-core', 'title' => $core_group_title));
$this_record->groups = $core_group + $this_record->groups;
/**
* @filter pdbwpu-display_frontend_profile
* @param int post id of the page where the form appears
* @param \WP_User user the profile belongs to
*/
do_action( 'pdbwpu-display_frontend_profile', $post->id, $profileuser );
/**
* prints the tab interface
*
* $param PDb_Template $this_record
*/
function pdb_profile_field_group_tabs( $this_record )
{
global $PDb_Field_Group_Tabs;
echo $PDb_Field_Group_Tabs->get_tab_control( $this_record );
}
?>
<div class="wrap <?php echo $this->wrap_class ?>">
<?php if ( $PDb_Frontend_Profile->show_profile_form() ) : ?>
<?php
if ( !empty( $this->participant_id ) ) :
// output any validation errors
$this->print_errors();
// show any profile update feedback messages
echo $PDb_Frontend_Profile->profile_errors();
?>
<h2><?php _e( 'Profile' ) ?></h2>
<?php
// print the form header
$this->print_form_head();
pdb_profile_field_group_tabs( $this_record );
?>
<fieldset class="field-group field-group-wp-core group-with-title">
<legend><?php echo $core_group_title ?></legend>
<label><?php _e( 'Avatar' ) ?></label>
<?php echo $PDb_Frontend_Profile->get_avatar( 64 ); // 64 is the size of the image to get ?>
<!– WP Profile Core Name Group –>
<div class="form-group wp-user_login">
<label for="user_login"><?php _e( 'Username' ); ?></label>
<div class="input-group" >
<input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" />
</div>
<p class="help-block helptext"><?php _e( 'Usernames cannot be changed.' ); ?></p>
</div>
<div class="form-group wp-first_name">
<label for="first_name"><?php _e( 'First Name' ); ?></label>
<div class="input-group" >
<input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ); ?>" class="regular-text" />
</div>
</div>
<div class="form-group wp-last_name">
<label for="last_name"><?php _e( 'Last Name' ); ?></label>
<div class="input-group" >
<input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ); ?>" class="regular-text" />
</div>
</div>
<div class="form-group wp-nickname">
<label for="nickname"><?php printf( \Participants_Db::plugin_setting_value( 'required_field_marker' ), _e( 'Nickname' ) ); ?></label>
<div class="input-group" >
<input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ); ?>" class="regular-text" />
</div>
</div>
<div class="form-group wp-display_name">
<label for="display_name"><?php _e( 'Display name publicly as' ); ?></label>
<div class="input-group" >
<select name="display_name" id="display_name">
<?php echo $PDb_Frontend_Profile->display_name_options() ?>
</select>
</div>
</div>
<!– WP Profile Core Contact Group –>
<legend><?php _e( 'Contact Info' ) ?></legend>
<div class="form-group wp-email">
<label for="email"><?php printf( \Participants_Db::plugin_setting_value( 'required_field_marker' ), _e( 'Email' ) ); ?></label>
<div class="input-group" >
<input type="text" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text" />
</div>
<p class="help-block helptext"><?php _e( 'If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p>
<?php
$new_email = get_user_meta( $profileuser->ID, '_new_email', true );
if ( isset( $new_email['newemail'] ) && $new_email['newemail'] !== $profileuser->user_email ) : // show pending email notice
?>
<div class="updated inline published">
<p>
<?php
printf(
/* translators: %s: new email */
__( 'There is a pending change of your email to %s.' ),
'<code>' . esc_html( $new_email['newemail'] ) . '</code>'
);
printf(
' <a href="%1$s">%2$s</a>',
esc_url( wp_nonce_url( home_url( add_query_arg( array('dismiss' => $profileuser->ID . '_new_email'), $wp->request ) ), 'dismiss-' . $profileuser->ID . '_new_email' ) ),
__( 'Cancel' )
);
?>
</p>
</div>
<?php endif; // pending email notice ?>
</div>
<div class="form-group wp-url">
<label for="url"><?php _e( 'Website' ); ?></label>
<div class="input-group" >
<input type="text" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ); ?>" class="regular-text" />
</div>
</div>
<?php
foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
?>
<div class="form-group wp-contact user-<?php echo $name; ?>">
<label for="<?php echo $name; ?>">
<?php
/**
* Filters a user contactmethod label.
*
* @filter user_{$name}_label
* @param string $desc The translatable label for the contactmethod.
*/
echo apply_filters( "user_{$name}_label", $desc );
?>
</label>
<div class="input-group">
<input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profileuser->$name ); ?>" class="regular-text" /></td>
</div>
</div>
<?php
}
?>
</fieldset>
<!– Participants Database Groups –>
<?php while ( $this->have_groups() ) : $this->the_group(); ?>
<fieldset class="field-group field-group-<?php echo $this->group->name ?> <?php echo $this->group->printing_title() ? 'group-with-title' : 'group-no-title' ?>">
<?php $this->group->print_title( '<legend>', '</legend>' ) ?>
<?php $this->group->print_description() ?>
<?php
// step through the fields in the current group
while ( $this->have_fields() ) : $this->the_field();
?>
<div class="form-group <?php $this->field->print_element_class() ?>">
<?php if ( $this->field->has_title() ) : ?>
<label>
<?php $this->field->print_label() ?>
</label>
<?php endif ?>
<div class="input-group" >
<?php $this->field->print_element_with_id(); ?>
</div><!– .input-group –>
<?php if ( $this->field->has_help_text() ) : ?>
<p class="help-block helptext"><?php $this->field->print_help_text() ?></p>
<?php endif ?>
</div><!– .form-group –>
<?php endwhile; // field loop ?>
</fieldset><!– .field-group-<?php echo $this->group->name ?> –>
<?php endwhile; // group loop ?>
<fieldset class="field-group field-group-submit">
<legend><?php $this->print_save_changes_label() ?></legend>
<div class="form-group">
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( $profileuser->ID ); ?>" />
<?php $PDb_Frontend_Profile->nonce_field() ?>
<?php pdb_field_group_tabs_submit_button( $this ) ?>
</div>
</fieldset>
<?php $this->print_form_close() ?>
<?php else : ?>
<?php
$error_message = Participants_Db::plugin_setting( 'no_record_error_message', '' );
if ( !empty( $error_message ) ) :
?>
<p class="alert alert-error"><?php echo $error_message ?></p>
<?php endif ?>
<?php endif ?>
<?php else: ?>
<?php echo $PDb_Frontend_Profile->no_profile_message() ?>
<?php endif; // show profile ?>
</div>

 

Support Discussions for Participants Database User Profile

Got a Support Question?

You have to agree to the comment policy.

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