Welcome, Guest. Please login or register.
Did you miss your activation email?
April 17, 2014, 01:51:15 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
177291 Posts in 24305 Topics by 7096 Members
Latest Member: kylep159
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Editor config based on userid  (Read 1814 times)
marathoner

Offline Offline

Posts: 495


« on: January 06, 2008, 04:28:36 PM »

I'd like to offer my users the ability to modify WYSIWYG pages but with only limited functionality (so that they don't go overboard with different fonts styles/bolding/sizing that they seem to like to do). I know that it's easy to modify the FCKEditor 'fckeditor/wb_config/wb_fckconfig.js' file to alter the toolbars which does exactly what I want it to. However, I'd like to not limit my (admin) FCKEditor capabilities.

So, I guess what I'd like to do is to have the FCKEditor configuration different based on the WB userid. I think that I can do this by modifying 'fckeditor/include.php' line 73 to use one config.js file if the WB userid is admin otherwise use different config.js file.

Has anyone tried this? Is there a better approach to have a limit WYSIWYG editor for my users?
Logged
doc
Guest
« Reply #1 on: January 06, 2008, 04:50:54 PM »

Hello,

your approach should work (this is the way I would do it). WB 3.0 will offer the choice so the user can define its custom editor.

Regards Christian
Logged
macsmet

Offline Offline

Posts: 246


« Reply #2 on: January 07, 2008, 09:16:19 AM »

@Marathoner: I am very interested in your idea and solution. Can you post it?
Thanks.

greetings,

MacSmet
Logged
doc
Guest
« Reply #3 on: January 08, 2008, 03:32:28 PM »

Hello,

for the FCKEditor, open the file include.php and search for the line
Code:
$oFCKeditor->Config['CustomConfigurationsPath'] = WB_URL .'/modules/fckeditor/wb_config/wb_fckconfig.js';

Replace this line by the following code: (without starting <?php and ending ?>)
Code:
<?php
/** 
  use configuration file depending on group id 
**/
$group_id = &#39;&#39;;
if(isset($_SESSION[&#39;GROUP_ID&#39;])) {
  // extract the numeric config id
  
$group_id = (int) $_SESSION[&#39;GROUP_ID&#39;];
}
// include the group id depending configuration file
if(file_exists(WB_PATH .&#39;/modules/fckeditor/wb_config/wb_fckconfig&#39; .$group_id .&#39;.js&#39;)) {
  
$oFCKeditor->Config[&#39;CustomConfigurationsPath&#39;] = WB_URL .&#39;/modules/fckeditor/wb_config/wb_fckconfig&#39; .$group_id .&#39;.js&#39;;
} else {
  
// include the default file
  
$oFCKeditor->Config[&#39;CustomConfigurationsPath&#39;] = WB_URL .&#39;/modules/fckeditor/wb_config/wb_fckconfig.js&#39;;
}
?>


Then simply create a copy of the config file /fckeditor/wb_config/wb_fckconfig.js for each group you want to support and rename it as follows: wb_fckconfigGROUP_ID.js (where GROUP_ID is a numeric group_id; 1:=administrators).

If you want to test it for different groups, remember to delete the browser cache and to clear sessions before login into the WB backend with the new group_id.

Note: If you want to have a custom configuration file for each user_id, simply replace:
Code:
$_SESSION['GROUP_ID'] with $_SESSION['USER_ID']

Regards Christian
« Last Edit: January 08, 2008, 03:44:31 PM by doc » Logged
marathoner

Offline Offline

Posts: 495


« Reply #4 on: January 08, 2008, 06:03:34 PM »

Works like a charm! Thanks so much!
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!