Capabilities of plugin and how to use hooks to pass custom field data

The description of this plugin mentions FeedWordPress and how it is superior. There is one feature that FeedWP has that I absolutely need for this plugin to work out for me. When processing a feed and finding a post that's already been moved over, I need to check if the feed's post has been modified, and if so update the fed post to match it, unless the fed post has been modified. Does that make sense?

I can probably manage to do the checking part myself, but looking through Autoblog's code I don't see a hook I can use to do this from (I think would be around line 685 of autoblogprocess.php). Maybe a hook could be added for this purpose?

Also, I need to pass custom fields with my posts. It looks like I can use the autoblog_pre_post_insert filter to grab extra data from a post in a feed, is that right? what exactly do the $post_data, $ablog, and $item variables hold? and do I need to return the whole "compact(lots of items)" statement? It also looks like I can use the autoblog_post_process_feed hook to update the post meta of posts that have been fed in, or is that hook too late to do so?

I know that's a lot of questions in there. Even if you can only answer some of it now and have to come back with more info for others later, I would appreciate any help. Thanks!

  • aecnu

    Greetings jasonjulien,

    Thank you for these great questions.

    The feature you described about reconciling posts is currently not available though it can be put in as a feature request to possibly be considered for future development.

    Regarding all the other questions, though they are clearly beyond the scope of the support we provide here relative to your wanting to perform custom coding, in an effort to try to help, I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • jasonjulien

    Thanks aecnu.

    It would be great if the developer could weigh in. I saw he replied in another thread that the custom fields functionality was possible using some hooks and I hoped to get a little more information on that.

    As for feature requests, I think the most I would end up requesting is for a hook to be added so I could manipulate post data and do that reconciliation on my own. It would require very little added to the plugin to accomodate this.

  • aecnu

    Greetings jasonjulien,

    Thank you for your additional input, it is greatly appreciated

    It would be great if the developer could weigh in.

    I have indeed flagged him for input into this ticket and hopefully he will be able to make it in here sooner then later.

    As for feature requests, I think the most I would end up requesting is for a hook to be added so I could manipulate post data and do that reconciliation on my own.

    Oh yes and that sounds like a great feature request if he does not manage to get these items addressed in his response to this ticket.

    Cheers, Joe

  • Barry

    Hi, no there isn't a method to update existing posts because the plugin is set to stop reading a feed once it finds an entry it has already imported, and so will never read any posts that it will need to update.

    Regarding postmeta - you will need to use the autoblog_post_post_insert action as the pre action doesn't have a post_id to attach them to - the action passes -
    Post_id which is the post_id that was created and that you will attach your post meta to.
    Ablog which is the autoblog feed information that you entered in the feed add/edit form which contains things like the id and the title, url - have a look in the process_feed function for examples
    Item - this is the simplepie object for the post just inserted in case you need to pull any extra information from the feed itself. You can use the simplepie methods to get that information out.

  • jasonjulien

    Thanks Barry, that is helpful. Does the plugin just use the simplepie feed that WordPress outputs? So if I modify the WP feed template to include my postmeta, autoblog will be able to pick that up in $item?

    Is it likely that a hook could be added for me in a spot where I could compare post data between an incoming post and the same post already existing on the fed blog? I think I would probably do a check of postmeta to see if an existing post had been modified on a fed site.

    I like this plugin better than FeedWP but this feature is absolutely critical for me. I'm trying to decide if I'll have to fork this to have it work how I need.

  • Barry

    Does the plugin just use the simplepie feed that WordPress outputs?

    It uses the simplepie class included within WP to read in feeds if that's what you mean?

    So if I modify the WP feed template to include my postmeta, autoblog will be able to pick that up in $item?

    Simplepie is an RSS and ATOM feed reader, therefore any feed you pass will need to be in one of those formats. If you are adding extra information to a feed then you must ensure that it remains valid or simplepie will simply not read it.

    It would need quite a bit of re-working of the plugin logic to have it carry on processing already imported posts - something that could be used in that way could certainly be added, but it's not going to be a quick hack and release I'm afraid.

  • Barry

    Does the plugin just use the simplepie feed that WordPress outputs?

    It uses the simplepie class included within WP to read in feeds if that's what you mean?

    So if I modify the WP feed template to include my postmeta, autoblog will be able to pick that up in $item?

    Simplepie is an RSS and ATOM feed reader, therefore any feed you pass will need to be in one of those formats. If you are adding extra information to a feed then you must ensure that it remains valid or simplepie will simply not read it.

    It would need quite a bit of re-working of the plugin logic to have it carry on processing already imported posts - something that could be used in that way could certainly be added, but it's not going to be a quick hack and release I'm afraid.