Skip to main content
joomla unpublished article preview url generator, modal screenshot

Plugin: Preview An Unpublished Joomla Article Without A Login Via a Tokenized URL

Do you want to easily share an unpublished Joomla article with someone to review it (without them having to log in) before it goes live to the public?

Do you want to easily share a Joomla article with someone when your website is offline (without them having to log in)?

If the answer to either of those is yes, I've created a nifty little Joomla plugin for you.

The need for this plugin arose with a Joomla client project where we needed a way to easily have staff members preview a page without the hassle of creating a username and password.

If this is something you need for your Joomla website, you can buy the plugin here.

joomla page preview by url without login

The plugin has a button on the article editor that triggers a modal popup. It will generate a URL with a unique token that's required to view the page.

Please Note: Both the system plugin and the task plugin are contained in the package file. You can install the zip as is for both. This plugin (Package Version 20.0.0 - pkg_articlepreview.zip) was tested and is working on Joomla 5.3.2 on PHP version 8.3.23. If you are using this plugin on a newer version of Joomla or PHP, it should still work unless Joomla or PHP makes a major change, but do please test before installing. Or, use at your own risk. If you need an update made, contact me and I'll see what I can do.

You can purchase the plugin here. It's a pay-what-you-want, with a minimum of $5.

This plugin was developed using Google Gemini. Click here to read about my transformative experience building it.

How Does This Joomla Plugin Work?

You can read below a simple, step-by-step explanation of how to use the plugin (and how it works) from beginning to end. If you have questions, feel free to reach out.

1. Generating the Link (Administrator) 🧑‍💻

After you install the package, make sure both plugins are enabled in the plugin editor.

When you're editing an article in the Joomla administrator area, here's the process.

  1. Click the Button: Click the "Generate Preview Link" button on the article editor toolbar (top right).
  2. A Secret Key is Created: The plugin securely contacts your website and generates a long, random, secret code called a token.
  3. Key Saved: This secret token is saved in a special database table. It's linked to the specific article's ID and is given an expiration date based on the "Token Lifetime" you set in the plugin's options.
  4. Link Build: The plugin creates the final preview URL, which includes the article ID and the secret token.
  5. Link Shown: A popup modal appears on your screen, showing you the complete link with a handy "Copy Link" button. You can then send this link to anyone who needs to review the article

2. Viewing the Preview (Stakeholder) 👁️

When someone without a login clicks the special preview link you sent them, here's what happens.
  1. Offline Mode Bypassed: The very first thing the plugin does is check for the preview token in the URL. If it finds one, it tells Joomla, "For this visitor, on this one page load, pretend the site is online." This is what prevents the offline login page from appearing.
  2. Article Unlocked: Next, the plugin validates the secret token against the database to ensure it's real and hasn't expired.
  3. Temporarily Publish: If the token is valid, the plugin tells Joomla, "For this one visitor, on this one page load, pretend this unpublished article is published and public."
  4. Page Displayed: Joomla's core system then loads the page as it normally would. Since the article is temporarily "published," Joomla finds it and displays it to the visitor.
  5. Re-Locked Instantly: As soon as the page is sent to the visitor's browser (a process that takes milliseconds), the plugin instantly changes the article's status back to "Unpublished" in the database.
The result is that the article is only accessible for the split second it takes to load the page, and only to the person with the correct link.

3. Automatic Cleanup (Scheduled Task) 🧹

To keep the database from filling up with old, expired tokens, the second plugin created runs in the background. You will need to create a scheduled task.
  1. Scheduled Run: Once a day (or on whatever schedule you set), Joomla's scheduler automatically runs the "Purge Expired Preview Tokens" task.
  2. Old Keys Deleted: The task runs a single, simple command: "Delete all tokens from the database that are past their expiration date."
This ensures the system stays clean and efficient without any manual intervention.

Joomla

  • Created on .
  • Last updated on .