LPH
Well-known member
In looking at this code, why is $forum_id sitting in a line all by itself?
Sorry to be daft but it looks strange to me.
Should it be forum_id=' ' or something else?
Sorry to be daft but it looks strange to me.
Should it be forum_id=' ' or something else?
PHP:
if($post->post_type == 'post')
{
//get the category for this post
$categories = get_the_category($post->ID);
//lookup what forum ID posts of this category go in
$forum_id;
$forum_id_array = $XF->options['xf_category_forum_id'];
foreach($categories as $category)
{
$slug = $category->slug;
if(isset($forum_id_array[$slug]) && $forum_id_array[$slug] != 0)
{
$forum_id = $forum_id_array[$slug];
break;
}
}
if(!isset($forum_id))
{
$forum_id = $forum_id_array['default'];
}
xf_insert_thread($post, $forum_id);
}
else ... blah blah more and more ... blah ..