--- tinymce.module.orig Sun May 28 14:15:00 2006 +++ tinymce.module Sun May 28 19:05:13 2006 @@ -85,7 +85,8 @@ function tinymce_process_textarea($eleme // Since tinymce_config() makes a db hit, only call it when we're pretty sure // we're gonna render tinymce. if (!$profile_name) { - $profile_name = db_result(db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s)', implode(',', array_keys($user->roles)))); + $all_my_profiles = db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s)', implode(',', array_keys($user->roles))); + $profile_name = db_result($all_my_profiles,db_num_rows($all_my_profiles)-1); } $profile = tinymce_profile_load($profile_name); $init = tinymce_config($profile); @@ -1100,9 +1101,9 @@ function _tinymce_page_match($edit) { } function tinymce_user_get_profile($account) { - $profile_name = db_result(db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s)', implode(',', array_keys($account->roles)))); - if ($profile_name){ - return tinymce_profile_load($profile_name); + $all_my_profiles = db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s)', implode(',', array_keys($account->roles))); + if ($rows=db_num_rows($all_my_profiles)){ + return tinymce_profile_load(db_result($all_my_profiles,$rows-1)); } else { return FALSE;