You are here

function tinymce_profile_save in TinyMCE 5.2

Same name and namespace in other branches
  1. 5 tinymce.module \tinymce_profile_save()
  2. 6.2 tinymce.admin.inc \tinymce_profile_save()
  3. 6 tinymce.admin.inc \tinymce_profile_save()

Save a profile to the database.

1 call to tinymce_profile_save()
tinymce_admin in ./tinymce.module
Controller for tinymce administrative settings.

File

./tinymce.module, line 1034
Integrate the TinyMCE editor (http://tinymce.moxiecode.com/) into Drupal.

Code

function tinymce_profile_save($edit) {
  db_query("DELETE FROM {tinymce_settings} WHERE name = '%s' or name = '%s'", $edit['name'], $edit['old_name']);
  db_query("DELETE FROM {tinymce_role} WHERE name = '%s' or name = '%s'", $edit['name'], $edit['old_name']);
  db_query("INSERT INTO {tinymce_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], serialize($edit));
  foreach ($edit['rids'] as $rid => $value) {
    db_query("INSERT INTO {tinymce_role} (name, rid) VALUES ('%s', %d)", $edit['name'], $rid);
  }

  // if users can't set their own defaults, make sure to remove $user->tinymce_status so their default doesn't override the main default
  if ($edit['user_choose'] == 'false') {
    global $user;
    user_save($user, array(
      'tinymce_status' => NULL,
    ));
  }
}