I'm trying to have 3 different user profiles for FCKEditor on my site. One for anonymous users with the basic toolbar, one for authenticated users with the filtered toolbar and one for administrators with the full toolbar.

However, when logging in as the administrator I always get the profile for authenticated users. I've even removed access to the fckeditor for authenticated users, but left it on for administrators, and I still get the wrong profile for fckeditor. It seems as if all logged-in users are "authenticated users" (in addition to any other roles), and that fckeditor always selects the most restrictive profile available.

Is this intended functionality? In that case, there can only ever be two different fckeditor profiles: anonymous and authenticated.

Comments

wwalc’s picture

Hi,

I was unable to reproduce that problem. Have you already solved it?

I have followed these steps:
I created the "New Admin" role (admin/user/roles), assigned ACL to it (admin/user/access), added new_user with "New Admin" role (admin/user/user/create).
Then, in FCKeditor administration section:
I created "New FCKeditor admin profile" (admin/settings/fckeditor/add), in section "Roles allowed to use this profile" I checked "New Admin", in "Editor appearance" I selected the "Default" toolbar and the "Office 2003" skin. Then, I logged in as a new_user and I saw exactly what I expected (Default toolbar + Office 2003).

Could you give me some more information or try it again?

pomata’s picture

Having same Problem using 5.3.. anyone?

I don´t want to create new profile.....

HenrikWL’s picture

Here's all the details:

I have three roles on my system: the default ones (authenticated and anonymous) and administrator. The administrator role has access to everything.

In FCKeditor, I have three profiles: the default ones (Default and Advanced) and a profile called Expert, which is assigned to the administrator role. And here's the kink: changes I make to the Expert profile does not have any effect when I log on as a user with the administrator role, not even if I empty my browser cache and do a forced reload of the webpage. But changes to the Advanced profile does have an effect.

I have not modified any of the files, neither in the module nor in the FCKEditor distribution. In fact, the only customization I have done to the entire system is some theme customizations and installing a different language, neither of which should have an effect on the fckeditor.

Any ideas? What am I missing?

kabojnk’s picture

I am having the same exact problem. I created an administrator role with DrupalFull and it still shows DrupalBasic, which I'm guessing means that the module weighs "authenticated user" over my custom "administrator" role.

I might just dig through the code and see if I can't fix this myself but to err on the side of caution is there something I might be missing? I have the access rules setup correctly and all that, I know that much as I've triple checked everything.

wwalc’s picture

It may sound irritating, but could you please check/try that:

  • is the "Allow users to customize FCKeditor appearance" checked in the "administrator" profile in FCKeditor settings?
    if so, please check "My account" settings ("My account" -> "Rich Text Editor settings")
  • when editing FCKeditor profile, it is possible to force simplified toolbar on some textareas. Make sure that "Include fields" is selected and that "Selected fields or paths where simplified toolbar should appear" is empty.
kabojnk’s picture

Yeah, "Allow users to customize FCKeditor appearance" is False.

I went ahead and changed the skin of the "Authenticated User" profile to Silver (the one for admins using DrupalFull uses Office), and removed "authenticated users" from "roles allowed to use this profile" and when I went to go edit my content as an admin again the fckeditor loads up with the Office skin and with the DrupalFull toolbar (still without the break and pagebreak icons though).

As for forcing a simplified toolbar, these are the only areas I have enabled for it:

edit-signature
edit-site-mission
edit-site-footer
edit-site-offline-message
edit-page-help
edit-user-registration-help
edit-user-picture-guidelines

This is starting to stump me. :)

kabojnk’s picture

I dug through the code and this is what I found:

Since I set myself as "administrator" I have two different user roles, in this case authenticated user and staff, with RIDs of 2 and 4 respectively

Line 441 in the module:

$profile_name = db_result(db_query('SELECT s.name FROM {fckeditor_settings} s INNER JOIN {fckeditor_role} r ON r.name = s.name WHERE r.rid IN (%s)', implode(',', array_keys($user->roles))));

From what I understand, the SQL query would equate to this given my roles:

SELECT s.name
FROM fckeditor_settings s
INNER JOIN fckeditor_role r ON r.name = s.name
WHERE r.rid
IN ( 2, 4 )

Which would return 2 rows, sorted by rid most likely, which would give the following:

Advanced
Staff

Advanced being the one using DrupalBasic and Staff being the one using DrupalFull

At line 448:

$profile = fckeditor_profile_load($profile_name);

So, what I'm guessing is that db_result() only grabs the first returned row as it expects only one (forgive me if I'm wrong, I've only just started looking into Drupal's framework), so that's why it's setting my toolbar to DrupalBasic, because it's loading the "Advanced" profile which is associated with authenticated users, whose roles would always pop up first given that the authenticated user role is automatically added at installation (almost always RID 2) meaning all roles added afterwards would at the very least have the RID value of 3, meaning that they would never be the first rows returned and therefore any new user roles added won't apply to fckeditor .

I don't know if this is because I screwed up my roles or something and I shouldn't be having an "authenticated" user role anymore now that I have a "staff" role, but seeing as how the authenticated user role seems to be one of those roles we're meant to delete, I don't know why this has happened.

Anyway, the simple fix for me was to slightly alter line 441 in fckeditor.module to:

$profile_name = db_result(db_query('SELECT s.name FROM {fckeditor_settings} s INNER JOIN {fckeditor_role} r ON r.name = s.name WHERE r.rid IN (%s) ORDER BY r.rid DESC', implode(',', array_keys($user->roles))));

Might be ugly but it works for me considering I don't intend any roles beyond "staff" to carry anything beyond what a normal user can get.

Now it's just a matter of getting the break and pagebreak icons to work. I'm pretty sure that'll be easy though. :)

kabojnk’s picture

Was this module built for dealing with multiple user roles on a user? If not, I think it might be a good idea to extend the module by giving weights to profiles, so if someone was an "authenticated user" who has the added role of "admin" or "contributor" requiring a profile that uses DrupalFull, the query could order the profiles by weight... like this:

SELECT s.name FROM {fckeditor_settings} s INNER JOIN {fckeditor_role} r ON r.name = s.name WHERE r.rid IN (implode(',' array_keys($user->roles))) ORDER BY s.weight ASC

So by default the two default profiles could have weights of '9' and any new profiles have a weight of '0' (but can be adjusted), so if new roles were created users wouldn't even have to alter the weight of their new profiles to be able to use them (unless they wanted to).

Of course, I might be going about this all wrong and the module DOES work with users with multiple roles and I just screwed something up with my Drupal install. ;)

In any case, I'm still using my own fix at the moment, which is an ugly hack. But everything works for me now. :)

wwalc’s picture

I haven't had much time to investigate it, but it seems that kabojnk found the answer, thanks!
So... let's just ask one more thing: is there anyone who would like to say something against giving weights to profiles in the next release? Otherwise I'll add the solution suggested here.

wwalc’s picture

Version: 5.x-2.0-beta » 5.x-2.1-beta
Status: Active » Fixed
wwalc’s picture

Version: 5.x-2.1-beta » 5.x-2.0-beta

Oops I assigned the wrong version. It has been fixed also in 6.x-1.1.

zakmck’s picture

Another problem is about the user #0, which apparently belong to an implicit "administrator" roles I have only the default "anonymous" and "authenticated" roles, but clearly my #0 user has much more rights). Apparently FCKeditor doesn't understand this user should be able to access everything, FCK included. I am working with FCK 5.x-2.1-beta2 and Drupal 5.6.

wwalc’s picture

Issue posted by zakmck (thanks) has been also reported in 190010, let's use that ticket for tracing this issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.