Features / Usability

Features / Usability

How to show a module to Anonymous users *only* ?

posts: 35 Switzerland

On our intranet, I'm trying to lure users into logging in by showing them a "Last Changes" list (in the left column, with the login box on the right)
Once they've logged in, I'd like to *replace* that module by the content of the since-last-visit-new module (GREAT functionality, BTW), in other words, "don't show Last Changes anymore, but show Since Your Last Visit with clickable links".

I've tried:
- setting Last Changes to "Anonymous" only (and since-last-visit-new to Registered, of course) => shows for Registered users too :-(
- giving them the same order number => just lines them up one after the other :-(

I've thought about putting the Last Changes in the middle part for the anonymous users, but that seems to involve a bit of coding :-(

Any hints ?

posts: 1092

The code to do that was in comments .... I reintroduced the code in 1.9CVS.
So now you have a new check box in admin/general
"Hide anonymous-only modules from registered users:"
Don't forget to uncheck
"Display modules to all groups always:"
after having assign all the modules with the appropriate groups

posts: 35 Switzerland

Thx sylvie!
For now (workaround) I've just sent it to the bottom of the column (position 49), looking forward to upgrading to 1.9 when it's stable...

posts: 4644 Japan

For now, to separate Anonymous group from other groups, you can apply this hack from alt.thetinfoilhat.com to tikilib.php and userslib.php (as quoted from that page — not sure if that site is still online or not, but I want to give credit):

Both in tikilib.php and userslib.php the Anon group gets added to a user's list of groups; around line 1030 (Tiki 1.8.2) in tikilib.php:

$ret[] = "Anonymous";

Replace this line with a conditional statement (otherwise Anonymous group won't work) (lines 1031-1033):

if(count($ret) == 0) { // This could be an option in the admin menu
        $ret[] = "Anonymous";

And in /lib/userlib.php,
Same change as in tikilib.php, at around lines 732-735 (Tiki 1.8.2).

I use this at a couple of sites and it works fine, with no problems.

-- Gary

Upcoming Events

No records to display