Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > vB1 Hacks
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Xenon Xenon is offline
Developer Last Online: Oct 2023 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-04-2001 Last Update: Never Installs: 0
 
No support by the author.

Hi!
Some Days ago, I post a request on such a Hack, but noone want to do so, so I write it myself
I hope there are persons out which could need it

This Hack ist written and testet on 1.1.4, i don't know if it works on other Versions!

Ok:
Put in your user.php in the admin-path:
PHP Code:
// ###################### Start move by Xenon ##############
if ($action=="move") {
  
  echo (
"Move Users Version 2.0 by Xenon");
  echo 
doformheader("user","domove");
  echo 
"<table border=0>";
  echo 
makeinputcode("Users to move at once:","perpage","1000");
  echo 
"<br>";
  echo 
makechoosercode("Move Users to:","newusergroupid","usergroup",2);
  echo 
makeyesnocode("Update Usertitles","updatetitle",1);
  
  
  echo 
"<tr><td colspan=2><br>Move users where:</td></tr>\n";

  echo 
makeinputcode("User Name contains","ausername");
  if (
$pwdincp!=0) {
    echo 
makeinputcode("and password contains","apassword");
  }
  echo 
makechoosercode("and usergroup is","usergroupid","usergroup",-1,"Any");
  echo 
makeinputcode("and email contains","aemail");
  echo 
makeinputcode("and parent's email contains","parentemail");
  echo 
makeinputcode("and is coppa user (yes, no, blank for don't mind)","coppauser");
  echo 
makeinputcode("and homepage contains","homepage");
  echo 
makeinputcode("and ICQ Number contains","icq");
  echo 
makeinputcode("and AIM Handle contains","aim");
  echo 
makeinputcode("and Yahoo Messenger Handle contains","yahoo");
  echo 
makeinputcode("and Biography contains","biography");
  echo 
makeinputcode("and Signature contains","signature");
  echo 
makeinputcode("and User Title contains","usertitle");
  echo 
makeinputcode("and Join Date is after<br>(Format yyyy-mm-dd, leave blank for today)","joindateafter");
  echo 
makeinputcode("and Join Date is before<br>(Format yyyy-mm-dd, leave blank for today)","joindatebefore");
  echo 
makeinputcode("and Last Visit is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisitafter");
  echo 
makeinputcode("and Last Visit is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisitbefore");
  echo 
makeinputcode("and Last Post is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpostafter");
  echo 
makeinputcode("and Last Post is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpostbefore");
  echo 
makeinputcode("and Number of Posts is greater than","postslower");
  echo 
makeinputcode("and Number of Posts is less than","postsupper");

  echo 
doformfooter();


}

