Recent Topics

1 Aug 09, 2006 18:05    

After poking around for a good way to make blogs private (i.e. only visible to users who are members), it seemed the only solution was to hack the source directly. Not being a fan of hacking (it makes upgrading a nightmare) and being a fan of the b2evolution plugin architecture, I decided to try my hand at a Private Blog plugin. Attached is the result (unzip into your plugins folder, then set up via back office)

Features:
[list]

  • Hides protected blogs from appearing in:

  • [list]

  • Backoffice blog list

  • Frontend blog list

  • Linkblog in sidebar

  • [/list:u]

  • Hides posts from protected blogs from appearing in the Blog All

  • Hides protected posts from appearing in RSS (this is also a bug)

  • Skin-independent

  • Easy to administrate - Select blogs to protect from plugin settings panel in backoffice

  • Only users with at least is_member permission will be able to see protected blogs! (via blog-group or blog-user permissions, users with edit_all (blogs) permissions can optionally see protected blogs [recommended])

  • Lots and lots of debug messages available to help troubleshoot

  • [/list:u]

    A few notes:
    [list]

  • Tested only on b2evo 1.8 Summer Beta. If you have some time, try it out on 1.6 or earlier and let me know if it works!

  • Requires at least PHP 4.3 compiled with the enable-overload option (enabled by default), or PHP 5 or later (overload support is built-in) (Note that I only tested in PHP 5.0, but it should work in 4.3. Let me know if you find otherwise.)

  • This plugin just about doubles the amount of SQL queries that your blog issues normally. If your skin uses an insane amount of queries, you may see a decrease in the performance of your blog

  • [/list:u]

    The plugin operates by listening to all queries going through the DB object and scanning the results for protected blogs (or posts/cats from protected blogs). It would have been easier and much more efficient if I had been able to rely on scanning only the cached data objects, but there is no guarantee that a skin or plugin author would use those objects, and there didn't seem to be a consistent use of these objects in the base code either. If you can think of a better way to go about this, please let me know. This was a week's worth of brainstorming and 4 days of trial and error and 1 late project as a result. I'm open to any and all feedback.

    Known bugs: (I'll update as more are found)
    [list]

  • The Blog All list is filtered for protected blogs, but as a result you may end up with a variable number of posts per page if you have it set to show x number of posts. Avoiding this would be a beast because I'd have to parse the original SQL query to insert an additional WHERE clause and there's just no fool-proof way to do that without ruining an otherwise perfectly good query. Hell, if there was an easy way to do it I would have done that in the first place instead of resorting to scanning the results. Again, if you can think of a good way to do this, let me know!

  • Hides protected posts from appearing in RSS (this is also a feature).

  • [/list:u]

    2 Aug 10, 2006 16:15

    I was moving this to my production environment and found some bugs. Turns out my development server has PHP 5.1 while my production environment is still at PHP 4.3, so there were a few things that had to be down graded. Still working out some of the bugs with overloading in 4.3. I'll post an updated version later today or tomorrow.


    Form is loading...