Quote:
Originally Posted by Spank
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
Code:
<?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>