Setup Autoblog to Import Author As Category

I would like to use the Author field as categories for processed posts.

I've modified my global-posts-feed.php RSS to pull the blog name by inserting:

//Network blog name
		        $blogname = get_blog_option($network_post->BLOG_ID, 'blogname');

		        restore_current_blog();
		    ?>

and also modifying <dc:creator> to read:
<dc:creator><?php echo $blogname; ?></dc:creator>

So in the RSS feed, Author = Blog Name.

Now, I'd like to modify the Autoblog settings so that for the "Categories and Tags" so that just that section will operate as:
"Treat article authors as categories; add any that do not exist"

I can't simply replace the category RSS element in the source feed with $blogname because I require the use of Autoblog's filter-by-tags feature.

I think i can do this somewhere in autoblogprocess.php by replacing the category pull with the author field. Possibly in the //Setup Categories area, but I can't quite figure it out. Any help?

  • Jared

    Sure! Sorry about that.

    (I'm keeping edits stored in a backup so I can replace if needed on update, btw.)

    I'd like to modifiy the autoblog code so that in the Feed Edit settings where:

    Categories and Tags> Treat Feed Categories as Categories; add any that do not exist"

    It functions instead as:

    Treat Article Author as Categories; add any that do not exist.

    All I need to do is swap out the Category variable in that specific piece of code to the Author variable. I'm just not sure where to do it.

  • Jared

    I've kept snooping in the code to try and figure it out. I'm pretty sure the code I need to modify is the section I've dropped in here below. (This code seems to be repeated with a very small change elsewhere in autoblogprocess.php, I'm not sure why but I made the same changes to both sections while testing).

    This seems to be where it matches the original post category to existing categories, and then creates a new category with the same name as the original post category if no match is made. What I want it to do is have it match the original author to existing post categories, and create a new category with the same name as the original author if no match is made.

    I've tried swapping out bunches of these sections, but either my changes seem to do nothing or break the file! Any tips? I'm going screen blind staring at it :wink:

    case 'categories': //$term = get_term_by('name', $cat_name, 'category');
    $thecats = array();
    $thecats = $item->get_categories();
    if(!empty($thecats)) {
    foreach ($thecats as $category)
    {
    $cat_name = trim( $category->get_label() );
    $term_id = $this->category_exists($cat_name);
    if(!empty($term_id)) {
    $post_category[] = $term_id;
    } else {
    // need to check and add cat if required
    if(isset($ablog['originalcategories']) && $ablog['originalcategories'] == '1') {
    // yes so add
    $term_id = wp_create_category($cat_name);
    if(!empty($term_id)) {
    $post_category[] = $term_id;
    }
    }
    }

    }
    }
    break;

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.