Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated

Add Users To Groups via SQL Query

9 years 8 months ago
Licenses:
JomSocial Active Socialize Expired

This is for Michal

I am looking for a SQL query that will go through each users record and add them to a given JS group number if they are not currently a member.

The idea is to have one user group on JomSocial that has everyone in it. I already have a plugin that is auto-joining new users into given groups. I just need to go back and get about 4,000 other users moved into certain groups.

Many thanks!!

9 years 8 months ago
Licenses:

Hi, Craig.

Make a safe copy of your DB first!!

Please run this query in db:

UPDATE `your_database_name`.`prefix_community_users` SET `groups` = CASE WHEN `groups` = '' THEN '12' ELSE CONCAT(groups, ',12') END

your_database_name - replace with your db name
prefix - replace with your db tables prefix
12 - replace with your group ID

What this query does?

Updates data in column "groups" in table "prefix_community_users" in "your_database_name" database. It contains a condition: when cell in "groups" column is empty add just a number, but if there are already other numbers adds number with comma.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW