subtype = "infopage"; // Set its owner to the current user $page->owner_guid = $_SESSION['user']->getGUID(); // For now, set its access to public (we'll add an access dropdown shortly) $page->access_id = 2;// public // Set its title and description appropriately $page->title = $title; $page->description = $body; // Before we can set metadata, we need to save the page if (!$page->save()) { /*translation:Error occured, object could not be saved.*/ register_error(elgg_echo("koolielu:error_not_saved")); forward("mod/info/add_page.php"); } // Now let's add tags. We can pass an array directly to the object property! Easy. if (is_array($tagarray)) { $page->tags = $tagarray; } // Custom metadata $page->categories = $categories; $page->subjects = $subjects; $page->targetgroup = $targetgroup; unassociate_prioval($prioval); $page->prioval = $prioval; $page->save(); // Success message /*translation:Page added*/ system_message(elgg_echo("koolielu:message_page_added")); // river add_to_river('river/object/infopage/create','create',$_SESSION['user']->guid,$page->guid); // Remove the page cache unset($_SESSION['pagetitle']); unset($_SESSION['pagebody']); unset($_SESSION['pagetags']); unset($_SESSION['pagecategories']); unset($_SESSION['pagesubjects']); unset($_SESSION['pagetargetgroup']); // Forward to the main info page forward($page->getURL()); } ?>