dimanche 7 février 2016

Creating a topic with bbp_insert_topic shows up on two forums

This is my scenario,

I create a private Forum of type category , then I create two public forums to type forum which are the children of that category forum. I get a nice category level organization, when I click on the url,

Home/ Forums/ Private: DummyCategory.

But when I click on one of the forums :: Home/ Forums/ Private: DummyCategory/ DummyForum1

all the posts that do not belong to that forum shows up. It means if I post in DummyForum2 or 1 or any forum, when I click Home/ Forums/ Private: DummyCategory/ DummyForum1 , all the posts show up.

It can’t be by design ? Is this a bug ? Most likely some settings need to be changed in the bbpress I suppose , any idea ?

Just for additional details I am using code to add into the forum. I can get the parent child relations between the forums displayed properly, the insertion of the topic goes to the right parent forum. But then that bug shows up.

if (!function_exists('bbp_insert_topic')) {
            require_once '/includes/topics/functions.php';
        }

        echo "All fine here ??? Did it reached ";
        $forum_ID = $selectmyID;
        $terms = array(bbp_get_topic_tag_tax_id() => $key_pieces);
        // The topic data.
        $topic_data = array(
        'post_parent'       => $forum_ID, // forum ID of Projects  hard coded
        'post_status'       => bbp_get_public_status_id(),   // Subscribed users can see this
        'post_content'      => $my_content,
        'post_title'        => $slug,
        'comment_status'    => 'open',
        'menu_order'        => 0,
        'tax_input'         => $terms  
        );

        // The topic meta.
        $topic_meta = array(
        'forum_id'    => $topic_data['post_parent'],
        'reply_count' => 0
        );

        // NOTICE! Understand what this does before running.
        $post_id = bbp_insert_topic($topic_data, $topic_meta);
        bbp_stick_topic($post_id , true);                         // Making it super sticky !


        echo "The post id returned is " . $post_id;
        echo "Sucessfully inserted the post" . $slug . " programmatically !!!!";



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire