├── .gitmodules
├── README.md
├── recent-global-author-posts-feed.php
└── global-author-posts-feed.php
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "dash-notice"]
2 | path = dash-notice
3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git
4 | branch = master
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Global Author Posts Feed
2 |
3 | **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.**
4 |
5 | ## Translations
6 |
7 | Translation files can be found at https://github.com/wpmudev/translations
8 |
9 | ## Global Author Posts Feed grabs all the posts from a single author, from across an entire Multisite or BuddyPress network, and puts them in a single feed.
10 |
11 | A feed just for a selected author that combines all their posts into one big RSS job.
12 |
13 | ### Completely Automated Setup
14 |
15 | It's really straightforward. No pesky options to worry about. Once it's installed, simply click the Feed link next to the user's name under Users > All Users in your network admin to open that user's feed in a new window.
16 |
17 | ### How Will You Use It?
18 |
19 | Here's some examples:
20 |
21 | * Use a theme that pulls RSS feeds onto it's homepage
22 | * Add it to a 3rd Party RSS feed widget in the side bar
23 | * Let readers subscribe to it using a feed reader
24 |
25 | ### To Get Started:
26 |
27 | Once the Global Author Posts Feed plugin is installed and activated, your new feed will be created at: http://yourdomain.tld/feed/globalauthorpostsfeed?author=USERID
28 |
29 | ### To Use
30 |
31 | A new link is now added to the row of actions for each user under Users > All Users in your network admin. Simply click the link to open that user's feed in a new window. The feed URL for each user is located at:
32 |
33 | http://yourdomain.tld/feed/globalauthorpostsfeed?author=USERID
34 |
35 | The user feed URL can be added to a site in numerous ways including:
36 |
37 | * A theme which pulls RSS feed onto it's homepage,
38 | * 3rd Party RSS feed widgets in the site side bar
39 | * Readers can subscribe to it using feed readers such as Feedly
40 |
--------------------------------------------------------------------------------
/recent-global-author-posts-feed.php:
--------------------------------------------------------------------------------
1 | ';
37 |
38 | $number = isset($_GET['number']) ? $_GET['number'] : 25;
39 |
40 | $author = isset($_GET['author']) ? $_GET['author'] : 1;
41 |
42 | if(!is_numeric($author)) {
43 | // We could have the user login of the user so find the id from that
44 | $theauthor = get_user_by( 'login', $author );
45 | if(is_object($theauthor)) {
46 | $author = $theauthor->ID;
47 | }
48 | } else {
49 | $theauthor = get_user_by( 'id', $author );
50 | }
51 |
52 | $posttype = isset($_GET['posttype']) ? $_GET['posttype'] : 'post';
53 |
54 | $network_query_posts = network_query_posts( array( 'post_type' => $posttype, 'posts_per_page' => $number, 'author' => $author ));
55 |
56 | ?>
57 |
65 | >
66 |
67 |
68 | display_name; ?>
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | -
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | ]]>
89 |
90 | ]]>
91 | post_content ) > 0 ) { ?>
92 | ]]>
93 |
94 | ]]>
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/global-author-posts-feed.php:
--------------------------------------------------------------------------------
1 | db = $wpdb;
40 | if ( $this->db->blogid == 1 ) {
41 | // Only add the feed for the main site
42 | add_action( 'init', array( $this, 'initialise_global_author_posts_feed' ) );
43 | }
44 |
45 | add_filter( 'ms_user_row_actions', array( $this, 'add_user_row_action' ), 10, 2 );
46 | }
47 |
48 | function initialise_global_author_posts_feed() {
49 | add_feed( 'globalauthorpostsfeed', array( $this, 'do_global_author_posts_feed' ) );
50 |
51 | $installed = get_option( 'globalauthorpostsfeed_version', false );
52 | if ( $installed === false || $installed < $this->build ) {
53 | // We need to flush our rewrites so that the new feed is added and recognised
54 | flush_rewrite_rules();
55 | update_option( 'globalauthorpostsfeed_version', $this->build );
56 | }
57 | }
58 |
59 | function do_global_author_posts_feed() {
60 | global $network_query, $network_post;
61 |
62 | // Remove all excerpt more filters
63 | remove_all_filters( 'excerpt_more' );
64 |
65 | @header( 'Content-Type: ' . feed_content_type( 'rss-http' ) . '; charset=' . get_option( 'blog_charset' ), true );
66 | $more = 1;
67 |
68 | echo '';
69 |
70 | $number = isset( $_GET['number'] ) ? $_GET['number'] : 25;
71 | $author = isset( $_GET['author'] ) ? $_GET['author'] : 1;
72 |
73 | if ( !is_numeric( $author ) ) {
74 | // We could have the user login of the user so find the id from that
75 | $theauthor = get_user_by( 'login', $author );
76 | if ( is_object( $theauthor ) ) {
77 | $author = $theauthor->ID;
78 | }
79 | } else {
80 | $theauthor = get_user_by( 'id', $author );
81 | }
82 |
83 | $posttype = isset( $_GET['posttype'] ) ? $_GET['posttype'] : 'post';
84 |
85 | $network_query_posts = network_query_posts( array( 'post_type' => $posttype, 'posts_per_page' => $number, 'author' => $author ) );
86 |
87 | ?>
88 |
96 | >
97 |
98 |
99 | display_name; ?>
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | -
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | ]]>
120 |
121 | ]]>
122 | post_content ) > 0 ) { ?>
123 | ]]>
124 |
125 | ]]>
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 | Feed',
142 | esc_url( add_query_arg( 'author', $user->ID, site_url( '/feed/globalauthorpostsfeed' ) ) )
143 | );
144 | return $actions;
145 | }
146 |
147 | }
148 |
149 | $globalauthorpostsfeed = new globalauthorpostsfeed();
--------------------------------------------------------------------------------