View Single Post
  #5  
Old 08-07-2005, 08:57 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, I knew it wasn't that easy. Let me tell you what I'm doing. I want to add a custom admincp permissions.

In adminpermission.php there is:
PHP Code:
$permsphrase = array(
        
'canadminsettings'                => $vbphrase['can_administer_settings'],
        
'canadminstyles'                => $vbphrase['can_administer_styles'],
        
'canadminlanguages'                => $vbphrase['can_administer_languages'],
        
'canadminforums'                => $vbphrase['can_administer_forums'],
        
'canadminthreads'                => $vbphrase['can_administer_threads'],
        
'canadmincalendars'                => $vbphrase['can_administer_calendars'],
        
'canadminusers'                        => $vbphrase['can_administer_users'],
        
'canadminpermissions'        => $vbphrase['can_administer_user_permissions'],
        
'canadminfaq'                        => $vbphrase['can_administer_faq'],
        
'canadminimages'                => $vbphrase['can_administer_images'],
        
'canadminbbcodes'                => $vbphrase['can_administer_bbcodes'],
        
'canadmincron'                        => $vbphrase['can_administer_cron'],
        
'canadminmaintain'                => $vbphrase['can_run_maintenance'],
        
'canadminupgrade'                => $vbphrase['can_run_upgrades'],
        
'canadminplugins'                => $vbphrase['can_administer_plugins'],
);

(
$hook vBulletinHook::fetch_hook('admin_permissions')) ? eval($hook) : false
A few lines under is:
PHP Code:
if ($_REQUEST['do'] == 'edit')
{
        
print_form_header('adminpermissions''update');
        
construct_hidden_code('userid'$vbulletin->GPC['userid']);
        
construct_hidden_code('oldpermissions'$user['adminpermissions']);
        
print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbphrase['administrator_permissions'], $user['username'], $user['userid']));
        
print_label_row("$vbphrase[administrator]: <a href=\"user.php?" $vbulletin->session->vars['sessionurl'] . "do=edit&amp;u=" $vbulletin->GPC['userid'] . "\">$user[username]</a>"'<div align="' $stylevar['right'] .'"><input type="button" class="button" value=" ' $vbphrase['all_yes'] . ' " onclick="js_check_all_option(this.form, 1);" /> <input type="button" class="button" value=" ' $vbphrase['all_no'] . ' " onclick="js_check_all_option(this.form, 0);" /></div>''thead');

        foreach (
convert_bits_to_array($user['adminpermissions'], $ADMINPERMISSIONS) AS $field => $value)
        {
                if (
$field == 'canadminupgrade')
                {
                        
construct_hidden_code("adminpermissions[$field]"$value);
                }
                else
                {
                        
print_yes_no_row($permsphrase["$field"], "adminpermissions[$field]"$value);
                }
        }

        
print_select_row($vbphrase['control_panel_style_choice'], 'cssprefs'array_merge(array('' => "($vbphrase[default])"), fetch_cpcss_options()), $user['cssprefs']);

        
print_submit_row();

As you can see my edit which would be:
PHP Code:
$permsphrase['canadmintextreplacements'] = $vbphrase['can_administer_text_replacements']; 
I was hoping to figure out how to add custom admin perms using the hooks system for my modification, but it's not as easy as I thought. I thought I almost had it and was going make a tutorial, but I'm a little frustrated with this.

Do you plan on releasing such a tutorial?

Quote:
????
I was alittle embarrassed at first.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01087 seconds
  • Memory Usage 1,820KB
  • 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)bbcode_quote
  • (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