├── .gitmodules ├── changelog.txt ├── README.md └── recent-global-author-comments-feed.php /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/dash-notices"] 2 | path = lib/dash-notices 3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | === Global Comments Feed === 2 | Authors: Paul Menard (Incsub), Ivan Shaovchev, Andrew Billits (Incsub), S H Mohanjith (Incsub) 3 | 4 | == Changelog == 5 | 6 | = 1.0.3.3 = 7 | - Update to query logic when trying to determine related post title for comment. Previous logic was incorrectly trying to access wp_1_posts table. 8 | 9 | = 1.0.3.2 = 10 | - IMPORTANT security update 11 | - XSS prevention patches 12 | 13 | = 1.0.3.1 = 14 | * Fix: 404 header 15 | * Fix: RSS language 16 | 17 | = 1.0.3 = 18 | * Name Change 19 | * Author id fix 20 | 21 | = 1.0.2 = 22 | * Compatibility update for WordPress 3.1 23 | * Update notifications scripts added 24 | * RSS Feed display mechanism improved 25 | * Bug fixes 26 | 27 | = 1.0.1 = 28 | * Switched user login to display name 29 | 30 | = 1.0.0 = 31 | * Initial Release 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Global Author Comments Feed 2 | 3 | 4 | **INACTIVE NOTICE: This plugin is unsupported by WPMUDEV, we've published it here for those technical types who might want to fork and maintain it for their needs.** 5 | 6 | ## Translations 7 | 8 | Translation files can be found at https://github.com/wpmudev/translations 9 | 10 | 11 | 12 | Provides a global feed of comments from a single author made across multiple sites on your network. 13 | 14 | To Use: 15 | 16 | 17 | 1. Install the Comment Indexer 18 | 19 | The Comment Indexer is designed to index comments on your network and needs to be installed for the Recent Global Comments Feed plugin to work. 20 | 2. Install Global Author Comments Feed. 21 | 22 | 3. Navigate to Plugins in the network admin dashboard and Network Activate the plugin. 23 | 24 | 4. Your new feed is created at 25 | 26 | http://yourdomain.com/feed/recent-global-author-comments/?uid=USERID 27 | The Recent Global Author comments feed is for comments on public sites only. Comments from privates sites don’t appear in the feed. 28 | You check it is working correctly by working by posting some new comments and confirming they appear in your global feed. 29 | To Use: 30 | 1. Locate the user’s ID by hovering your mouse over their username in Users > All Users in the network admin dashboard 31 | 32 | their user ID displays in the status bar of your web browser 33 | 2. Your feed URL for each user is located at: 34 | 35 | http://yourdomain.com/feed/recent-global-author-comments/?uid=USERID 36 | 37 | 38 | 3. The user feed URL used in numerous ways including: 39 | 40 | With a theme like WPMU-Dixi which pulls RSS feed onto it’s homepage, 41 | Adding 3rd Party RSS feed widgets in the site side bar 42 | Alternatively readers can subscribe to it using feed readers such as Google Reader 43 | -------------------------------------------------------------------------------- /recent-global-author-comments-feed.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT * FROM " . $wpdb->base_prefix . "site_comments WHERE site_id = '" . $current_site->id . "' AND comment_author_user_id = %d AND blog_public = '1' AND comment_approved = '1' AND comment_type != 'pingback' ORDER BY comment_date_stamp DESC LIMIT %d", $author, $number); 43 | $comments = $wpdb->get_results( $query, ARRAY_A ); 44 | 45 | if ( count( $comments ) > 0 ) { 46 | $last_published_post_date_time = $wpdb->get_var($wpdb->prepare("SELECT comment_date_gmt FROM " . $wpdb->base_prefix . "site_comments WHERE site_id = %d AND comment_author_user_id = %d AND blog_public = '1' AND comment_approved = '1' AND comment_type != 'pingback' ORDER BY comment_date_stamp DESC LIMIT 1", $current_site->id, $author)); 47 | } else { 48 | $last_published_post_date_time = time(); 49 | } 50 | 51 | if ( $author > 0 ) { 52 | $author_user_login = $wpdb->get_var($wpdb->prepare("SELECT user_login FROM " . $wpdb->base_prefix . "users WHERE ID = %d", $author)); 53 | } 54 | 55 | header( 'HTTP/1.0 200 OK' ); 56 | header( 'Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true ); 57 | $more = 1; 58 | 59 | echo ''; ?> 60 | 61 | 69 | > 70 | 71 | 72 | <?php bloginfo_rss('name'); ?> <?php echo $author_user_login . ' '; ?><?php _e('Comments'); ?> 73 | 74 | 75 | 76 | 77 | 78 | 79 | 0 ) { 81 | foreach ($comments as $comment) { 82 | if (intval($comment['blog_id']) < 2) 83 | $table_name = $wpdb->base_prefix . "posts"; 84 | else 85 | $table_name = $wpdb->base_prefix . $comment['blog_id'] . "_posts"; 86 | 87 | $sql_str = $wpdb->prepare("SELECT post_title FROM " . $table_name ." WHERE ID = %d", $comment['comment_post_id']); 88 | 89 | $post_title = $wpdb->get_var( $sql_str ); 90 | if ( !empty( $comment['comment_author_user_id'] ) && $comment['comment_author_user_id'] > 0 ) { 91 | $author_display_name = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM " . $wpdb->base_prefix . "users WHERE ID = %d", $comment['comment_author_user_id'])); 92 | } 93 | if ( !empty( $author_user_login ) ) { 94 | $comment_author = $author_display_name; 95 | } else { 96 | $comment_author = $comment['comment_author_email']; 97 | } 98 | ?> 99 | 100 | <?php _e('Comments on'); ?>: <?php echo stripslashes( $post_title ); ?> 101 | #comment- 102 | 103 | 104 | 105 | 106 | #comment- 107 | ]]> 108 | 109 | 113 | 114 | 115 | $wp_rewrite 123 | * @return void 124 | */ 125 | function recent_global_author_comments_feed_rewrite( $wp_rewrite ) { 126 | $feed_rules = array( 127 | 'feed/(.+)' => 'index.php?feed=' . $wp_rewrite->preg_index(1), 128 | '(.+).xml' => 'index.php?feed='. $wp_rewrite->preg_index(1), 129 | ); 130 | $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; 131 | } 132 | add_filter( 'generate_rewrite_rules', 'recent_global_author_comments_feed_rewrite' ); 133 | --------------------------------------------------------------------------------