How to show of two built-in Custom Modules, one when logged-in, the other when not

General questions relating to Joomla! 4.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
phunsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jan 21, 2010 8:35 am

How to show of two built-in Custom Modules, one when logged-in, the other when not

Post by phunsoft » Tue Sep 21, 2021 5:58 pm

Hi,
Using Joomla 4. I've created two Custom Modules (built-in type Custom; not own written extension), say CustMod-A, and CustMod-B. They are both placed in position "top3" (template is shaper_helixultimate - Default), so that they show at the top of all pages.

How can I achieve the following:

- When the user is not logged-in, CustMod-A is to be shown, and CustMod-B is not to not be shown.

- When the user is logged-in, CustMod-A is not to be shown, and CustMod-B is to not be shown.

I tried Access=Public, and Access=Guest for CustMod-A, but it is shown no matter whether user is logged in nor not.
I tried Access=Registered for CustMod-B, but again it is shown no matter whether user is logged in nor not. However, when I set Access=SuperUser, that module is shown only when I log-in as superuser.

So, halfway, it seems to work. What am I missing? Is there a way to achieve what I need, lack of writing my own extension (where I could test the login state in the PHP code)?

Thanks
Last edited by imanickam on Fri Sep 24, 2021 4:39 pm, edited 1 time in total.
Reason: Corrected the spelling of when

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10882
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by sozzled » Tue Sep 21, 2021 6:47 pm

CustMod-A - set Access = Guest
CustMod-B - set Access = Registered
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

phunsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jan 21, 2010 8:35 am

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by phunsoft » Tue Sep 21, 2021 8:01 pm

sozzled wrote:
Tue Sep 21, 2021 6:47 pm
CustMod-A - set Access = Guest
CustMod-B - set Access = Registered
That's what I did first. Tried again. But both modules are shown no matter what log-in state.

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10882
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by sozzled » Tue Sep 21, 2021 8:14 pm

Very strange. This isn't the way that things should work unless you have changed the Guest and Registered usergroups and what usergroups the SU account is allocated to. It works for me, that's all I can say.
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12225
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by brian » Tue Sep 21, 2021 9:30 pm

Does it work with the default cassiopeia template? If it does then the error is with the helix template not obeying access levels.
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

phunsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jan 21, 2010 8:35 am

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by phunsoft » Wed Sep 22, 2021 7:25 am

sozzled wrote:
Tue Sep 21, 2021 8:14 pm
Very strange. This isn't the way that things should work unless you have changed the Guest and Registered usergroups and what usergroups the SU account is allocated to. It works for me, that's all I can say.
I'll have to check. This is an elder community website, that I have taken over the admin job. I have upgraded from Joomla 3 to 4, and am doing a complete redesign of the look and feel. Maybe something bad was done in the past.

But knowing that this is the way it is supposed to work, and that my understanding correct, is good to know.

brian wrote:
Tue Sep 21, 2021 9:30 pm
Does it work with the default cassiopeia template? If it does then the error is with the helix template not obeying access levels.
Good hint! I'll check.

Thank you both for your time.

phunsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jan 21, 2010 8:35 am

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by phunsoft » Thu Sep 23, 2021 9:12 pm

brian wrote:
Tue Sep 21, 2021 9:30 pm
Does it work with the default cassiopeia template? If it does then the error is with the helix template not obeying access levels.
I switched to the Cassiopeia template and tried again. No luck. Both modules are show no matter whether logged-in or not. So I'll have to check groups, permissions, ACLs on that system. But first I need to get a deeper understanding of how this works in Joomla. Currently, I don't have a clue where to begin.

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10882
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by sozzled » Thu Sep 23, 2021 9:15 pm

I liked @brian's suggestion: it's good, when trying to analyse problems, to eliminate as many third-party "things" as possible.

I wrote before:
sozzled wrote:
Tue Sep 21, 2021 8:14 pm
This isn't the way that things should work unless you have changed the Guest and Registered usergroups and what usergroups the SU account is allocated to. It works for me, that's all I can say.
So my question remains unanswered: did you modify any ACLs on your J! 4 website?
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

phunsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jan 21, 2010 8:35 am

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by phunsoft » Fri Sep 24, 2021 10:26 am

So my question remains unanswered: did you modify any ACLs on your J! 4 website?
Ok, I can answer this question easily: No, I didn't, but I can't tell whether adverse modifications had been done in the past. As I wrote in a previous post, I have "inherited" this site, and it is not a fresh J4 install, it was upgraded from J3.

I'll read up upon Joomla ACLs and will then try to figure out what might be wrong.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 40344
Joined: Sat Apr 05, 2008 9:58 pm

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by Webdongle » Fri Sep 24, 2021 11:33 am

Set one 'Public' the other 'Registered'
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
ceford
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 239
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by ceford » Fri Sep 24, 2021 3:10 pm

Webdongle wrote:
Fri Sep 24, 2021 11:33 am
Set one 'Public' the other 'Registered'
Actually, you need to set one to Registered and the other to Guest. The latter appears before login and disappears on login, which I think was the desired behaviour. The former only appears on login. I just tried this myself using two copies of the Custom HTML module.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 28186
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: How to show of two built-in Custom Modules, one when logged-in, the other when not

Post by Per Yngve Berg » Fri Sep 24, 2021 5:58 pm

Check the Options in User Manager, that Not Logged in Users are set to "Guest"

phunsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jan 21, 2010 8:35 am

Re: How to show of two built-in Custom Modules, one wehen logged-in, the other when not

Post by phunsoft » Fri Sep 24, 2021 6:40 pm

ceford wrote:
Fri Sep 24, 2021 3:10 pm
Webdongle wrote:
Fri Sep 24, 2021 11:33 am
Set one 'Public' the other 'Registered'
Actually, you need to set one to Registered and the other to Guest. The latter appears before login and disappears on login, which I think was the desired behaviour.
Yep, that would be the desired behaviour, but at that site it doesn't work, probably because of some troubles with ACL settings (as others suggested). I'm looking into this.

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10882
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: How to show of two built-in Custom Modules, one when logged-in, the other when not

Post by sozzled » Fri Sep 24, 2021 6:48 pm

I've asked you a couple of times about ACLs. Have you changed anything from the default settings? As a test, why not create another J! 4 website (but this time, don't change any default installation values) and try the same thing again? Do things work properly on the new[er] site?
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

phunsoft
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Thu Jan 21, 2010 8:35 am

Re: How to show of two built-in Custom Modules, one when logged-in, the other when not

Post by phunsoft » Fri Sep 24, 2021 7:42 pm

sozzled wrote:
Fri Sep 24, 2021 6:48 pm
I've asked you a couple of times about ACLs. Have you changed anything from the default settings?
Earlier today, I posted
phunsoft wrote:
Fri Sep 24, 2021 10:26 am

Ok, I can answer this question easily: No, I didn't, but I can't tell whether adverse modifications had been done in the past. As I wrote in a previous post, I have "inherited" this site, and it is not a fresh J4 install, it was upgraded from J3.
I had thought this would answer the question whether ACLs had been modified? I just don't know.

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10882
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: How to show of two built-in Custom Modules, one when logged-in, the other when not

Post by sozzled » Fri Sep 24, 2021 7:53 pm

Easy enough to check. Create a new J! 4 wesbite and try it out. ;)
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)


Post Reply

Return to “General Questions/New to Joomla! 4.x”