Conditional Content

[SOLVED] Can I Use a URL in Conditional Content?

6 months 3 weeks ago #77462

Andy Connell's Avatar Andy Connell

Using a Joomla! Article as a homepage for an intranet site, I want to display a message to users, telling them to register or login, etc when they are not logged in.
When they have logged in I want the page to redirect to a different URL (Featured Articles). Is this possible with "Conditional Content"

Currently, I have just tested this;

{show usergrouplevels="Guest"}Not Logged In Test{show-else}/staff-portal-home{/show}

This works showing the text for logged in and not logged in users, but doesn't redirect the URL.
I have altered the login module to redirect logged in users to the URL(above), but Ideally, I want a logged in user to always see the featured articles.

I feel like I am missing a better way to do this :huh:

Andy

6 months 3 weeks ago #77463

Peter van Westen's Avatar Peter van Westen Admin

Not sure I understand what you want exactly.
You could place a piece of php code (through Sourcerer) to redirect the logged in users:

{show usergrouplevels="Guest"}
   Not Logged In Test
{show-else}
   {source}<?php header('Location: /your-special-url'); ?>{/source}
{/show}

6 months 3 weeks ago #77464

Andy Connell's Avatar Andy Connell

EDIT - That works with Sourcerer, Thanks!

6 months 3 weeks ago #77465

Peter van Westen's Avatar Peter van Westen Admin

Should work.

So what are you trying to do?
Have logged in users that visit a certain page get redirected to a different page?

6 months 3 weeks ago #77468

Andy Connell's Avatar Andy Connell

I tried to edit my reply quickly, as yes it does work, I noticed JCE Editor was striping out the {source} code.
Thanks for your speedy help, I appreciate it!

Anyone Else Struggle with this, look at this post - www.joomlacontenteditor.net/support/foru...ped-code#reply-94453

6 months 3 weeks ago #77469

Peter van Westen's Avatar Peter van Westen Admin

My pleasure :)

6 months 3 weeks ago #77612

Andy Connell's Avatar Andy Connell

Struggling with this again?
I have Conditional Content & Sourceror Installed & tried both these;

{show accesslevels="Guest"}NLI Test{show-else}
{source}<?php header('Location: /your-special-url'); ?>{/source}
{/show}
{show usergrouplevels="Guest"}NLI Test{show-else}
{source}<?php header('Location: /your-special-url'); ?>{/source}
{/show}

But when not logged in & you visit the Conditional Content Page, you are directed immidiatly to the "/your-special-url" link. I checked I am not logged in & also cleared all cache & sessions table too.

If I alter to;
{show usergrouplevels="Guest"}NLI Test{show-else}Logged In{/show}
or
{show accesslevels="Guest"}NLI Test{show-else}Logged In{/show}

Either of these work as expected showing the correct message to users?

Any clues where I am going wrong?
Confidential information:
(hidden)

6 months 3 weeks ago #77613

Peter van Westen's Avatar Peter van Westen Admin

Make sure the Sourcerer system plugin is ordered after Conditional Content.
See: www.regularlabs.com/blog/242-plugin-order-is-important

6 months 3 weeks ago #77614

Andy Connell's Avatar Andy Connell

:( :angry: :unsure: :ohmy: :huh:

Thanks for the fast reply, especially during family time ;)
I owe you a beer at #JAB18 - assuming your going

6 months 3 weeks ago #77615

Peter van Westen's Avatar Peter van Westen Admin

I'll be there ;)