nican VIP
Total posts: 392
15 Янв 2017 16:13

Hello, I want to show a module only to those users who have a certain Emerald subscription. I cannot just use the [PAID] string, because the module would be visible even if the content in it is being hidden.

I thought about using RegularLabs Advanced Module Manager

which has an option to use custom php code to show/hide the module

see here and scroll down until it says "custom php"

advanced-module-manager-php

My question is: can you provide the code to use in Advanced module manager for us non-developers?

Thank you!

Последние изменения: 19 Янв 2017


Sergey
Total posts: 13,748
16 Янв 2017 12:00

You can use Change group action. This action will attach user to new group. And then you can use Joomla core ACL to restrict view of the module.


nican VIP
Total posts: 392
16 Янв 2017 17:03

Sergey You can use Change group action. This action will attach user to new group. And then you can use Joomla core ACL to restrict view of the module.

Good idea! But what if I have already hundreds of subscribers with no particular user groups, adding the action will change also the user group of existing subscribers?

Tnx


hakana VIP
Total posts: 425
16 Янв 2017 18:48

I have an idea, why don't you fill the content of the module with something else when it is visible to non-subscribers? Two different content to subscribers and non-subscribers. Just give a useful information for example?

If you want to "change the user group" solution, don't change the user group, just add them to another group. This is how I do it.


Sergey
Total posts: 13,748
17 Янв 2017 03:17

nican adding the action will change also the user group of existing subscribers?

No. But what you can do is to change track_active to 0 in _emerald_subscriptions and actions will be triggered for those users next time they access your site.


Sergey
Total posts: 13,748
17 Янв 2017 03:19

Another way to do this is to add new position into template. This will work if you have standart template not something like yoothem. Actualy Yoothem will also work but it is too complicated to describe how to change that.

But anidea is to add new position to the layout and take this position inside [PAID].


nican VIP
Total posts: 392
17 Янв 2017 15:06

what you can do is to change track_active to 0 in _emerald_subscriptions and actions will be triggered for those users next time they access your site. Sergey

Good to know, thank you!


nican VIP
Total posts: 392
17 Янв 2017 15:11

hakana If you want to "change the user group" solution, don't change the user group, just add them to another group. This is how I do it.

Thanks hakana. I thought this is already how Emerald works... when I add an action to "change user group" the user get added to a new group, but is not removed from any group, eg. if the user is in Registered and I set Emerald action to add him to Paid Users, than he will be both in Registered and Paid Users. Am I missing something maybe?


Sergey
Total posts: 13,748
19 Янв 2017 12:58

nican Am I missing something maybe?

No. You are correct. Emerald attach new group to the user.

Работает на Cobalt