vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Automatically change usergroup after certain amount of time (https://vborg.vbsupport.ru/showthread.php?t=59248)

zsmom 12-18-2003 01:08 AM

Automatically change usergroup after certain amount of time
 
I would like there to be a way for members' usergroups to automatically change to a different one after a certain amount of time since their last post.

This seems like it would be fairly simple to do, but I have no idea.
Or is there a way to do this already?

Logician 12-18-2003 09:14 AM

do you want to change at the moment they revisited the board or even if they dont revisit? If latter, it will require a cron script.

Zachery 12-18-2003 10:55 AM

could be done with vb3 very simply as its a built in feature

zsmom 12-18-2003 11:26 AM

I'd prefer it to change even if they don't revisit. But either way would be fine with me. It beats having to do it manually, that's for sure.

Logician 12-18-2003 05:56 PM

let us know:
a) Usergroups the hack will apply
b) New Usergroup hack will put users in
c) Time hack will check

zsmom 12-18-2003 08:05 PM

Ok...usergroups 9 and 11 would change to usergroup 2 at 30 days since last post. And I guess it would check this once per day, midnight I guess, though that part doesn't matter much.

Thanks!!!

Logician 12-18-2003 09:03 PM

Create a "anynameyouwant.php" file in your forum directory and put this code inside that file:
PHP Code:

<?php
   set_time_limit
(900); 
   require(
'./global.php');

   
$userArray=$DB_site->query("SELECT * FROM user WHERE (usergroupid=9 OR usergroupid=11) AND posts>0");

   while (
$user=$DB_site->fetch_array($userArray)) 
       {
       
$days mktime (date("H"), date("i"), date("s"), date("m"), date("d")-30date("Y"));
    
       
$lastpost=$DB_site->query_first("SELECT dateline FROM post WHERE visible=1 AND userid='$user[userid]' ORDER BY dateline DESC LIMIT 1");
         if (
$lastpost[dateline]>AND $lastpost[dateline]>$days)
           {
           
$DB_site->query("UPDATE user SET usergroupid=2 WHERE userid='$user[userid]'");
           }

       }
?>

Now configure your CRON job to run this file once everyday at any time you like.

Please test this script in a test board first! I dont expect a problem but I don't like giving away scripts like this as they make changes in DB so a bug can create serious problems. I didnt test the script myself.

zsmom 12-20-2003 01:20 AM

Thank you so much! I'll give it a whirl...

g-force2k2 12-20-2003 05:03 AM

Question Logician, what exactly does set_time_limit( ) function do? I appreciate any assistance.

Regards,
g-force2k2

zsmom 12-20-2003 07:11 AM

Ok, I tried it and it changes everyone in usergroups 9 & 11, regardless of the time since their last post, to usergroup 2. Any ideas?


All times are GMT. The time now is 12:37 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.01041 seconds
  • Memory Usage 1,734KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete