Log in

View Full Version : Limit creation of Social Groups


Sawa Dee SohL
01-05-2009, 06:41 PM
I wanted to make it so members can create 1 Social Group only - not multiple..

I have found a way to set it up so only certain groups can create social groups...but found no way to limit the amount they can create...

Is there a Mod for this? I didn't see one...

Bellardia
01-05-2009, 08:17 PM
I tossed up a script for you, copy the source and paste in texteditor like notepad, and save it as something.xml. Upload it as a product.

How it works : When on the groups.php page, it does a check on the query string to see if it is do=create, if it is, it counts the amount of groups the user viewing the page has created. If the amount is greater than 0, it returns and error message, if not it permits a user to create a group.

I tossed this up quickly, I believe it's bug free but let me know ;). It uses 1 query, 0 file mods and 0 table edits.

Do not reupload, repost or distribute without my permission, please.

<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="bellardialimsocgroups" active="1">
<title>LimitSocialGroups</title>
<description>Limit the amount of social groups to 1</description>
<version>0.1</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>Limit Social Groups</title>
<hookname>group_complete</hookname>
<phpcode><![CDATA[if ($_GET['do'] == 'create')
{
if($db->num_rows($db->query_read("select * from `".TABLE_PREFIX."socialgroup` where `creatoruserid` = ".$vbulletin->userinfo['userid'].";")) > 0)
{
eval(standard_error(fetch_error('toomany')));
}

}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="Error Messages" fieldname="error">
<phrase name="toomany" date="1231193285" username="elliian" version="0.1"><![CDATA[You are only permitted to create one social group. Please delete your old one before creating another.]]></phrase>
</phrasetype>
</phrases>
<options>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>

Sawa Dee SohL
01-05-2009, 08:31 PM
Wow! You're a live saver!! Thank you!! (they need the thank you hack here IMO)

Spank
01-05-2009, 09:36 PM
Is it possible to do a similar thing where a user can only be a member of one social group at a time?

Bellardia
01-05-2009, 10:14 PM
Is it possible to do a similar thing where a user can only be a member of one social group at a time?

Here you go, should effectively limit all users to one group.
Take note, it will not kick users from groups who are already in more than one, but it will prevent them from joining more. They will have to leave all groups before joining a new one.

Copy code and include in xml file, upload as a product.

As before Do not upload, post or distribute without my consent


<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="bellardialimgroups" active="1">
<title>Limit Members of Social Groups</title>
<description>Limit each user to 1 social group</description>
<version>0.1</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>LimitMembers</title>
<hookname>group_complete</hookname>
<phpcode><![CDATA[if ($_GET['do'] == 'join')
{
if($db->num_rows($db->query_read("select * from `".TABLE_PREFIX."socialgroupmember` where `userid` = ".$vbulletin->userinfo['userid'].";")) > 0)
{
eval(standard_error(fetch_error('join1')));
}

}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="Error Messages" fieldname="error">
<phrase name="join1" date="1231200636" username="elliian" version="0.1"><![CDATA[Oops! You may only be a member of one social group at a time. Please leave your current group before joining another!]]></phrase>
</phrasetype>
</phrases>
<options>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>