function bp_wire_new_post($item_id, $message, $component_name, $private_post = false, $table_name = null) { global $bp; if (empty($message) || !is_user_logged_in()) { return false; } if (!$table_name) { $table_name = $bp->{$component_name}->table_name_wire; } $wire_post = new BP_Wire_Post($table_name); $wire_post->item_id = $item_id; $wire_post->user_id = $bp->loggedin_user->id; $wire_post->date_posted = time(); $allowed_tags = apply_filters('bp_wire_post_allowed_tags', '<a><b><strong><i><em><img>'); $message = strip_tags($message, $allowed_tags); $wire_post->content = apply_filters('bp_wire_post_content', $message); if (!$wire_post->save()) { return false; } if (!$private_post) { // Record in the activity streams bp_wire_record_activity(array('item_id' => $wire_post->id, 'component_name' => $component_name, 'component_action' => 'new_wire_post', 'is_private' => 0)); } do_action('bp_wire_post_posted', $wire_post->id, $wire_post->item_id, $wire_post->user_id); return $wire_post->id; }