vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=155)
-   -   Admin/Mod BBcodes (https://vborg.vbsupport.ru/showthread.php?t=105253)

VaaKo 01-14-2006 04:02 PM

Quote:

Originally Posted by bang
have been looking for this! is it possible to make the text be alligned to the center of the [!] sign? right now it's on top and it looks rather odd.

tweak the php code, maybe use this

HTML Code:

<valign="center">{param}

Darat 01-14-2006 09:03 PM

Quote:

Originally Posted by Don Corleone
you could use the "permission bbcode" hack release somewhere in here!
you're right about what you said, my suggestion is to use the hack I mentioned along with this one, you will restrict normal users from using certain bbcodes along with this one!

I'd like to install this but I want to restrict it's use to only mods and admins - I've looked for the hack you mention "permission bbcode" but can't find it anywhere?

VaaKo 01-14-2006 10:14 PM

This is it:

Advanced BBCode Permissions

Yorixz 01-15-2006 07:49 AM

Quote:

Originally Posted by Yorick
Any news on custom bbcodes?

Quote:

Originally Posted by Abe1
Doesn't look like it's possable unless VB loads the custom bbcode admin PHP with hooks.

In the topic https://vborg.vbsupport.ru/showthread.php?t=103747

So I'm afraid you can't restrict these two custom bbcodes :(

Wild-Wing 02-07-2006 08:53 PM

its a pain in the ass to restrict them you have to hard code them. damn.
heres the code
go to class_bbcode
add theses some where
Code:

/**
        * Handles a [admin] tag. Displays a preformatted string.
        *
        * @param        string        The code to display
        *
        * @return        string        HTML representation of the tag.
        */
        function handle_bbcode_admin($code)
        {
                global $vbulletin, $vbphrase, $stylevar, $show;

                // remove unnecessary line breaks and escaped quotes
                $code = str_replace(array('<br>', '<br />', '\\"'), array('', '', '"'), $code);

                $code = $this->strip_front_back_whitespace($code, 1);
                if ($this->printthread)
                {
                        $code = $this->emulate_pre_tag($code);
                        $template = 'bbcode_admin_printthread';
                }
                else
                {
                        $blockheight = $this->fetch_block_height($code);
                        $template = 'bbcode_admin';
                }

                eval('$html = "' . fetch_template($template) . '";');
                return $html;
        }
        /**
        * Handles a [mod] tag. Displays a preformatted string.
        *
        * @param        string        The code to display
        *
        * @return        string        HTML representation of the tag.
        */
        function handle_bbcode_mod($code)
        {
                global $vbulletin, $vbphrase, $stylevar, $show;

                // remove unnecessary line breaks and escaped quotes
                $code = str_replace(array('<br>', '<br />', '\\"'), array('', '', '"'), $code);

                $code = $this->strip_front_back_whitespace($code, 1);
                if ($this->printthread)
                {
                        $code = $this->emulate_pre_tag($code);
                        $template = 'bbcode_mod_printthread';
                }
                else
                {
                        $blockheight = $this->fetch_block_height($code);
                        $template = 'bbcode_mod';
                }

                eval('$html = "' . fetch_template($template) . '";');
                return $html;
        }

find [CODE]if ($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_CODE)
{
//
Code:

                        $tag_list['no_option']['code'] = array(
                                'callback' => 'handle_bbcode_code',
                                'strip_empty' => true,
                                'disable_smilies' => true,
                                'disable_wordwrap' => true,
                                'strip_space_after' => 1
                        );
                }

after add:
[CODE]if ($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_ADMINWARN)
{
//[CODE]
$tag_list['no_option']['admin'] = array(
'callback' => 'handle_bbcode_admin',
'strip_empty' => true,
'disable_smilies' => true,
'disable_wordwrap' => true,
'strip_space_after' => 1
);
}
if ($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_MODWARN)
{
//
Code:

                        $tag_list['no_option']['mod'] = array(
                                'callback' => 'handle_bbcode_mod',
                                'strip_empty' => true,
                                'disable_smilies' => true,
                                'disable_wordwrap' => true,
                                'strip_space_after' => 1
                        );
                }

find this at the top of the file
Code:

define('ALLOW_BBCODE_HTML',  512);
after add :
Code:

define('ALLOW_BBCODE_MODWARN',  1024);
define('ALLOW_BBCODE_ADMINWARN',  2048);

save that file

open class_bbcode_alt.php
find:
Code:

function handle_bbcode_code($code)
        {
                $current_tag =& $this->current_tag;

                $code = str_replace('  ', ' &nbsp;', $code);
                $code = preg_replace('#(\r\n|\n|\r|<p>)( )(?!([\r\n]}|<p>))#i', '$1&nbsp;', $code);

                return "[$current_tag[name]]" . $code . "[/$current_tag[name]]";
        }

after add:
Code:

function handle_bbcode_admin($code)
        {
                $current_tag =& $this->current_tag;

                $code = str_replace('  ', ' &nbsp;', $code);
                $code = preg_replace('#(\r\n|\n|\r|<p>)( )(?!([\r\n]}|<p>))#i', '$1&nbsp;', $code);

                return "[$current_tag[name]]" . $code . "[/$current_tag[name]]";
        }
                function handle_bbcode_mod($code)
        {
                $current_tag =& $this->current_tag;

                $code = str_replace('  ', ' &nbsp;', $code);
                $code = preg_replace('#(\r\n|\n|\r|<p>)( )(?!([\r\n]}|<p>))#i', '$1&nbsp;', $code);

                return "[$current_tag[name]]" . $code . "[/$current_tag[name]]";
        }

then make templates.

Wild-Wing 02-08-2006 12:21 AM

i figured it out

Darat 02-08-2006 10:04 AM

Wild-Wing - thanks.... I think!

I understand the file edits but after editing the files how do you create a tag that can only be used by an admin or mod?

Darat 02-08-2006 02:34 PM

Wild-Wing - I realise what you meant - create templates called bbcode_admin and bbcode_mod for the code to display a "moderator box".

However I see that you add this:

define('ALLOW_BBCODE_MODWARN', 1024);
define('ALLOW_BBCODE_ADMINWARN', 2048);

So I presume somehow once I've made the modifications I would need to give permission to the admin and mod groups so they could use the tags?

Wild-Wing 02-08-2006 02:40 PM

oh i forgot to add that part damn.

you have to be in developer mode to to the next step
go to the bbcode settings
where the Enabled Built-in BB Codes area is you should see a edit and delete links (note: you will only see this if you are in developer mode.)
add this to the bottom of the option code box above the span tag
Code:

<label for=\"bb1024\"><input type=\"checkbox\" name=\"setting[$setting[varname]][]\" id=\"bb1024\" value=\"1024\" tabindex=\"1\" " . iif(bitwise($setting['value'],1024), 'checked="checked"') . " />[MOD]</label><br />
<label for=\"bb2048\"><input type=\"checkbox\" name=\"setting[$setting[varname]][]\" id=\"bb2048\" value=\"2048\" tabindex=\"1\" " . iif(bitwise($setting['value'],2048), 'checked="checked"') . " />[ADMIN]</label><br />

now you can enable it through out the board. now to restrict it to the usergroups admin and mod and what ever you have to use the Advanced BBcode Permissions hack. edit that approately and there you go

Darat 02-08-2006 03:37 PM

Thanks.

I've now done that however now if I try to display a post that uses one the tags the page just doesn't display (I just get a completely blank page and the browser indicates it is busy).

If I switch off the mod and admin bbcodes in the vBulletin options page then the page displays but of course the tag is just shown as text.

(For testing purposes all my template is a single <div> with the words TEST ADMIN TAG in it.)

Any ideas?


All times are GMT. The time now is 11:31 PM.

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.01868 seconds
  • Memory Usage 1,769KB
  • 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
  • (8)bbcode_code_printable
  • (1)bbcode_html_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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