I'm trying to get tinyMCE set up for several different user roles, and I've noticed something frustrating: As best I can tell, the way the DB is structured (at least for mySQL) code loads the profile for the lowest numbered Role ID associated with some profile. This means (in partiucular) if I enable a profile for authenticated users (rid == 2), then I apparently can never access any other profile when logged in to an account with an additional user role that I want to have additional editing options.

The attached patch tries to address this problem by selecting the last profile returned, rather than the first profile returned.

I tested this with drupal 4.7.1, PHP 4.4.2, mySQL 4.0.25 and it seems to work as expected. Please check it out. I especially want to be sure that the behavior is the same with PostgreSQL and MySQL 5.

Comments

pwolanin’s picture

StatusFileSize
new1.39 KB

Here's a second go at the patch. I think this is even better- I changed and simplified the query (I don't see why the INNER JOIN is necessary), and I have it ordered "ORDER BY rid DESC". Thus, the behavior should be DB independent and independent of any DB table structure.

Tested and seems to work as expected. Please test and get back to me on whether this is desirable and RTBC.

pwolanin’s picture

StatusFileSize
new42.79 KB

The entire patched module (per patch #2) also attached for those without ready diff/patch access.

pwolanin’s picture

I have been using this version for several weeks, and it works fine. Maybe could be combined with the notion of using user role weights as suggested: http://drupal.org/node/60667

Tobias Maier’s picture

your right your version is really simple - but you pay this simplicitiy with inflexibility...
to be inflexible is not a drupalish aproach -> so it is not good

pwolanin’s picture

Yes- I agree it's inflexible, but it easily allows one to have profiles for 1) anonynous users 2) authenticated users 3) users with an additional role. I think this could be combined with additional, simple, code to use the role weights from the role-weights module if it is installed. Then admins who need additional flexibily can use role weights.

pwolanin’s picture

Status: Needs review » Closed (duplicate)

Makrking as duplicate- please look at the patch above, but follow-up to the discussion at: http://drupal.org/node/60667

geme4472’s picture

Thanks for the patch pwolanin. Simplicity is one of the characteristics that makes good systems great. In this particular case, it made a good patch great. As far as the naysayers go, a patch is a patch, and until tinymce.module fixes this bug, it's still a hack (even if contrib). Nicely done.

(Still a duplicate, please look at the patch above, but follow-up to the discussion at: http://drupal.org/node/60667)

neveo’s picture

I am trying to get the tinyMCE module up and running. I was able to install it and can make changes, but when I click preview at the bottom of my content page it strips away any style that I applied to the body of the textarea; do you know why this is happening. I have also played with three other editors and they are strip away styles. Can anyone help?

Thanks,

husztisanyi’s picture