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

  • 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?

Leave a Reply to Roland Barker Cancel reply

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.