Use a configurable pretty permalink to access a Participants Database record!
This Participants Database add-on works by taking one or two fields from a record and making a “slug” that is used to access the record with a human-readable string. This is the same way posts and pages work in WordPress using the post title as the source for the slug. Every slug must be unique, and so there is a third field that can be used if the first two fields don’t make a unique slug. If the third field is not defined, a number is used instead: just as WordPress does for it’s permalinks.
Because this plugin uses the WordPress Permalinks functionality, you cannot use the “Plain” setting (which means don’t use pretty permalinks) in your WordPress Permalinks with this add-on.
Note: this plugin is not compatible with the use of the “single_record_link” attribute in a list shortcode to point to an alternative single record page. The single record pretty permalink can point to only one single record page.
Setting it Up
To set up PDB record slug generation, the first thing you’ll need to do is select your slug source fields. If your records are for people, first and last names would be an obvious choice. If you are using Participants Database as a business directory, then you might want to use the name of the business as the first field, nothing for the second, and then the name of the town or locality for the third in case there are several entries with the same company name.
Now, set the Record URL Key, which is a string that identifies the URL as that of a Participants Database record. For instance, if your records are for members, you may want to use “member” or “members” if they are businesses (like for a directory) you might want to use “company” or something like that. This string serves as a way to tell WP that what is looked for is a Participants Database record, so it must be unique to your install.
The plugin uses the “Single Record Page” setting under the List tab in the Participants Database settings. Make sure that setting points to a page with a
[pdb_single] shortcode on it.
Once that is set to your liking, click the “Update All Slugs” button to create slugs for all your records. Slugs for individual records can be changed if the automatically-generated one isn’t quite right.
Now, all standard links to participant records (such as those in the list display) will be updated to pretty permalinks.
Pretty Permalinks on Record Edit Links
As of version 1.2, it is possible to use pretty permalinks on your record edit URLs as well. A URL that looked like this:
could become something like this:
This only needs to be enabled in the settings. You can also set the “key” word that is used to designate the permalink. In the example above the key is “edit,” you can change that to whatever you need it to be. The private ID code is used as the slug, that can’t be changed.
First Identifier Field
This will make the first part of the unique slug used to identify a record.
Second Identifier Field
This is where the second part of the slug is drawn from. The first and second parts are separated by a dash. If this setting is omitted, then a unique slug is attempted using only the first field.
Auxiliary Identifier Field
The third field is brought in in case the identifier field or fields don’t make a unique slug. Leave this blank and a number will be used instead.
Record URL Key
This string identifies the URL as one that will call up a single record. Make it something descriptive of the type of record, such as “members” or “companies.” Your pretty permalinks will look like this:
http://your-domain.com/%URL_key%/%record_slug% so choose an URL key that will make your URLs readable.
This will enhance the SEO of all your URLs as they will now be very readable.
Enable Permalinks on Record Edit URLs
Check this to use permalinks on your record edit URLs. This will change the “private link” that is included in your signup emails, also any frontend edit links you have set up. The old URLs will still work.
Record Edit URL Key
This is the “key” word that is used to designate the URL as a record edit link. This cannot be the same as an existing page or post slug.
Update All Record Slugs
This is usually used once just after configuring the plugin. It fills in the slugs for all your records. It’s not needed after that because any new records will have slugs generated for them. If you want to edit an individual slug, you can do that, but this button will overwrite all those custom slugs, so bear that in mind. It can also take a long time if you have a very large database.
How do I include a record permalink in my email templates?
The permalinks add-on saves a unique slug for each new record in a field named “record_slug.” To include a link to a record in an email template, you use that value tag to construct your link. Let’s say your single record shortcode is on a page named “show-record” your link would be constructed like this in the email template:
<a href="https://xnau.com/show-record/[record_slug]">View your record here</a>
This link will always work, even if you restructure your Participants Database permalinks.
My site uses "Plain" permalinks. Can I use this add-on?
This add-on uses the WordPress Permalinks API to route the URL to the correct page and record. In your WordPress Permalinks setting, the “Plain” setting turns this API off, so it is not possible to use Participants Database Pretty Permalinks with the “Plain” setting.
Any of the other permalink settings will work, however.