You are here

function fckeditor_profile_save in FCKeditor - WYSIWYG HTML editor 6

Same name and namespace in other branches
  1. 5.2 fckeditor.module \fckeditor_profile_save()

Save a profile to the database. @todo add more entries to array in the user_save line

1 call to fckeditor_profile_save()
fckeditor_admin in ./fckeditor.module
Controller for FCKeditor administrative settings.

File

./fckeditor.module, line 674
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben

Code

function fckeditor_profile_save($edit) {
  db_query("DELETE FROM {fckeditor_settings} WHERE name = '%s' or name = '%s'", $edit['name'], empty($edit['old_name']) ? "" : $edit['old_name']);
  db_query("DELETE FROM {fckeditor_role} WHERE name = '%s' or name = '%s'", $edit['name'], empty($edit['old_name']) ? "" : $edit['old_name']);
  db_query("INSERT INTO {fckeditor_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], serialize($edit));
  if (!empty($edit['rids'])) {
    foreach ($edit['rids'] as $rid => $value) {
      db_query("INSERT INTO {fckeditor_role} (name, rid) VALUES ('%s', %d)", $edit['name'], $rid);
    }
  }

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