Importing Categories to Groups
-
Ok, I am trying to create groups importing the wp categories (not the subs) using this code, after which i would like to insert new posts created in that category being added to the activity stream. I figured that using the same cat id as group id, would be the simple way of adding it to the group activity stream without to much trouble. (tell me if I am wrong)
Question 1: Now i am getting the categories just fine. but the part creating group is not working.
Question 2: Where can I find the part that actually creates the activity after a post has been created.$categories = get_categories( $args ); foreach ( $categories as $category ) { if ($category->parent == '0') { groups_create_group( array( 'group_id' => $category->cat_ID, 'name' => $category->cat_name, 'description' => $category->description, 'slug' => $category->slug, 'date_created' => bp_core_current_time(), 'status' => 'public' ) ); groups_update_groupmeta( $category->cat_ID, 'total_member_count', 1 ); groups_update_groupmeta( $category->cat_ID, 'last_activity', bp_core_current_time() ); } else { // I do not want subcategories for now } }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Importing Categories to Groups’ is closed to new replies.