You are here

function tinymce_profile_save in TinyMCE 6

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

Save a profile to the database.

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

File

./tinymce.admin.inc, line 459
Admin interface for TinyMCE module.

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,
    ));
  }
}