Welcome to Egypt Forums Mark forums read | Egypt Main Page
Egypt Forums
Arabic Movies



Articles Thread, Adding Editor to your Mods in vBulletin; Adding Editor to your Mods I've seen many posts here from coders asking details on how they can add vB's ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=11085


Reply
LinkBack Thread Tools Display Modes
Adding Editor to your Mods
 
 
The God Father
Developer's Avatar

Reply With Quote
 
Join Date: Jul 2008
Location: NDC
Posts: 5,425
28-12-2008, 04:27 PM
 
Adding Editor to your Mods

I've seen many posts here from coders asking details on how they can add vB's editor in their hack. Unfortunatelly (as it happen to my question too) all posts have 0 replies. Finally I succeeded to find a way to add the editor in my mod, so I felt obligue to write the way here, for those who are interesting on it.

Step by step instructions:

1.- In your product-name.xml file

a) In table structure add a field:
Code:
`message` mediumtext,
Bug or my mistype in variable name, when I tried with different field name it didn't worked.

b) In Plugins section (below the templates and before phrases) add:
Code:
<plugin active="1">
<title>Get Editor</title>
<hookname>editor_toolbar_start</hookname>
<phpcode><![CDATA[if ($forumid == 'Your_Module_Name')
{
global $setting;
$setting['allow_bbcode'] = '1';
$show['img_bbcode'] = $setting['allow_imgcode'];
$toolbartype = $setting['allow_bbcode'] ? is_wysiwyg_compatible(-1, $editor_type) : 0;
$show['wysiwyg_compatible'] = (is_wysiwyg_compatible(2, $editor_type) == 2);
$show['editor_toolbar'] = ($toolbartype > 0);
$editor_template_name = ($toolbartype ? 'editor_toolbar_on' : 'editor_toolbar_off');
}]]></phpcode>
</plugin>
2.- In your PHP file

a] In your Add New Form Procedure add:
Code:
require_once(DIR . '/includes/functions_editor.php');
$show['wysiwyg'] = ($setting['allow_bbcode'] ? is_wysiwyg_compatible() : 0);
$istyles_js = construct_editor_styles_js();
$show['qr_require_click'] = 0;
$editorid = construct_edit_toolbar('', 0, 'Your_Module_Name', ($setting['allow_smilies'] ? 1 : 0), 1, false, 'qr');
$messagearea = "
<script type=\"text/javascript\">
<!--
var require_click = false;
var threaded_mode = 1;
var is_last_page = false;
// -->
</script>
$messagearea
";
b] In your Save New Form Procedure
Code:
require_once('./includes/functions_wysiwyg.php');
$message= convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message']);
$message = $vbulletin->db->escape_string($message);
and of course don't forget to include field message in your Insert code

c] In your Edit Form Procedure
Code:
require_once(DIR . '/includes/functions_editor.php');
$show['wysiwyg'] = ($setting['allow_bbcode'] ? is_wysiwyg_compatible() : 0);
$istyles_js = construct_editor_styles_js();
$show['qr_require_click'] = 0;
$editorid = construct_edit_toolbar($article[message], 0, 'Your_Module_Name', ($setting['allow_smilies'] ? 1 : 0), 1, false, 'qr');
$messagearea = "
<script type=\"text/javascript\">
<!--
var require_click = false;
var threaded_mode = 1;
var is_last_page = false;
// -->
</script>
$messagearea
";
$article[message] is the name of your field variable. Be carefull on it to replace with the right one.

d] In your Save Edited Form procedure:
Code:
require_once('./includes/functions_wysiwyg.php');
$message= convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message']);
$message = $vbulletin->db->escape_string($message);
Also here, don't forget to include field message in your Update

3.- Again in you product-name.xml file in the templates section, in any form that you want to use the Editor, you must add:
Code:
<form enctype="multipart/form-data" action="Your_PHP_File" name="vbform" method="post" <if condition="!is_browser('webtv')"> onsubmit="return vB_Editor['$editorid'].prepare_submit(0, $vboptions[postminchars])"</if>>
and at the part of the template where you want to add the editor, add:
$messagearea
__________________
I Love Walking In The Rain Cuz Nobody Know I'm Crying !!
 
 
 
Reply

Articles Thread, Adding Editor to your Mods in vBulletin; Adding Editor to your Mods I've seen many posts here from coders asking details on how they can add vB's ...

Short Link: http://forum.egypt.com/enforum/showthread.php?t=11085


Bookmarks

Tags
adding, editor, mods


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mods Rogue Modder Mods for 3.7.x 2 16-12-2008 10:21 PM
Adding Javascript to your Template Developer Articles 0 27-10-2008 09:44 PM
Adding links in the nav bar Developer Mods for 3.7.x 0 12-09-2008 04:44 AM
Adding New Buttons to the Editor Toolbar Developer Articles 0 10-09-2008 06:53 PM