1
Nick_James
Groups

How do you add a bunch of people to a group at once?

N.
Nicholas James
President - LaDads
http://www.ladads.info

2
Marco
Re: Groups
  • 2008/4/27 17:31

  • Marco

  • Home away from home

  • Posts: 1256

  • Since: 2004/3/15


look for the users import script,you will find it.
Do synergy or die.

3
Nick_James
Re: Groups

Didn't find it yet.

I did find this post by Xgarb that looks promising:

Quote:

I've pretty much achieved what I wanted. Possibly not the prettiest way to do this but here's what I did..

I created a new user group and gave it view permission for all the advert blocks. I then removed view permission for those blocks from the registered users group.

Now I need to copy all registered users into the new group so they continue to see ads.

---------

The following SQL

SELECT uid FROM your_db_prefix_groups_users_link WHERE groupid = 2

gives you a table of all registered users

exporting to SQL gives rows like this..

INSERT INTO `your_db_prefix_groups_users_link` VALUES(1);
INSERT INTO `your_db_prefix_groups_users_link` VALUES(5);
INSERT INTO `your_db_prefix_groups_users_link` VALUES(8);
etc.

I copied this into Dreamweaver and did the following find and replace...

find VALUES( replace with (groupid,uid) VALUES (4,

to give

INSERT INTO `your_db_prefix_groups_users_link` (groupid,uid) VALUES (4,1);
INSERT INTO `your_db_prefix_groups_users_link` (groupid,uid) VALUES (4,5);
INSERT INTO `your_db_prefix_groups_users_link` (groupid,uid) VALUES (4,8);
etc.

Importing this to my database adds all registered users to the usergroup id 4 (the basic usergroup that sees ads)

so now all those members are seeing ads again.

-----

Now I need to get all new signups to see the ads as well so in modules/smartprofile/register.php I added the following line..


return _PROFILE_MA_REGISTERNG;
}
//line below is my hack to add new user to basic member group
$member_handler->addUserToGroup(4, $newid);
if ($xoopsModuleConfig['activation_type'] == 1) {


around line 188

---------

to remove subscribers from group id 4 (so they don't see adverts) I added the following line to the end of the addUserSubscription in include/functions in the subscription module from Third Eye.


$deletesql = "DELETE FROM " . XOOPS_DB_PREFIX . "_groups_users_link WHERE groupid = 4 AND uid = $uid"; // my hack to remove subscriber from basic member group


I've not tested the last part but the rest seems to work ok.

Posted on: 4/18 13:35
Nicholas James
President - LaDads
http://www.ladads.info

4
trabis
Re: Groups
  • 2008/4/28 0:13

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Create a file in your root and paste this:

include_once (mainfile.php);
$member_handler =& xoops_gethandler('member');

$from_group_id 2//set this
$to_group_id 4;   //set this

$usersid $member_handler->getUsersByGroup($from_group_idfalse00);
foreach (
$usersid as $uid){
   
$member_handler->addUserToGroup($to_group_id$uid);
}
?>


Don´t forget to set the groups id.
Atention, I did not tested this.

5
Marco
Re: Groups
  • 2008/4/28 5:16

  • Marco

  • Home away from home

  • Posts: 1256

  • Since: 2004/3/15


Do synergy or die.

Login

Who's Online

215 user(s) are online (127 user(s) are browsing Support Forums)


Members: 0


Guests: 215


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits