0

I am using a plugin that uses unique user ids (uuid) to let visitors access some information. They receive this information by email.

This works great, if the visitor opens the direct page with a url containing the query string, for example:

https://www.example.com/user_site/?uuid=237237

As soon as the user opens the link and navigates to another page, and then maybe to its user_site, the query string is lost.

History of opened urls:

  1. https://www.example.com/user_site/?uuid=237237

  2. https://www.example.com/another_site fuck, the query string is lost

  3. https://www.example.com/user_site no access, who even is this guy?!

How can I change this and pass (or parse) the query string while the user stays on the site? Or can I even cache it? I can use php, .htaccess javascript or jQuery to achieve this.

How the history should be:

  1. https://www.example.com/user_site/?uuid=237237

  2. https://www.example.com/another_site/?uuid=237237 good, still know who you are

  3. https://www.example.com/user_site/?uuid=237237 great, come in

1

It is possible to add a filter to the_content that takes the query_var (in this case 'uuid=237237') from the url and appends it to any outgoing links. But that is beside the point. Because if the link leads to a place outside the current WordPress install the query_var will be lost anyway, even if the user returns afterwards.

Using query_var as an authentication method is simply not a good idea, because it is not persistent and easily falsified. WP has a built in user registration system to let users access restricted information repeatedly. There are plenty of plugins that provide extended interfaces if needed.

The best course to follow here is not trying to adapt your plugin, but ditch it for one that enables proper user registration and access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.