vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Need an idea on how to do this.. (https://vborg.vbsupport.ru/showthread.php?t=69162)

0ptima 09-06-2004 10:47 PM

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?

rake 09-06-2004 11:44 PM

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");

0ptima 09-06-2004 11:56 PM

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


Xenon 09-07-2004 12:27 AM

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

0ptima 09-07-2004 02:15 AM

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.

rake 09-07-2004 10:14 AM

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.

0ptima 09-07-2004 03:57 PM

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!

Zachery 09-07-2004 06:29 PM

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 :)

Xenon 09-07-2004 06:33 PM

erm?

it's a cron script, so no need to call global.php :)


All times are GMT. The time now is 07:02 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.02441 seconds
  • Memory Usage 1,727KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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