Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Modules not displaying/hiding properly

Modules not displaying/hiding properly

User registers like normal.  They can then later subscribe to a plan via Community Builder paid subscriptions.  At the point they register, they belong to the Registered group.  Once they purchase a subscription, they change to a different group e.g. Subscriber.

After logging on, if the user is only Registered with no subscription, then one menu module should display. 

After logging on, if the user has subscribed, then a different menu module should display and the other one will be hidden.

The metamod logic I'm using is -

-- Registered only

if (
  $user->usertype == "Registered"
)
return 161;

-- Subscribed (and registered)

if (
  ( $user->usertype == "Subscriber" )
) return 152;

The CB paid subscription plan changes the group from Registered to Subscribed upon payment of the sub.

Easy so far right.

Well, this metamod logic seems to work fine except, to get the right menu to show up, the user would have to log out and log back in again. CTRL-F5 doesn't help.

Why is that?  Can anyone help with this?  Or point me in the right direction?

Many thanks.

aberry
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Modules not displaying/hiding properly

Sorry, I forgot to mention, I am using Joomla 2.5 with metamod pro 3.9 and the latest CB installation.

aberry
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Modules not displaying/hiding properly

Just tried changing templates and toggling caching, thinking that might be the issue and the issue remains.  The user still has to log out for the changes in subscription status to be reflected in the menus.

Has anyone got any ideas on this one?

aberry
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Modules not displaying/hiding properly

Ugh, this is difficult. Obviously Joomla is only loading up the $user variable when the user first logs in, and changes to the usertype are not showing up.

Can you tell me if the groups that CB is using are standard Joomla groups? Or its own implementation of groups?

Another thing that *might* help is to use the JomGenius group detection. Try this to get it to print out all the groups that the current user is in, and see if it updates any better: (it may not, but it's worth a try)

print_r($core_genius->info("groups"));

If that *does* do the right thing, then you could use this syntax to check for groups:


if ($core_genius->check("groups = Registered")) return 161;
if ($core_genius->check("groups = Subscriber")) return 152;


Hope that might work,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5910
Total Posts Today:
1
User Info:
 
Total Users:
10152
Newest User:
kasautiizindagiikay
Members Online:
0
Guests Online:
233

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked