The MU forums have moved to WordPress.org

Premium Blogs Plugin - Initial Release (37 posts)

  1. sycophant
    Member
    Posted 15 years ago #

    I have started creating a 'Premium Blogs' management plugin.

    It's very early days so far, but it's marginally functional already, so I figured I'd release what I've made so far, and ask for some feedback.

    Premium Blogs v0.1a

    It offers basic plugin limitation controls, and offers a isPremium() function for conditional stuff in themes and stuff.

    Check it out, and tell me what you think. I'm pretty busy at the moment, so I don't know when I'll get to work on it, but this is a reasonable demonstration of my intent anyway.

  2. mypatricks
    Member
    Posted 15 years ago #

    Download link die.

  3. suleiman
    Member
    Posted 15 years ago #

    the download link is indeed down, but I would also like to ask whether it would be possible to enable/disable the CSS style editor for premium users?

  4. quenting
    Member
    Posted 15 years ago #

    well implementing a premium is basically adding a flag to your blog and providing a function like "is_premium()" returning true/false. You can then call that function in whatever plugin to activate / deactivate it.

  5. sycophant
    Member
    Posted 15 years ago #

    Not sure what's happened to the link there... It was working yesterday. Anyway the download is here

    Essentially it is basically just adding a 'premium_blog' flag - but I'm planning to tie a bunch more stuff into that.

  6. frozonecold
    Member
    Posted 15 years ago #

    @suleiman: How are you running the css editor anyway? I could not find a plugin for wpmu that does this.

  7. suleiman
    Member
    Posted 15 years ago #

    there was one a while back, i don't have a copy, i was actually planning on either (a) digging it up, or (b) coding my own, which would basically be a call to enable the built-in theme editor.

  8. sycophant
    Member
    Posted 15 years ago #

    Essentially - this plugin should have the capability to allow or disallow any plugins for users based on their premium status. I'll look into making it apply to mu-plugins and standard plugins - so that a plugin can be simply active (for mu-plugins) or available for activation (the standard plugins).

  9. andrea_r
    Moderator
    Posted 15 years ago #

  10. frozonecold
    Member
    Posted 15 years ago #

    Thank you Andrea. You must have catalogued the whole forums on your brain. :)

  11. otmtoy
    Member
    Posted 15 years ago #

    great start sycophant

  12. andrea_r
    Moderator
    Posted 15 years ago #

    Nope, I just have a very weird and selective memory. :) I actually forgot one of the kid's names today... I went down the whole list until I got to the right one.

    (and I have the right search page bookmarked
    http://mu.wordpress.org/forums/search.php

    )

  13. topherrosado
    Member
    Posted 15 years ago #

    I get the following error in the edit blog interface with this plugin:

    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'premium_blog::configure' was given in /home/unsilenc/public_html/wp-includes/plugin.php on line 123

  14. topherrosado
    Member
    Posted 15 years ago #

    I've also added the following to wp-admin/menu.php to make the link to Premium Blogs not appear in users' dashboards:

    	$menu[2] = array(__('Premium Blogs'), '10', 'premium.php' );
    	$submenu[ 'premium.php' ][1] = array( __('Main'), '10', 'premium.php');
    	$submenu[ 'premium.php' ][5] = array( __('Plugins'), '10', 'premium-plugins.php');

    and commented out

    add_action('admin_menu',array('premiumBlogs', 'addmenu'));
    in premium-blog.php

    I'm sure there's a better way of doing it, but I couldn't get an "if( is_site_admin()" statement working in premium-blog.php. I just didn't think that this link should appear in users' dashboards ;)

  15. sycophant
    Member
    Posted 15 years ago #

    I'll look at that sometime soon. I'm trying my hardest to avoid having to edit any base files.

  16. Astroblogger
    Member
    Posted 15 years ago #

    Was wondering status of this plugin. So far--I do have it installed--the only thing is you cannot designate what blogs are "Premium Blogs" or what Themes are Premium themes, etc.

    It is a great idea.

  17. Astroblogger
    Member
    Posted 15 years ago #

    Ah! I figured it out, thanks to Dr. Mike's assistance:

    The following is DrMike's words, not mine, just edited to make the premium selection work with this plugin.

    - Open up wp-admin/upgrade-schema.php for editing.
    - Go down until you hit the function populate_options.
    - See all those add_option lines? What we need to do is add in our own with a default. For example, we'll add in the following line:
    add_option('premium_blog', 0);

    This way when a new blog is created, it will already have the flag set in there to be negative.

    But what to do with blogs already created? We're going to have to fake an upgrade.

    - Open up wp-includes/version.php for editing.
    - See that line that lists the current database version number? Add '1' to it. For example if it's currently 3845, edit it to show as 3846. Be sure to save the file afterwards. (The software checks against the version numbers. If they match, it assumes it's already been done.)
    - Open up wp-admin/upgrade-functions.php for editing and go about a third of the way down. You should see a bit like the following:

    if ( $wp_current_db_version < 3308 )
    upgrade_160();
    What we need to do is add our own in there. Since in this case we're just adding in a single add_option we're just take care of it right there and not worry about any other functions.

    if ( $wp_current_db_version < 4000 )
    add_option( "premium_blog", 0 );

    Save it afterwards.
    - Run the upgrade from the Site Admin menu.

    All your blogs should now have this flag set as default.

    How to activate this flag? When you get a user who has paid their ten bucks or whatever, just go into Dashboard -> Site Admin -> Blogs -> Find their blog and edit it. Using thte example above, your should now have a field with 'Premium Blog' in front of it. Change it to 1 and save.

    End Dr Mike and insert me.

    When you have this selected, and certain plugins designated as "Premium" under the Premium Menu option, all the plugins will show. The ones that are designated as Premium will not show for those who are not designated as premium.

    Now, I want to do this with themes as well. Unfortunately, I am not a coder--I just experimented with DrMike's advice. (If I knew how to put together the entire plugin I would).

    If someone could point me in the right direction, or explain how I could do the same thing for themes--I would appreciate the help. If I could do that, I think I would accomplish everything I need with this plugin.

  18. wcardinal
    Member
    Posted 15 years ago #

    anyone have a suggestion about this error on wpmu-blogs.php?

    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'premium_blog::configure' was given in /wp-includes/plugin.php on line 123

  19. tsukaeru
    Member
    Posted 15 years ago #

    Has anyone managed to fix the above error? I have the same problem.

  20. tsukaeru
    Member
    Posted 15 years ago #

    Change the last line to this:
    add_filter('wpmueditblogaction',array('premiumBlogs','configure'));

  21. tsukaeru
    Member
    Posted 15 years ago #

    Did anyone manage to remove this from user menus without modifying the core? is_site_admin() doesn't seem to work :-(

  22. booblik
    Member
    Posted 15 years ago #

    i've got errors :( i have old wpmu maybe because of it

  23. Daisyo75
    Member
    Posted 15 years ago #

    This seems a great beginning. I have a little wish list. If anyone has gotten any of the following to work I'd love to hear about it.

    1. Themes. Has anyone gotten this to set themes as premium?
    2. There is Google ads code in there. Anyone know if there is a purpose for this?
    3. Get the Premium Blogs link off the first level of the control panel. It seems it belongs under Site Admin...
    4. Multiple levels of premium. This one is probably a bit harder. I'd like to have toggles for each theme/plugin for more than one type of premium.

    I'm more of a tinkerer than a coder but it seems that these things should be within grasp. I have a much longer list but most of the rest is beyond the current scope of this plugin.

  24. sycophant
    Member
    Posted 15 years ago #

    I'm in the process of doing a little work on this plugin at the moment. The new version is being tidied up a little and will work properly with the current codebase.

    In response to your points Daisy075,

    1)I'm working on that at the moment. It will be certainly be in the next version.

    2) The idea was that non-premium blogs would have ads in the themes, while premium blogs would be ad-free.

    3) The reason I put it on the top level is because there will be many options. As there is only two menu levels that seemed the best way. I will look into this.

    4) It wouldn't be too hard to achieve multiple levels of premium I guess. But it wasn't in my original plan.

    One thing I want to do it to make it expandable so that people can use the framework of the plugin to extend it into controlling other aspects. One problem I have with the things I am trying to do, however, is that there are no hooks into many of the things I'd like to control, so it requires that code in core files be edited for some features. I try to keep it to as few lines as possible.

  25. sycophant
    Member
    Posted 15 years ago #

    I will be releasing a new version in the next day or so.

    This version adds theme control, fixes the menu to show to admin only, and tidies a few things up.

    Next version will add an advanced feature to set arbitary blog settings to premium blogs. I'll look at creating a more managable menu setup that will sit in the Site Admin menu. And I want to write a 'module' interface to allow easy customisation.

  26. suleiman
    Member
    Posted 15 years ago #

    that sounds awesom sychophant. Looking forward to your next release, particularly the theme control.

  27. Daisyo75
    Member
    Posted 15 years ago #

    Can't wait to see what you come up with!

  28. jalien
    Member
    Posted 15 years ago #

    Works great! Thanks.

    With the Admin Drop Down menus plugin (so much faster for navigation) the menu doesn't appear. Does anyone know how to fix this without hard coding this into /wp-admin/menu.php? Is this a problem with the way the drop down menus works, or is it because of the way premium blogs creates it's menus? Thanks.

  29. andrea_r
    Moderator
    Posted 15 years ago #

    We're using the same drop-dowm menus plugin - it's the way the plugin works. You'll have to add it.

  30. jalien
    Member
    Posted 15 years ago #

    Thanks, I'll give it a try. Just to clarify, I am correct in assuming that it will take an edit of menu.php. Is there a better way?

About this Topic

  • Started 15 years ago by sycophant
  • Latest reply from theapparatus