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 09-06-2004, 10:47 PM
0ptima 0ptima is offline
 
Join Date: Feb 2002
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need an idea on how to do this..

I have set up Paypal subscriptions on my forum and when someone subscribes, they get an additional usergroup. The only problem is that once someone pays via paypal, I have to manually change which Display Group is being displayed.

The new additional user group ID is 12 and the following SQL can be used to update which user group is displayed.

Code:
update user
set displaygroupid = 12
where membergroupids = 12 and displaygroupid = 0;
I would like this to be automated, preferably the moment that they pay for the subscription. Does anyone have an idea on how I could automate this?
Reply With Quote
  #2  
Old 09-06-2004, 11:44 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The query won't work if they have more than one secondary group.
Anyway, you need to identify WHERE the usergroup change is made, and add another line:

$DB_site->query("query here");
Reply With Quote
  #3  
Old 09-06-2004, 11:56 PM
0ptima 0ptima is offline
 
Join Date: Feb 2002
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rake
The query won't work if they have more than one secondary group.
Anyway, you need to identify WHERE the usergroup change is made, and add another line:

$DB_site->query("query here");
I dont quite understand what you mean about the Where.

I created the following cron, which seems to work

Code:
 <?php
 
 error_reporting(E_ALL & ~E_NOTICE);
 
 if (!is_object($DB_site))
 {
 	exit;
 }
 
 $DB_site->query("UPDATE " . TABLE_PREFIX . "user SET displaygroupid = 12 WHERE membergroupids = 12 and displaygroupid = 0");
 
 log_cron_action('Subscribing Member Display Group Updated', $nextitem);
 
 
 ?>
Reply With Quote
  #4  
Old 09-07-2004, 12:27 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

membergroupids can have more than one id, and therefore the query won't work for users which are in group 12 AND 13 for example

that's what rake meant
Reply With Quote
  #5  
Old 09-07-2004, 02:15 AM
0ptima 0ptima is offline
 
Join Date: Feb 2002
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, thanks for clearing that up. I only have one additional user group, so I think I am OK.

Since I only have one additional user group, does my SQL look ok? I have set it up to run as a VBcron. If I were to run this every 30 minutes, would it be to resource intensive? Im on a shared hosting account. Thanks.
Reply With Quote
  #6  
Old 09-07-2004, 10:14 AM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not only about the usergroups you have added. A member could have as secondary groups both 12 and 6 (your custom group and admin) for example. But unless you have manually changed the secondary groups for some users or you have added promotions, you should be ok.

Running the cron every 30 minutes is fine.
Reply With Quote
  #7  
Old 09-07-2004, 03:57 PM
0ptima 0ptima is offline
 
Join Date: Feb 2002
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Guys thanks for the help. The only seconday group I have is the promotions. BTW, this would be the first "hack" that I have written!
Reply With Quote
  #8  
Old 09-07-2004, 06:29 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by 0ptima
Guys thanks for the help. The only seconday group I have is the promotions. BTW, this would be the first "hack" that I have written!
Just add the call to global.php and your good to go
Reply With Quote
  #9  
Old 09-07-2004, 06:33 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

erm?

it's a cron script, so no need to call global.php
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 02:52 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.04410 seconds
  • Memory Usage 2,240KB
  • 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
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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