hakana VIP
Total posts: 425
27 Июль 2014 20:37

Hi Sergey,

I have created some new user groups according to the subscription groups and created an access level for these groups. I did it to show some specific menu items only to subscribers.

The problem is I have a few hundred subscribers who bought the membership before I created these groups.

Is it possible for you to give me a piece of query so that I can assign the previous users to these new created groups?

Thanks, Hakan

Последние изменения: 28 Июль 2014


Sergey
Total posts: 13,748
28 Июль 2014 03:30

I am not exactly sure how joomla attach users to groups. But anyway I do not think you can do this by simple query. There have to be PHP to cyctle through records and check. There ios table __user_usergroup_map and actualy you have to check there.

First select all users who have subscription of that plan.

SELECT user_id 
  FROM #__emerald_subscriptions 
 WHERE plan_id IN(1,2,3) 
   AND extime > NOW()
   AND track_disactive = 0
   AND created < NOW() - NINTERVAL 1 DAY

Something like this. Now ehn you have list of the users you gor through and check in __user_usergroup_map if user is in that group.

Работает на Cobalt