vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Limit creation of Social Groups (https://vborg.vbsupport.ru/showthread.php?t=200796)

Sawa Dee SohL 01-05-2009 06:41 PM

Limit creation of Social Groups
 
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.
Code:

<?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

Quote:

Originally Posted by Spank (Post 1702663)
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>



All times are GMT. The time now is 07:21 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01008 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete