Exemple #1
0
<?php

if (function_exists('bp_get_simple_blog_post_form')) {
    $form = bp_get_simple_blog_post_form('buddyblog-user-posts');
    $form->show();
    ?>

<?php 
} else {
    ?>
	<?php 
    _e('Please Install <a href="http://buddydev.com/plugins/bp-simple-front-end-post/"> BP Simple Front End Post Plugin to make the editing functionality work.', 'buddyblog');
}
function bcg_show_post_form($group_id)
{
    $bp = buddypress();
    $cat_selected = bcg_get_categories($group_id);
    //selected cats
    if (empty($cat_selected)) {
        _e('This group has no associated categories. To post to Group blog, you need to associate some categoris to it.', 'bcg');
        return;
    }
    $all_cats = (array) bcg_get_all_terms();
    $all_cats = wp_list_pluck($all_cats, 'term_id');
    $cats = array_diff($all_cats, $cat_selected);
    //for form
    $url = bp_get_group_permalink(new BP_Groups_Group($group_id)) . BCG_SLUG . "/create/";
    if (function_exists('bp_get_simple_blog_post_form')) {
        $form = bp_get_simple_blog_post_form('bcg_form');
        if ($form) {
            $form->show();
        }
    }
    do_action('bcg_post_form', $cats, $url);
    //pass the categories as array and the url of the current page
}