function save_post($cid = NULL, $ccid = NULL, $is_album = FALSE, $display_on = 1) { global $user, $network_info; $extra = unserialize($network_info->extra); $micro_content_post = new SBMicroContent(); $micro_content_post->set_mc_type($_REQUEST['sb_mc_type']); $content = $micro_content_post->format_structured_content(); $micro_content_post->body = $content; $micro_content_post->author_id = $_SESSION['user']['id']; $micro_content_post->allow_comments = 1; $micro_content_post->trackbacks = $_REQUEST['trackback']; $micro_content_post->is_active = 1; if ($cid) { $micro_content_post->content_id = $cid; $condition = array('content_id' => $cid); $is_active = ACTIVE; if ($extra['network_content_moderation'] == NET_YES) { $content = Content::load_all_content_for_moderation(NULL, $condition); if (!empty($content)) { $is_active = $content[0]['is_active']; } } $micro_content_post->is_active = $is_active; } if (!$ccid) { //independent post which is not part of any contentcollection $ccid = -1; } $micro_content_post->parent_collection_id = $ccid; $micro_content_post->display_on = $display_on; $sb_content = array(); $sb_content = SBMicroContent::get_sbtype_id($_REQUEST['sb_mc_type'], $with_name = true); $micro_content_post->sbtype_id = $sb_content["sbtype_id"]; $micro_content_post->title = $_POST[$sb_content["titlefield"]]; //echo '<pre>';print_r($content); $micro_content_post->save(); $return_array = array('title' => $_POST[$sb_content["titlefield"]], 'body' => $content, 'content_id' => $micro_content_post->content_id); if ($ccid != -1 && !$is_album) { // Code for checking groups with moderated content. //fix me change it for using ContentCollection::get_collection_type() $collection = ContentCollection::load_collection($micro_content_post->parent_collection_id, $micro_content_post->author_id); //$collection->assert_user_access($_SESSION['user']['id']); if ($collection->is_moderated) { $Group = new Group(); $Group->collection_id = $micro_content_post->parent_collection_id; $Group->moderate_content($micro_content_post->content_id); $return_array['is_moderated'] = 1; } } $permalink_cid = $micro_content_post->content_id; $content_author_image = uihelper_resize_mk_user_img($user->picture, 80, 80, 'alt="' . $user->first_name . '" align="left" style="padding: 0px 12px 12px 0px;"'); $params['cid'] = $permalink_cid; $params['first_name'] = $user->first_name; $params['user_id'] = $user->user_id; $params['user_image'] = $content_author_image; $params['content_title'] = $micro_content_post->title; $params['network_name'] = $network_info->name; auto_email_notification('content_posted', $params); if ($_POST['route_to_pa_home'] == 1) { auto_email_notification('content_posted_to_comm_blog', $params); } if ($extra['network_content_moderation'] == NET_YES && $network_info->owner_id != $user->user_id) { Network::moderate_network_content(-1, $permalink_cid); // -1 for contents; not a part of any collection $return_array['msg'] = 1004; } return $return_array; }