Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2009, 06:41 PM
Sawa Dee SohL Sawa Dee SohL is offline
 
Join Date: Aug 2008
Location: www.TheSocialRev.com
Posts: 277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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...
Reply With Quote
  #2  
Old 01-05-2009, 08:17 PM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #3  
Old 01-05-2009, 08:31 PM
Sawa Dee SohL Sawa Dee SohL is offline
 
Join Date: Aug 2008
Location: www.TheSocialRev.com
Posts: 277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow! You're a live saver!! Thank you!! (they need the thank you hack here IMO)
Reply With Quote
  #4  
Old 01-05-2009, 09:36 PM
Spank Spank is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 809
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible to do a similar thing where a user can only be a member of one social group at a time?
Reply With Quote
  #5  
Old 01-05-2009, 10:14 PM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Spank View Post
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>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:36 PM.


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.03582 seconds
  • Memory Usage 2,204KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete