The MU forums have moved to WordPress.org

1 2 3 ... 8

Sitewide Feed (213 posts)

  1. itdamager
    Member
    Posted 17 years ago #

    Just wanted to let everyone know I updated my sitewide feed plugin which should fix the itemless feed problem some people were having with recent versions of WPMU.

    In case you are not familiar with my plugin, it creates a master feed that contains the most recent posts from all blogs on your WPMU site.

    Unzip and upload into mu-plugins and then access the feed by visiting http://yoursite/wpmu-feed/. Initialization of everything the plugin needs to run is done automagically.

    You can change the feed url and number of feed items by editing the file and changing the settings near the top to better suit your needs.

    WPMU Sitewide Feed Plugin

  2. andrea_r
    Moderator
    Posted 17 years ago #

    Just wanted to say thanks. This is awesome. :)

  3. Farms
    Member
    Posted 17 years ago #

    Ditto, merci beacoup!

  4. nuprn1
    Member
    Posted 17 years ago #

    Awesome! I wish I knew php more... As this would've been an excellent base for what I did to pull out the recent postings on the home.php.

    Do you think you can add one more function that will just display the recent postings in html for the home.php page?

  5. itdamager
    Member
    Posted 17 years ago #

    That functionality is already included, but you'll have to come up with your own html. Just use my getpostdata() method, loop through the array, and output the html.

    Something like this:


    $postdata = $wpmu_sitefeed->getpostdata();
    echo '<ul>';
    foreach ($postdata as $pdata) {
    echo '<li><a href="'.$pdata->guid.'">'.$pdata->post_title.'</a></li>';
    }
    echo '</ul>';

  6. samchng
    Member
    Posted 17 years ago #

    Nice one ITDamager!! Appreciate the work!

  7. cfrazier
    Member
    Posted 17 years ago #

    ITDamager - I got the plugin working on our site and noticed something about the way you built it - specifically the postmap array. Turns out it doesn't take into consideration pre-posting (posts with a date later than now).

    I played with changing the getpostdata() function to only get post info for posts that should be showing and while it works, it ends up truncating the feed by the number of preposts not shown. The net result is that you could easily kill a feed by having the same number of preposts as your feed limit. Not a good thing.

    What's killing me about this whole thing is that the postmap is needed to keep DB lookups and overhead to a minimum (especially on WPMU sites with lots of blogs), but it really throws a wrench in being able to deal effectively with preposts, since it's populated during a post update, not when a post is displayed on the site.

    I'm working on a solution and will post here when I get some workable code.

  8. cfrazier
    Member
    Posted 17 years ago #

    After a little thought, I realized that any solution begins with a more flexible master list of sitewide posts - probably in it's own table. I assume that something like this has been built in another plugin, so rather than clutter up people's DBs with duplicated tables, it might be nice to piggyback the feed functionality onto someone else's table.

    Anyone know of a place to start looking for this?

  9. itdamager
    Member
    Posted 17 years ago #

    I was aware of that. There is another minor bug too. If a user deletes a post, it stays in the feed anyway. Clicking it from a reader results in a 404. It just wasn't a big enough deal, for me, to write code to remove it from the feed but I'll consider adding it next time I'm in it.

    Before you go ginsumatic on my plugin, if you are using a fairly current version of wpmu (one that includes wp-cron from wp2.1-alpha), just change the hook on line 37 from 'publish_post' to 'private_to_published' and that should, in theory, solve the future date problem.

  10. itdamager
    Member
    Posted 17 years ago #

    I updated my plugin to use the new API hook if available. That should fix future dated posts showing in the feed, however, you need WPMU rev 524 or later (dated feb 16) for it to work otherwise it falls back to the old API and includes future posts.

    As an added bonus, I went ahead and reset the postmap if a user deletes a post.

    Download link is the same.

  11. cfrazier
    Member
    Posted 17 years ago #

    Thanks for jumping on that. Unfortunately we're far enough back that upgrading just hoses our database, so I don't think I'll be able to use your code as-is until I spend a few days going through that headache. Until then, my ginsumatic hacks are going to have to be "good enough."

    Ugh.

  12. itdamager
    Member
    Posted 17 years ago #

    Keeping future posts out of the feed isn't a problem, its getting them into the feed when they mature.

    The newest wp and wpmu sets the post_status of future posts to 'future' and toggles them to 'publish' at the appropriate time. This makes it easy to filter, just query for published posts and they go into the feed as they mature.

    In your case, maybe if you changed the query in the initializepostmap() function to exclude future dated posts, then change the action for publish_post to resetpostmap, just like the delete action. It might hammer the db a little more, but only when posting or deleting a post.

    You could also reset the postmap just before grabbing the sitefeed by adding $this->resetpostmap() at the top of the outputfeed function just to be sure no posts have matured since the last published post.

    That should minimize the changes you need.

  13. itdamager
    Member
    Posted 17 years ago #

    Scratch all that, it's backwards compatible now. It just resets the postmap before feed output at the expense of a little more db action.

    Re-download :-)

  14. andrea_r
    Moderator
    Posted 17 years ago #

    Just a handy tip:
    I reconfigured the dashboard feeds in my setup so the main (top) feed show entires from the main site blog, and the second feed (using your plugin) shows the latest posts from everyone else. :)

    That way everyone sees it and doesn't miss a thing.

  15. cfrazier
    Member
    Posted 17 years ago #

    Andrea - cool idea!

    ITDamager - Seems to work great. I'll do more testing over the week. My one suggestion would be to change:

    <title><?php echo $this->fqdn()." Master Site Feed"; ?></title>

    to:

    <title><?php echo get_site_option('site_name') ." Master Site Feed"; ?></title>

    But obviously, it's not a huge deal.

    Again - thanks! You rock.

  16. cfrazier
    Member
    Posted 17 years ago #

    ITDamager - a few days worth of preposting makes it look like we've got a winner on this one. Once again, you save the day. Thanks!

  17. itdamager
    Member
    Posted 17 years ago #

    I've updated this plugin again for anyone interested. It fixes the future dated posts issue and adds caching. It also got a schnazzy new menu page under 'Site Admin' with all kinds of new stuff you can break ;-)

    WPMU Sitewide Feed Plugin

  18. andrea_r
    Moderator
    Posted 17 years ago #

    I snagged it earlier and will test it soonish. ;) Also, I don't know if you've noticed this minor bug, but when reading the master feed, categories on member posts grab the master blog categories.
    For example, I might see a member has posted an entry to their blog, but the feed says it is in category "site-wide issues" which is a category in the main blog and not one on their blog.
    Not a huge issues, I ignore it for now as not a lot of people use the master feed at this point(less than 6), but I thought I'd mention it.

  19. itdamager
    Member
    Posted 17 years ago #

    them sneaky bugs...

  20. andrea_r
    Moderator
    Posted 17 years ago #

    Maybe it's a feature?

    Anyway, just updated it on my site, looks good, worked fine.

    Edited to add: the bug I mentioned previously does not appear in the latest. So.... something you did fixed it. :)

  21. itdamager
    Member
    Posted 17 years ago #

    I was not aware of that little bugger, so I checked and indeed it still existed. It's fixed now.

    The good news is I was able to remove about 25 lines of code to workaround some feed functions that obviously aren't multiblog aware (now I switch to each blog, then run the built-in feed functions instead of using my own).

    The bad news is now that the categories work correctly the number of queries used to generate the feed has gone up.

  22. samchng
    Member
    Posted 17 years ago #

    The plugin got bigger. Haha, was 8kb now 24kb. Lots of changes since I installed it. But still seems to work the same.

    Do I have to install WP Object Cache?

    Anyway where do you use your feed guys? I use mine on the Dashboard after throwing it into mu-plugins.

  23. andrea_r
    Moderator
    Posted 17 years ago #

    I use mine on the dashboard, plus I use it in my feed reader to kep tabs on users. One: they write interesting posts and two: sometimes they ask support questions in their own blog.

    I admit, I skim a lot. :)

  24. SactoEric
    Member
    Posted 17 years ago #

    Awesome! Thanks itdamager! :)

  25. itdamager
    Member
    Posted 17 years ago #

    samchng, unless my plugin gives you a big red error message on the admin page, you've already got the object cache and it works. The plugin will still work without it, but it does check and tell you if it is not available.

    But just for the record, all you need is a wpmu build from around December or later and make sure the directory /wp-inst/wp-content/cache/ exists and is writable by the web server user.

    I think the plugin is bigger because I pasted the GPL license text into it :-) (and fixed everything people found wrong, added caching, added admin page w/ integrated help, etc).

  26. cafespain
    Member
    Posted 17 years ago #

    Hi
    I'm using a build from April 2006 and when installing the Sitewide feed plugin I get the message Your WPMU is not using WP Object Cache.

    What do I need to do to enable this? I've manually created a cache directory and made it writable, but after a hunt around am unsure of what else I need to do.

    The Feed works anyway, but I'm worried about performance when the number of blogs increases.

  27. itdamager
    Member
    Posted 17 years ago #

    After creating wp-content/cache and making it writable by the web server user, you have to enable the cache manually by editing wp-settings.php and adding the following line right before the line that says wp_cache_init();

    define('ENABLE_CACHE', true);

  28. cafespain
    Member
    Posted 17 years ago #

    Thank you all seems ok now, and files being created in the Cache directory.

  29. zeug
    Member
    Posted 17 years ago #

    Couldn't get the new 0.3.0 feed to work on either the 21/6 (r585) or the new rc1, no feed and no site admin options. The r585 still uses wp-inst but something's not working for me.

    The earlier version 1.1 of site feed from earlier this year does however still work...

  30. itdamager
    Member
    Posted 17 years ago #

    I was checking for $wp_version == 'MU' but they changed it to 'wordpress-mu-1.0'; them sneaky devils.

    I removed the test and updated the file so it works again.

    ...and in case nobody noticed, the plugin now creates sitewide comments and pages feeds in addition to the posts.

1 2 3 ... 8

About this Topic

  • Started 17 years ago by itdamager
  • Latest reply from jeremybyrne