View Single Post
  #29  
Old 08-09-2005, 03:40 AM
sketch42's Avatar
sketch42 sketch42 is offline
 
Join Date: May 2004
Location: Brooklyn, NY
Posts: 361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok im a bit confused at how these hooks work.. i mean i understand the basics of it but i think i need a bit more explanation

now say i wanted to add my code into /admincp/user.php
and i want to modify this area

PHP Code:
// ###################### Start Edit Access #######################
if ($_REQUEST['do'] == 'editaccess')
{
        if (!
can_administer('canadminpermissions'))
        {
                
print_cp_no_permission();
        }

        
$vbulletin->input->clean_array_gpc('r', array(
                
'userid' => TYPE_INT
        
));

        
$user $db->query_first("SELECT username, options FROM " TABLE_PREFIX "user WHERE userid = " $vbulletin->GPC['userid']);

        
$accesslist $db->query_read("SELECT * FROM " TABLE_PREFIX "access WHERE userid = " $vbulletin->GPC['userid']);

        
//echo '<h1>$db->numrows($accesslist) = ' . $db->num_rows($accesslist) . '<br />user.hasaccessmask = ' . ($user['options'] & $vbulletin->bf_misc_useroptions['hasaccessmask'] ? 'yes' : 'no') . '</h1>';

        
while ($access $db->fetch_array($accesslist))
        {
                
$accessarray[$access['forumid']] = $access;
        }

        
print_form_header('user''updateaccess');
        
construct_hidden_code('userid'$vbulletin->GPC['userid']);

        
print_table_header($vbphrase['edit_access_masks'] . ": <span class=\"normal\">$user[username]</span>"20);
        
print_description_row($vbphrase['here_you_may_edit_forum_access_on_a_user_by_user_basis']);
        
print_cells_row(array($vbphrase['forum'], $vbphrase['allow_access_to_forum']), 0'thead', -2);
        
print_label_row('&nbsp;''
                <input type="button" value="' 
$vbphrase['all_yes'] . '" onclick="js_check_all_option(this.form, 1);" class="button" />
                <input type="button" value=" ' 
$vbphrase['all_no'] . ' " onclick="js_check_all_option(this.form, 0);" class="button" />
                <input type="button" value="' 
$vbphrase['all_default'] .'" onclick="js_check_all_option(this.form, -1);" class="button" />
        '
); 
so the closest hook i could find is this
PHP Code:
        ($hook vBulletinHook::fetch_hook('useradmin_update_save')) ? eval($hook) : false
which is 20 lines above
so would i need to do this?
PHP Code:
       ($hook vBulletinHook::fetch_hook('useradmin_update_save')) ? eval($hook) : false;

        
// save data
        
$userid $userdata->save();
        if (
$vbulletin->GPC['userid'])
        {
                
$userid $vbulletin->GPC['userid'];
        }

        
// #############################################################################
        // now do the redirect

        
if ($vbulletin->GPC['modifyavatar'])
        {
                
define('CP_REDIRECT'"usertools.php?do=avatar&amp;u=$userid");
        }
        else if (
$vbulletin->GPC['modifyprofilepic'])
        {
                
define('CP_REDIRECT'"usertools.php?do=profilepic&amp;u=$userid");
        }
        else
        {
                
define('CP_REDIRECT'"user.php?do=modify&amp;u=$userid. ($userdata->insertedadmin '&insertedadmin=1' ''));
        }

        
print_stop_message('saved_user_x_successfully'$user['username']);
}

// ###################### Start Edit Access #######################

BLAH BLAH BLAH CUSTOM PHP CODE 
or am i way off base?
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01222 seconds
  • Memory Usage 1,821KB
  • 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
  • (3)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