View Single Post
  #28  
Old 01-05-2002, 08:33 AM
Simon Moon Simon Moon is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Toying around, i found it sucks not to be able to change the the status of the user as an admin. So i whipped out this little hack.

First, you need a whole new function in admin/adminfunctions.php
Find:
PHP Code:
// ###################### Start makechoosercode ####################### 
Add BEFORE:
PHP Code:
// ###################### Start makeselectcode #######################
function makeselectcode ($title,$name,$seedarray,$selvalue=-1) {
// returns a combo box containing a list thats fed from an hash called seedarray
// that hash needs a pair combination, where the name will be used as title and the value as value
// allows specification of selected value in $selvalue


  
echo "<tr class=\"".getrowbg()."\" valign=\"top\">\n<td><p>$title</p></td>\n<td><p><select name=\"$name\">\n";
  
  while ( list(
$key$val) = each($seedarray) ) {
    if (
$selvalue==$val) {
      echo 
"<option value=\"$val\" SELECTED>$key</option>\n";
    } else {
      echo 
"<option value=\"$val\">$key</option>\n";
    }
  }
  echo 
"</select>\n</p></td>\n</tr>\n";

Close adminfunctions.php

Open global.php (you can put it also in the user.php in the admin directory on the top, but i used it for other hack parts too, so i needed it global) and add to the top, after the <?php this part:
PHP Code:
$gender_array = array(  "Undisclosed"  => "0",
                        
"Female"       => "1",
                        
"Male"         => "2"); 
This will help a lot later on...
SAve it and close it.

Open admin/user.php

These are for the edit part of the users...
Find:
PHP Code:
makeinputcode("Yahoo Messenger Handle","yahoo",$user[yahoo],0); 
Paste after it:
PHP Code:
makeselectcode("Gender","gender",$gender_array,$user[gender]); 
Now these are for adding users over the control panel:
Find
PHP Code:
makeinputcode("Yahoo Messenger Handle","yahoo"); 
Paste after:
PHP Code:
makeselectcode("Gender","gender",$gender_array); 
So much for the interface. Now we need to make sure your data gets saved!

Find:
PHP Code:
$userid=$DB_site->insert_id(); 
In the line before THIS, search for options,birthday and add ",gender" to it without the "" of course. Now go to the very end of the line. There it looks like '$birthday')"); wich you change now to '$birthday','$gender')");
Ok, new users are set, now the edits.

Search with your editor for this part:
PHP Code:
$DB_site->query("UPDATE user SET birthday='$birthday
Found this, go to the very end of the line.
You read there something like that:
PHP Code:
$pmpopup=1,pmpopup,'$pmpopup'WHERE userid=$userid"); 
Change it to this:
PHP Code:
$pmpopup=1,pmpopup,'$pmpopup'),gender='$gender' WHERE userid=$userid"); 
Save it, upload the files, and you are finished. You can instantly start to edit users, or add new ones with the gender hack. I tested this on 2.2.1 as the hack before, both on an new installed test board and on an already pretty heavy hacked one.

If you got questions, mail me.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01366 seconds
  • Memory Usage 1,806KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete