Problem Solving

Answers to questions and solving problems with Conditional Redirect.

I can't get to a page to edit it

If you can't get to a page to edit it, you have likely set a condition that redirects you.

You will need to login as the Super Admin (user 1) who is always exempt from Conditional Redirect.

Who is exempt from Conditional Redirect?

The Super Admin is always exempt.

Additionally, users can be exempted:

  • None
  • Any registered user is exempt
  • Any user with edit permission is exempt

These are based on system permissions, so are not tied to specific user groups.

Are my conditions evaluating?

Are you exempt? See above.

First, check the log at /dashboard/reports/logs. If an exception has occurred when evaluating a {{place-holder}} in a condition it will be recorded in the log.

Then, set the debug flag in the attribute edit dialogue.

Problem_Solving_Screengrab_1657972735.png

Use a different browser that is not logged in and visit the page with the Conditional Redirect attribute again. Condition evaluation, session storage actions and redirect actions will be logged for that condition.

How does Page Cache affect Conditional Redirect?

If the Page Cache is enabled, a page with a conditional redirect attribute could be saved to the cache and so prevent further evaluation of the attribute when the page is revisited by the current user or by another user.

Perhaps this is the outcome you desire and you can leave the cache enabled. However, in many cases you will need to disable the page cache in order for the Conditional Redirect attribute to be evaluated reliably for individual visitors.

Page Cache

How do multiple conditions work?

At the bottom of any condition is a radio set to do one of end the conditions, And or OR.EndAndOr

At the end of the first condition, all options are available. Selecting AND or OR will show another condition, where further conditions are limited to the previously selected AND or OR.

AndAgain

You can have up to 5 conditions combined in this way, all AND or all OR.

If you need more than 5 conditions in any Conditional Redirect attribute, this number of conditions can be configured in application/config/ at jl_conditional_redirect.condition_engine.max_conditions.

Can I have more than one Conditional Redirect attribute?

The default installation of Conditional Redirect is pre-configured with one page attribute called Conditional Redirect.

You can set up as many different attributes of type Conditional Redirect as you like. Just add them like you would any other attribute in the page attributes dialogue and edit them on your pages.

However, Conditional Redirect will not process those attributes! You also need to change a setting in application/config.

The processing of multiple attributes can be configured at jl_conditional_redirect.conditional_redirect_mode which can have the values single_attribute (default) or multi_attribute.

When multi_attribute is configured, all Conditional Redirect attributes for a page are executed in alphabetical sequence. The first redirect ends that sequence.

This should not be configured unless you actually need it as it presents an overhead for all pages, not just those with the attribute.

This configuration is reversible. Just change the configuration value to single_attribute.

How do multiple Conditional Redirect attributes work?

Firstly, you need to enable multi_attribute, as described above.

Multiple attributes are evaluated in alphabetical order of the attribute handles. The first attribute to redirect will redirect and any further attributes will not even be evaluated. This addon is Conditional Redirect, not "Conditional stay".

Hence, if you have a complex nest of redirects, you need to think carefully about the order they will be evaluated in.

If you need to manage the order of evaluation, the only way to do so is by naming the attributes (actually their handles) in the alphabetical sequence you need them to be evaluated in, so you need to plan such behaviour at the time you add the attributes in the page attributes dashboard.

301 or 302 redirect?

A 301 redirect means that the target page has taken over permanently. A browser will cache the redirect and not bother to check back again.

A 302 redirect is a temporary redirect. It sends a browser (and search engines) to the desired page until the 302 redirect is removed.

More information on Wikipedia.

How do I use Form Reform UTM with Conditional Redirect?

Form Reform UTM may have Form Reform in its name, but Form Reform is not required to actually use it. You can install Form Reform UTM with Conditional Redirect even if you don't have Form Reform installed!

With Form Reform UTM and Conditional Redirect, you can create redirects based on UTM tags simply by inserting tokens like {{utm:campaign}} into your redirect conditions.

Are UTM tags being recorded for guests?

This is a tricky point. During development of Form Reform UTM we discovered that some Concrete CMS installations were not saving guest session data recorded using the core session object when saved from the controller on_start() method. It worked on some servers. It didn't on others. We have no idea why.

Hence Form Reform UTM provides a choice of 3 recording mechanisms.

  1. php $_SESSION (default)
  2. The Concrete $session object (check this works reliably for your server and guests)
  3. A cookie using the Concrete $cookie object.

