Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Prev Previous Post   Next Post Next
  #10  
Old 08-16-2009, 01:49 PM
AndrewD AndrewD is offline
 
Join Date: Jul 2002
Location: Scotland
Posts: 3,486
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rin View Post
Hi Andrew, thanks for your reply.
Since most of the attachments are pictures and less than 200KB in filesize, I wouldn't mind broken transfers. If in the membership plan 10MB bandwidth are mentioned, I would secretly allow members a bandwidth consumption of around 15MB to avoid situations like that.
I would reduce usergroups to the basic ones and don't let members have multiple usergroups.
In my case those would simply be: Banned and Guests (no access anyway), Unsubscribed, Subscribed, Actives and the obvious i.e. Moderators and Administrators.

Because I am thinking about a subscription plan for my website. So I need to make it more valueable for members to pay a sum once in a while. I want to achieve that by giving users bandwith (or not).

I have further worked on it:
Code:
if($vbulletin->userinfo['usergroupid'] = 6) { $limitation = 1; }

$result = $db->query_read("SELECT current_bandwidth FROM " . TABLE_PREFIX . "user WHERE userid = $vbulletin->userinfo[userid]); // Get the current bandwidth usage
$current_quota = $result['current_bandwidth'] + $attachmentinfo['filesize'];  // Calculate the current quota being used including the file which the user wants to download now.

if($current_quota < $limitation)
{
 SHOW ATTACHMENT
}
else
{
 DON'T SHOW ATTACHMENT
}
$db_query_write("UPDATE " . TABLE_PREFIX . "user SET current_bandwidth = $current_quota WHERE userid = $vbulletin->userinfo['userid']");
I am going to try this out on my test-installation now. But I am sure it will be broken in one way or another.
So please, if by looking over the code you find anything which doesn't match up, I hope you can help me.
Cheers

--------------- Added [DATE]1250419067[/DATE] at [TIME]1250419067[/TIME] ---------------

As predicted, it doesn't work.
When opening attachments, it will not write the quota into the database.
I use the "attachment_start" hook.

--------------- Added [DATE]1250431666[/DATE] at [TIME]1250431666[/TIME] ---------------

Strange enough, even if I active the following plugin, all thumbnails and attachments are broken.
Code:
$db->query_write("
			UPDATE " . TABLE_PREFIX . "user SET
				current_bandwidth = 10
			WHERE userid = $vbulletin->userinfo[userid]
		");
I have used attachment_start and attachment_display as hooks.
In your last example, and I imagine in your full code, there is a syntax error. The following works correctly:

Code:
$vbulletin->db->query_write("
	UPDATE " . TABLE_PREFIX . "user 
	SET current_bandwidth = 10
	WHERE userid = " . $vbulletin->userinfo[userid]
	);
Reply With Quote
 

Thread Tools
Display Modes

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 09:26 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.15286 seconds
  • Memory Usage 2,873KB
  • Queries Executed 12 (?)
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
  • (15)bbcode_code
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (20)post_thanks_box
  • (20)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (20)post_thanks_postbit_info
  • (20)postbit
  • (20)postbit_onlinestatus
  • (20)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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