Beispiel #1
0
    // Access ids
    $page->access_id = (int) get_input('access_id', ACCESS_PRIVATE);
    if (strpos($page->title, 'DF_') == 0 or isadmin() or $container instanceof ElggGroup and $container->name == 'Community Guides') {
        $page->description = get_input('description', '', false);
    }
    $page->slug = get_input('slug', '');
    // Write access id
    $page->write_access_id = (int) get_input('write_access_id', ACCESS_PRIVATE);
    // Set parent
    $page->parent_guid = $parent_guid;
    // Ensure ultimate owner
    $page->owner_guid = $page->owner_guid ? $page->owner_guid : $_SESSION['user']->guid;
    // finally save
    if ($page->save()) {
        // Now save description as an annotation
        $page->annotate('page', $page->description, $page->access_id);
        system_message(elgg_echo("pages:saved"));
        //add to river
        add_to_river('river/object/page/create', 'create', $_SESSION['user']->guid, $page->guid);
        // Forward to the user's profile
        forward($page->getUrl());
        exit;
    } else {
        register_error(elgg_echo('pages:notsaved'));
    }
} else {
    register_error(elgg_echo("pages:noaccess"));
}
// Forward to the user's profile
forward($page->getUrl());
exit;