Recording in a session only lasts as long as the session. Recording in a cookie can be configured for any cookie lifetime.

How do I redirect system pages?

By default, Conditional Redirect is disabled for system pages such as Login or Register. You can add a Conditional Redirect attribute to these pages, but it won't do anything. This is because a badly configured redirect could prevent you from accessing critical functionality such as logging in!

Conditional Redirect can be enabled to work with system pages by setting the configuration value jl_conditional_redirect.allow_system_pages to true.

Any Conditional Redirect attribute added to a system page will then evaluate as it would for any other page. If you accidentally lock yourself out by making a mistake with such a process, you can get back in by removing the configuration setting or setting it to false.

return [
    'conditional_redirect_mode' => 'multi_attribute',
    'allow_system_pages' => true,
    'condition_engine' => [
        'max_conditions' => 5,
    ],
];

Whoops on install

What we mean here is an internal code exception in an addon or the core when you click the install button from the Add Functionality dashboard page or when you visit a page after installing an addon package. 

If you experience such an issue, here are a few things you can check that may resolve the problem.

  1. Php Version. Check your php version is compatible with the addon, For example, check if you are running php5.6 when an addon requires php7+. You can find the php version in the report at /dashboard/system/environment/info. As a general guide, if your site is ConcreteCMS version 8+ then aim to run on at least php7.2. (It will run on lower versions, but less efficiently)
  2. Database Entities. ConcreteCMS uses a database abstraction layer called Doctrine. Doctrine works by creating proxy classes that map between php data and the database and sometimes these get out of step or muddled into a chicken and egg dilemma. The dashboard page at /dashboard/system/environment/entities has a switch to control when the proxy classes are regenerated. Try placing this into Development mode when installing an addon package (but remember to disable development mode to speed up a live site)
  3. Cache. ConcreteCMS makes extensive use of a number of different caching mechanisms to speed up web pages. When installing a package, sometimes outdated cached data causes issues with the install. Try disabling all the caches at /dashboard/system/optimization/cache when installing an addon package (but remember to re-enable the caches for a live site).
  4. Theme. Most marketplace themes are well behaved. Nevertheless, sometimes a theme can interfere with an addon package, so try switching the site theme back to Atomik using /dashboard/pages/themes. You won't loose any content on the front of your site, but some page areas may not be shown until you swap back to your theme.
  5. Middleware. Some addons implement middleware layers that manipulate pages before and/or after the main rendering of each page. If such addons are installed, there is a possibly they could interfere with the dashboard and other addon installation. Most such middleware implementations include condition checks to ensure they don't mess with the dashboard, but perhaps you can switch them temporarily off just to be sure.

If you experience a code error on or immediately after install and need assistance, please use the Get Help link from the addon marketplace page to report the problem. On the Whoops report, click the [copy] button immediately below the error message. That will provide a stack trace you can paste into the help request and save time having to request that report later.

Manually Installing or Updating an Addon or Theme

Perhaps you are unable to connect your site directly to the ConcreteCMS marketplace to install an addon or theme. This manual process works for all addons and themes - not just mine.

  1. In your concrete account, find the addon/theme in your Purchase History > Licenses and download. Make sure to scroll down to the most recent version before downloading.
  2. Then copy the zip to your site /packages/ directory and unzip (not /concrete/packages !!!). This is usually easiest using your host cPanel file manager.
  3. In your site, visit the Dashboard > Extend page and the theme package will be ready to install or update

The process is exactly the same for addons and themes, except themes have an extra step of activating the theme after installing.

Sometimes step 3 above can run out of PHP execution time. This is most likely when installing an addon or theme that installs a large amount of sample content. You should not run into such an issue with any of my addons or themes.

If you do run into such issues, you can run the install manually from the shell command line.

$ concrete/bin/concrete5 c5:package-install my_package_handle

or

$ concrete/bin/concrete5 c5:package-update my_package_handle

When updating, be sure to replace the previously installed package directory rather than adding to it. If not, you could end up accumulating obsolete debris from a previous version of the package.

If you find yourself needing to install or update many addons or themes manually, consider my Package Magic addon.

Once Package Magic Starter is installed, through the marketplace or manually, all further installs can be handled from the site dashboard using Package Magic.

Additional Pages

Conditional Redirect in not a substitute for page permission. If you need genuine security, require users to register and login and use page permission to determine what pages they can see.