// Create ChangeLog entry $changelogData = array('record_id' => $recordId, 'record_lang' => $recordData['lang'], 'revision_id' => 0, 'user_id' => $user->getUserId(), 'date' => $_SERVER['REQUEST_TIME'], 'changelog' => nl2br($changed)); $faqChangelog->create($changelogData); // Create the visit entry $visits = PMF_Visits::getInstance(); $visits->add($recordId, $recordData['lang']); // Insert the new category relations $categoryRelations = new PMF_Category_Relations(); // Insert the tags if ($tags != '') { $tagging = new PMF_Tags(); $tagging->saveTags($recordId, explode(',', $tags)); } // Set record permissions $faqUser = new PMF_Faq_User(); $faqUser->create(array('record_id' => $recordId, 'user_id' => $restricted_users)); if ($groupSupport) { $faqGroup = new PMF_Faq_Group(); $faqGroup->create(array('record_id' => $recordId, 'group_id' => $restricted_groups)); } // Loop the categories $categoryUser = new PMF_Category_User(); $categoryGroup = new PMF_Category_Group(); $categoryRelations = new PMF_Category_Relations(); $categoryRelations->setLanguage($recordData['lang']); foreach ($categories['rubrik'] as $categoryId) { // Insert the new category relations $categoryData = array('category_id' => $categoryId, 'category_lang' => $categoryRelations->getLanguage(), 'record_id' => $recordId, 'record_lang' => $recordData['lang']); // save or update the category relations $categoryRelations->create($categoryData); // Add user permissions