Skip to content
This repository
  • 1 commit
  • 4 files changed
  • 0 comments
  • 1 contributor
Nov 28, 2012
Charles Johnson Bugfix: don't overwrite a slug if the user has manually edited it fro…
…m within WordPress. Props Chris Fritz.
ffded62
6 feedwordpress.php
@@ -3,7 +3,7 @@
3 3 Plugin Name: FeedWordPress
4 4 Plugin URI: http://feedwordpress.radgeek.com/
5 5 Description: simple and flexible Atom/RSS syndication for WordPress
6   -Version: 2012.0810
  6 +Version: 2012.1128
7 7 Author: Charles Johnson
8 8 Author URI: http://radgeek.com/
9 9 License: GPL
@@ -11,7 +11,7 @@
11 11
12 12 /**
13 13 * @package FeedWordPress
14   - * @version 2012.0810
  14 + * @version 2012.1128
15 15 */
16 16
17 17 # This uses code derived from:
@@ -34,7 +34,7 @@
34 34
35 35 # -- Don't change these unless you know what you're doing...
36 36
37   -define ('FEEDWORDPRESS_VERSION', '2012.0810');
  37 +define ('FEEDWORDPRESS_VERSION', '2012.1128');
38 38 define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
39 39
40 40 if (!defined('FEEDWORDPRESS_BLEG')) :
15 readme.txt
@@ -3,7 +3,7 @@ Contributors: Charles Johnson
3 3 Donate link: http://feedwordpress.radgeek.com/
4 4 Tags: syndication, aggregation, feed, atom, rss
5 5 Requires at least: 3.0
6   -Tested up to: 3.3.2
  6 +Tested up to: 3.4.2
7 7 Stable tag: 2011.1019
8 8
9 9 FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
@@ -96,8 +96,17 @@ outs, see the documentation at the [FeedWordPress project homepage][].
96 96
97 97 = Trunk =
98 98
99   -* USER-AGENT STRING: FeedWordPress now sends a distinctive User-Agent string
100   - identifying itself, and noting that it is a feed aggregator.
  99 +* BUGFIX: MANUALLY EDITED POST SLUGS NOT OVERWRITTEN. Thanks to a report
  100 + by Chris Fritz, I've identified some code that causes post slugs for the
  101 + posts generated by FWP to be rewritten with every update, even if the
  102 + user has manually updated the slug from within the WordPress editing
  103 + interface. This has been fixed: FWP will continue to generate new slugs
  104 + for syndicated posts, but when syndicated posts are updated, they will
  105 + retain the slug that they had at the time of the update; any manual
  106 + changes to the post slug should be preserved.
  107 +
  108 +* USER-AGENT STRING: FeedWordPress now sends a distinctive User-Agent
  109 + string identifying itself, and noting that it is a feed aggregator.
101 110
102 111 = 2011.1019 =
103 112
11 syndicatedpost.class.php
@@ -30,6 +30,7 @@ class SyndicatedPost {
30 30
31 31 var $_freshness = null;
32 32 var $_wp_id = null;
  33 + var $_wp_post = null;
33 34
34 35 /**
35 36 * SyndicatedPost constructor: Given a feed item and the source from
@@ -1343,7 +1344,8 @@ function freshness () {
1343 1344 endif;
1344 1345 $this->_freshness = 1; // Updated content
1345 1346 $this->_wp_id = $old_post->ID;
1346   -
  1347 + $this->_wp_post = $old_post;
  1348 +
1347 1349 // We want this to keep a running list of all the
1348 1350 // processed update hashes.
1349 1351 $this->post['meta']['syndication_item_hash'] = array_merge(
@@ -1473,8 +1475,13 @@ function store () {
1473 1475 if (!$this->filtered() and $freshness > 0) :
1474 1476 // Filter some individual fields
1475 1477
  1478 + // If there already is a post slug (from syndication or by manual
  1479 + // editing) don't cause WP to overwrite it by sending in a NULL
  1480 + // post_name. Props Chris Fritz 2012-11-28.
  1481 + $post_name = (is_null($this->_wp_post) ? NULL : $this->_wp_post->post_name);
  1482 +
1476 1483 // Allow filters to set post slug. Props niska.
1477   - $post_name = apply_filters('syndicated_post_slug', NULL, $this);
  1484 + $post_name = apply_filters('syndicated_post_slug', $post_name, $this);
1478 1485 if (!empty($post_name)) :
1479 1486 $this->post['post_name'] = $post_name;
1480 1487 endif;
2  syndicationdataqueries.class.php
@@ -121,7 +121,7 @@ function posts_fields ($fields, &$query) {
121 121 if ($f = $query->get('fields')) :
122 122 switch ($f) :
123 123 case '_synfresh' :
124   - $fields = "{$wpdb->posts}.ID, {$wpdb->posts}.guid, {$wpdb->posts}.post_modified_gmt";
  124 + $fields = "{$wpdb->posts}.ID, {$wpdb->posts}.guid, {$wpdb->posts}.post_modified_gmt, {$wpdb->posts}.post_name";
125 125 break;
126 126 case '_synfrom' :
127 127 $fields = "{$wpdb->posts}.ID, {$wpdb->posts}.guid, {$wpdb->posts}.post_title, {$wpdb->postmeta}.meta_value";

No commit comments for this range

Something went wrong with that request. Please try again.