Product Support

Participants Database 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.

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

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:

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.

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.

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.

Support Discussions for Pretty Permalinks

  • I have a database where the field I would like to use as an identifier looks like this: Last Name Fist Name (My ID Number)
    For example, an entry in the field could be: Smith John (12345)

    There are spaces between the last and first names, and the ID number is inside parentheses. Will this be a problem, or will I need to separate names and ID number into separate fields. If it is ok, how will the plugin treat the spaces and parentheses?

    Thanks!

    • This plugin is not set up to combine 3 fields to make the “slug”…only two fields can be used. There is a 3rd field that kicks in if the first two don’t make a unique slug. This can be modified with the use of a filter callback, so if you have some coding skills, you can set it up to combine 3 fields to make the slug. In order for the resulting slug to be valid in a URL, spaces are converted to dashes and parentheses are removed, but if you’re creating a filter to build the slug, you can do that differently, as long as it results in a valid URL.

  • Hello!
    I just purchased and added this plugin today. I believe I did all of the steps correctly. I updated all slugs and resaved permalinks under the settings, but the pretty permalinks aren’t showing. I created a new test record and that didn’t use the permalinks either.

    Any suggestions?

    • Are you using some kind of cache? You will need to clear it. Make sure you are using the latest version of Participants Database.

      • Yes, I updated to the latest version of PD this morning, and yes, I cleared the server cache, prior to writing my first message. Sorry, I should have clarified that.

        Unfortunately, that did not resolve the issue.

  • If I have a very large database, updating the permalinks seems to time out before all the records are updated. Any suggestions? I inputted the data with CSV files.

    • Hi Ryan,

      Looking at the code, I see it’s very inefficient. I will need to optimize this. For very large databases, you may have to perform the update several times to get them all done. Look for an update to the plugin in the next few days. How may records are we talking about here?

    • Ryan,

      I just released an update to the Permalinks add-on that processes the record slugs in the background. Should work well on any size database. I’d appreciate it if you’d try it out and let me know how it goes. Thanks.

  • I am looking for some assistance and I know that due to my lack of skills in PHP programming, I am very likely failing to understanding a relatively simple process…
    I have the Participants Database and the Participants Database Pretty Permalinks plugins installed for our web site (w4ovh.net).
    At this point, my challenge is trying to create a page or web menu link that takes a logged in authenticated user to an Editable Record for their own information in the database.
    I started to follow the Tips & Tutorials instructions for linking the participant’s database with WordPress users and I have created the hidden user_login field.
    However I have had no success in managing to implement the PHP code for showing a User Edit Record by dynamically accessing the database RECORD ID through any code. Im not understating how to implement the PHP code nippet. I tested by hard coding the RECORD ID for my record and the hard-coded URL works flawlessly, so I know I’m on the correct track except for getting the PHP code to function and return a RECORD ID to use in a URL.
    I’m using this PHP code you provide in the tutorial example for showing the user and editable record and using the Record Edit URL Key and have the Enable Permalinks on Record Edit URL’s checked.
    Any additional help you can provide would be great and very much appreciated.

    • Hi Andy,

      The code snippets will work, but you can’t just paste code from a template into a snippet–it probably won’t work. The template has a specific context that the snippet doesn’t have (there’s a lot to explain…). You do know what the URL to the record edit is supposed to look like, so you know what the final goal is…that’s good. All you need is a way to get the private ID for the current user. Here is some code you can use in a snippet that will get you your private ID, you’ll need to make sure it uses the correct name of the field that holds the user id.

      <?php $current_user = wp_get_current_user();
      $record_id = Participants_Db::get_record_id_by_term( 'user_id', $current_user->ID );
      $user_record = Participants_Db::get_participant( $record_id );
      $private_id = $user_record['private_id']; ?>
      • Note that I had initially used XYZ PHP Code plugin but it had errored out on all of your code examples, so I am looking to try a different PHP code snippet plugin.
        Im just not clear on how to implement the PHP code and dynamically pull the RECORD ID for a given user name and implement that in a URL or menu item to display the editable record?
        Thank you,

    • This is hugely frustrating… I’m attempting to respond and explain that I am still not able to get this to work, and my response is constantly interpreted as “spam” by the comment field…

  • I must be doing something wrong here. At my site, http://www.betterpresenting.com, I have verified that Single Record Page points to a page that has the pdb_single shortcode. I have identified my first and second columns as first_name and last_name, and have defined “rav” as the Record URL key. When I navigate to http://www.betterpresenting.com/rav/rick-altman, I expect to see my own record. Instead, I am met with a “No records found” message. This is the case for any of the 130 records in my database. Any suggestions on where to look for something afoul?

    • Did you go to the permalinks settings and click “Update All Slugs”? You need to do that after first setting up the plugin. After that it adds the slugs as the records are added.

      • Yes I did. And all of the thumbnails at http://www.betterpresenting.com/community/roster now have permalinks for their links. But all of them return “No records found” messages. I should note that I purchased and implemented this add-in simultaneous to the Combo Multi Search add-in. Is that a factor?

        • The plugins don’t have any problem working together.

          If your permalink URLs still don’t work, try refreshing the permalinks in the WP settings menu. You just need to hit “save” and that will do it.

  • Hi,
    I just set up the permalinks. It works well with one – perhaps specifically German – problem: umlauts are not supported. Names with “ä”, “ü” etc. generate an error message. Is there a solution for this?
    Many thanks for your input.
    Hans

    • This plugin is tested with UTF-8 characters, so an umlaut should’t be a problem as long as everything is in UTF-8 encoding. Where do you see the error and what is it?

      • The website is under construction. The links look as follows:

        Permalink working:
        …/weingut-nelles

        Permalinks producing an error message:

        …/weingut-glaser-himmelsto%C3%9F
        …/weingut-matthias-m%C3%BCller

        Error Message: “Es wurde kein Datensatz gefunden.” = no data found

        wp-config is set: define( ‘DB_CHARSET’, ‘utf8’ );

        Do you have an idea?

        • I found the problem, and I issued an update the to Permalinks plugin that fixes it.

  • Hi!

    I just set up the participants database and finally got around to set up the pretty permalinks. I really love the showing of records with a shorter version of the text.
    Is it possible to also set it up with the records page?
    I am currently working on my wedding site and would love to use the shorter URLs in order to have the people directly RSVP with most of the data already filled in.

    Thanks in advance for your input,
    Steven

    • Hi Setven,

      The plugin doesn’t do that currently, but it is a good idea and shouldn’t be too hard to implement.

Got a Support Question?

You have to agree to the comment policy.