// ###################### Start domove by Xenon ##############
if ($action=="domove") {
  
  if (isset(
$perpage)==or $perpage=="") {
    
$perpage=1000;
  }
  if (isset(
$startat)==or $startat=="") {
    
$startat=0;
  }
  
$finishat=$startat+$perpage;

  echo 
"<p>User ids:</p>";

  if (
$condition=="") {

    
$condition="1=1";
    if (
$ausername!="") {
      
$condition.=" AND INSTR(username,'".addslashes($ausername)."')>0";
    }
    if (
$apassword!="") {
      
$condition.=" AND INSTR(password,'".addslashes($apassword)."')>0";
    }
    if (
$usergroupid!=-and $usergroupid!="") {
      
$condition.=" AND usergroupid=$usergroupid";
    }
    if (
$aemail!="") {
      
$condition.=" AND INSTR(email,'".addslashes($aemail)."')>0";
    }
    if (
$parentemail!="") {
      
$condition.=" AND INSTR(parentemail,'".addslashes($parentemail)."')>0";
    }
    
$coppauser=strtolower($coppauser);
    if (
$coppauser=="yes") {
      
$condition.=" AND coppauser=1";
    }
    if (
$coppauser=="no") {
      
$condition.=" AND coppauser=0";
    }
    if (
$homepage!="") {
      
$condition.=" AND INSTR(homepage,'".addslashes($homepage)."')>0";
    }
    if (
$icq!="") {
      
$condition.=" AND INSTR(icq,'".addslashes($icq)."')>0";
    }
    if (
$aim!="") {
      
$condition.=" AND INSTR(aim,'".addslashes($aim)."')>0";
    }
    if (
$yahoo!="") {
      
$condition.=" AND INSTR(yahoo,'".addslashes($yahoo)."')>0";
    }
    if (
$biography!="") {
      
$condition.=" AND INSTR(biography,'".addslashes($biography)."')>0";
    }
    if (
$signature!="") {
      
$condition.=" AND INSTR(signature,'".addslashes($signature)."')>0";
    }
    if (
$usertitle!="") {
      
$condition.=" AND INSTR(usertitle,'".addslashes($usertitle)."')>0";
    }
    if (
$joindateafter!="") {
      
$condition.=" AND joindate>UNIX_TIMESTAMP('".addslashes($joindateafter)."')";
    }
    if (
$joindatebefore!="") {
      
$condition.=" AND joindate<UNIX_TIMESTAMP('".addslashes($joindatebefore)."')";
    }
    if (
$lastvisitafter!="") {
      
$condition.=" AND lastvisit>UNIX_TIMESTAMP('".addslashes($lastvisitafter)."')";
    }
    if (
$lastvisitbefore!="") {
      
$condition.=" AND lastvisit<UNIX_TIMESTAMP('".addslashes($lastvisitbefore)."')";
    }
    if (
$lastpostafter!="") {
      
$condition.=" AND lastpost>UNIX_TIMESTAMP('".addslashes($lastpostafter)."')";
    }
    if (
$lastpostbefore!="") {
      
$condition.=" AND lastpost<UNIX_TIMESTAMP('".addslashes($lastpostbefore)."')";
    }
    if (
$postslower!="") {
      
$condition.=" AND posts>$postslower";
    }
    if (
$postsupper!="") {
      
$condition.=" AND posts<$postsupper";
    }
  }


  
$users=$DB_site->query("SELECT userid,usertitle,usergroupid,customtitle,posts FROM user WHERE $condition AND userid>=$startat AND userid<$finishat ORDER BY userid DESC");
  while (
$user=$DB_site->fetch_array($users)) {

    
$userid=$user[userid];
    
    
// check that not removing last admin
    
$countadmin=$DB_site->query_first("SELECT COUNT(userid) AS users FROM user,usergroup WHERE user.usergroupid=usergroup.usergroupid AND usergroup.cancontrolpanel=1 AND user.userid<>$userid");
    
$getperms=$DB_site->query_first("SELECT cancontrolpanel FROM usergroup WHERE usergroupid=$usergroupid");
    if (
$countadmin[users]==and $getperms[cancontrolpanel]!=1) {
      echo 
"<p>You are about to edit the last user with control panel access so that they do not have control panel access. This would lock you out of the control panel, so you cannot proceed.</p></body></html>";
      exit;
    }
    
    
// Change Group
    
$DB_site->query("UPDATE user SET usergroupid=$newusergroupid WHERE userid=$userid");
    
    
// Update Titles
    
if ($updatetitle==1) {
    
      if (
$user[customtitle]==0) {
        
$usergroup=$DB_site->query_first("SELECT usertitle FROM usergroup WHERE usergroupid=$newusergroupid");
        if (
$usergroup[usertitle]=="") {
          
$gettitle=$DB_site->query_first("SELECT title FROM usertitle WHERE minposts<=$user[posts] ORDER BY minposts DESC LIMIT 1");
          
$usertitle=$gettitle[title];
        } else {
          
$usertitle=$usergroup[usertitle];
        }

        
$sql="usertitle='".addslashes($usertitle)."'";
        
$DB_site->query("UPDATE user SET $sql WHERE userid=$userid");        
      }
        
    
    }
    
    
    echo 
"$user[userid]<br>\n";
    
flush();

  }

  if (
$checkmore=$DB_site->query_first("SELECT userid FROM user WHERE $condition AND userid>=$finishat")) {

    echo 
doformheader("user","domove");
    echo 
makehiddencode("ausername",$ausername);
    echo 
makehiddencode("apassword",$apassword);
    echo 
makehiddencode("usergroupid",$usergroupid);
    echo 
makehiddencode("newusergroupid",$newusergroupid);
    echo 
makehiddencode("updatetitle",$updatetitle);
    echo 
makehiddencode("aemail",$aemail);
    echo 
makehiddencode("parentemail",$parentemail);
    echo 
makehiddencode("coppauser",$coppauser);
    echo 
makehiddencode("homepage",$homepage);
    echo 
makehiddencode("icq",$icq);
    echo 
makehiddencode("aim",$aim);
    echo 
makehiddencode("yahoo",$yahoo);
    echo 
makehiddencode("biography",$biography);
    echo 
makehiddencode("signature",$signature);
    echo 
makehiddencode("usertitle",$usertitle);
    echo 
makehiddencode("joindateafter",$joindateafter);
    echo 
makehiddencode("joindatebefore",$joindatebefore);
    echo 
makehiddencode("lastvisitafter",$lastvisitafter);
    echo 
makehiddencode("lastvisitbefore",$lastvisitbefore);
    echo 
makehiddencode("lastpostafter",$lastpostafter);
    echo 
makehiddencode("lastpostbefore",$lastpostbefore);
    echo 
makehiddencode("postslower",$postslower);
    echo 
makehiddencode("postsupper",$postupper);
    echo 
makehiddencode("from",$from);
    echo 
makehiddencode("subject",$subject);
    echo 
makehiddencode("message",$message);
    echo 
makehiddencode("startat",$finishat);
    echo 
makehiddencode("perpage",$perpage);

    echo 
"<input type=submit value=\"Do Next Page\">";

  } else {
    echo 
"<p>All done!</p>";
  }


And in your Index.php in th usersection:
<a href="user.php?action=move">Move users</a><br>



Hope you enjoy it

Xenon

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-05-2001, 07:31 PM
Guest
 
Posts: n/a
Default

not bad. i've been meaning to get me one of these.
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 01:24 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03619 seconds
  • Memory Usage 2,295KB
  • Queries Executed 15 (?)
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)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (2)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_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