Skip to Content Skip to Menu

🎉 Black Friday sale — Last days! Great savings on Professional and Developer Memberships! Get 25% off now with code BLACK-FRIDAY-2025!

Auto action conditions question

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 473
  • Thanks: 40
  • Karma: 3
  • Add-ons
44 minutes ago #342541 by liaskas
Auto action conditions question was created by liaskas
Hello...

we need an auto action that will redirect guest users to a specific page if the article they try to access is not public.

So far we have...

Global
Triggers: onContentBeforeDisplay
Type: Redirect
User: Automatic
Access: All Non-Registered Users

Conditions
Condition 1: Here we need to set that the redirection is only for articles. Not all content.
Condition 2: Here we need to set that the redirection will happen only to articles that are not public

Action
URL: ARTICLE_URL_HERE

Can you please help me with the conditions?

Thank you in advance.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 49801
  • Thanks: 8513
  • Karma: 1465
18 minutes ago #342543 by krileon
Replied by krileon on topic Auto action conditions question
The variables for that Joomla event can be found below.

manual.joomla.org/docs/building-extensions/plugins/plugin-events/content/#oncontentbeforedisplay

So the following would be how they're mapped in CB Auto Actions.

var1 = context
var2 = item
var3 = params
var4 = page

For articles the context would be "com_content.article". This would mean your first condition needs to be the following.

Field: Custom > Value
Custom Value: [var1]
Operator: Equal To
Value: com_content.article

The problem with the access check is I believe Joomla's ACL will prevent access and result in a 404 before that event ever fires. So your article would have to be set to Public then you add your access check basically by using the auto action to redirect away and the easiest way to do that is just set the auto actions Access to "All Non-Registered Users" as you've already done. I suppose you'd need a way to flag specific articles for this redirect behavior though. Are they in a specific category? maybe have a specific Joomla tag?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum