Product Support

Pretty Permalinks

Use a configurable pretty permalink to access a Participants Database record!

Product Setup

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.

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:

https://xnau.com/participants-database/record-edit?pid=W4RG6

could become something like this:

https://xnau.com/edit/W4RG6

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.

Product Settings

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.

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.

F.A.Q.

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.

Support Discussions for Pretty Permalinks

  • Hi,

    I installed this plugin just now and it works perfectly to use the record slug except when I enabled the Edit Record URL key, the email notification sent for user/member to edit the record displays as https://the.domain.com/edit/ABC123 (resulting from the [record_link] in the email template setting) but when clicked it doesn’t work – displaying “No Records”.

    Example : https://the.domain.com/edit/ABC123 does not work, and when I replaced with “?pid=ABC123” to become https://URL/edit/?pid=ABC123 – it works, I could edit the records as a user.

    At the page for “edit”, I could not use [pdb_single] as documented in the manual, but had to use [pdb_record] to get the result above. Using [pdb_single] would not display anything.

    I’ve tried every single permutations and settings, updated all the slugs and permalinks each time I changed the settings, but the result still goes back to the same thing.

    Would appreciate if you could show some directions as to where did I go wrong in the setting up.

    Thanks!

    • Whenever you make a change to the Pretty Permalinks configuration, you need to refresh the WordPress Permalinks. Go to the admin WP menu Permalinks, then save it. This will rebuild all the aliased links.

      The [pdb_single] shortcode is used to display the record’s data. The [pdb_record] shortcode is used to display an editable record. Each one of these needs to be on the designated page: the [pdb_single] goes on the configured “Single Record Page” and the [pdb_record] goes on the configured “Participant Record Page”.

      Each one of those shortcodes has its own URL, so this needs to be correctly set up to work.

      • Oh gosh, I’m so embarrassed for being too quick in sending the tech support post… you’re absolutely right, I forgot to click the Save button again the WP menu’s Permalink after making changes at PDb’s Pretty Permalink setting.

        It works immediately now, perfect and I love it!

        Thanks!!

  • Nothing showing in php error log, php version is 7.4.20

  • There is nothing relevant in the php error log. I am using php 7.4.20

    • How is this log configured? For a background operation like this, you need to use a php log that is configured at the server level, a log that is set up with a plugin or WordPress debugging is not likely to catch it. Another place to look is your server error logs, typically these are accessible in your hosting control panel.

      Anyway, I have an update coming out today that will help with the loop hanging up, but it doesn’t solve the basic problem you’re having: we don’t know what that is yet. I’ve looked very closely at this code, and I’m not seeing anything that would fail for reasons of your php configuration. The operation does use a loopback, and on some servers, this can be blocked for security reasons.

      I also removed the code that clears out all the slugs, it wasn’t needed.

  • Roland,

    I am having difficulties with the Permalinks plugin. – I have a database with about 180 records each with approx 50 fields. When I try to “Update all Slugs” any existing slugs are cleared and then the plugin seems to hang and do nothing. The “processing permalinks in the background…” notification has been running for over 24 hours with no slugs appearing to have been updated.

    If I manually edit and update a record the “Slug” field is being populated with the correct slug and the necessary links on my web pages are working as expected. – I really could do without having to update all the records individually, and then risk losing them all if I later do an “Update all Slugs”

    Can you help point me in the right direction to fix this problem please

    Running latest version of WordPress and all PDB plugins.

    Malcolm

    • If no slugs at all are getting updated, then the code that generates and saves the slugs is hanging up somewhere. Only way to know what exactly is happening is to see the php error log. Sometimes you can see this in your hosting control panel, but you may need to set it up.

      What version of php are you using?

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.