The MU forums have moved to WordPress.org

SOLVED: introduce features for paying customers only (46 posts)

  1. topherrosado
    Member
    Posted 17 years ago #

    lunabyte: yes, just to make sure that it wasn't a specific problem with that plugin. None I've tried seem to be getting activated. I'm sure it's something I'm overlooking, but I can't seem to find the bit of code that actually makes the change in the db to activate the plugins.

  2. tunafish
    Member
    Posted 17 years ago #

    "I can't seem to find the bit of code that actually makes the change in the db to activate the plugins"
    I am just playing around with MU Plugin manager, why don't you have a look in there?
    What about the activate_plugin() and deactivate_plugin() functions?

  3. topherrosado
    Member
    Posted 17 years ago #

    I did, but the problem with MU Plugin Manager is that it's not a core WPMU file and it doesn't handle individual blogs.

    Plugin.php is a core file, and it must contain or reference the activation/deactivation process somewhere, but I'm not seeing it :(

  4. lunabyte
    Member
    Posted 17 years ago #

    Follow the references in it, and compare it to your file.

    I'd start with what happens when the activation link is clicked.

    At some point, it updates the information in the DB, so it knows what plugins to include with the site. You may wish to consider making it a separate db value, so that when someone cancels and goes back to a regular account, they don't still have it listed in their main plugins value.

    Come to think of it, that may be your issue. Off the top of my head, it's going to try and load the plugin referenced in the db out of the plugins dir. If it doesn't exist, it takes it out of the db. So if you just flat out delete a plugin, like it was causing issues or something, then it's removed from the array in the db.

    So, in theory at least, if it tries to load the plugins from the db array, but it doesn't exist in the plugins dir (although it is the premium dir), it won't ever actually be activated.

  5. topherrosado
    Member
    Posted 17 years ago #

    I'm getting closer -- lunabyte pointed me in a direction I had missed. Now I've got a new option (created using doc's instructions again) called Active Premium Plugins, and I did the following in upgrade-functions.php:

    
    	// SIU Hack below
    	$active_premium_plugins = __get_option('active_premium_plugins');
    
    	// If plugins are not stored in an array, they're stored in the old
    	// newline separated format.  Convert to new format.
    	if ( !is_array( $active_premium_plugins ) ) {
    		$active_premium_plugins = explode("n", trim($active_premium_plugins));
    		update_option('active_premium_plugins', $active_premium_plugins);
    	}
    	// SIU Hack above

    I made the relevant changes to my premium-plugins.php as well, so now the changes are saved to the correct option in the database. Before, deactivating a plugin in here would cause my other plugins to be deactivated as well, and now that doesn't happen. They're properly segregated, as far as I can tell.

    The premium plugins (wp-slimstat and simple forum) still aren't showing up in my dashboard if I activate them through the premium plugins page, even though they show up in the Active Premium Plugins option in the blog edit page.

    Nearly there! Just have to figure out what I'm still missing :)

  6. topherrosado
    Member
    Posted 17 years ago #

    Got it working!

    I just needed to add this to wp-settings.php:

    if ( get_option('active_premium_plugins') ) {
    	$current_plugins = get_option('active_premium_plugins');
    	if ( is_array($current_plugins) ) {
    		foreach ($current_plugins as $plugin) {
    			if ('' != $plugin && file_exists(ABSPATH . PREMIUMPLUGINDIR . '/' . $plugin))
    				include_once(ABSPATH . PREMIUMPLUGINDIR . '/' . $plugin);
    		}
    	}
    }

    I'll see what I can do about making this into a plugin so core files don't have to be modified.

  7. lunabyte
    Member
    Posted 17 years ago #

    Make sure you're not overriding the variable for the standard plugins as well.

  8. wpvince
    Member
    Posted 17 years ago #

    Hi topherrosado,
    Does your mod give WPMU the same feature for paid options as per wordpress.com now?

    What are the chances that the dev team will include their implementation from Wordpress.com into MU?

    - Vince

  9. suleiman
    Member
    Posted 17 years ago #

    Vince, chances are slim. Outside of the core for what's needed to get MU off the ground, the bulk of the neat features on WP.com are not shared.

    But this excellent community has done a fantastic job of filling the void! We've now got Tags, SiteWide Search, SiteWide RSS, and premimum blogs looks like it's being molded into a plugin now too.

  10. topherrosado
    Member
    Posted 17 years ago #

    Vince, I don't know if it does or not because I don't really know what wordpress.com is offering. My hack simply allows you to offer plugins on a "premium" basis, but it seems to be somewhat buggy with some plugins (not being able to access configuration pages). I'm working on solving that, though.

  11. wpvince
    Member
    Posted 17 years ago #

    Hi,
    Any news on this becoming a plugin yet?
    Or maybe the core WP devs will include it soon ;-)

    Thanks

  12. circuit
    Member
    Posted 16 years ago #

    bump... this would be very useful for me!

  13. awarner20
    Member
    Posted 16 years ago #

    any news yet?

  14. Trent
    Member
    Posted 16 years ago #

    If you don't mind spending the money on the subscription, there is a plugin for premium features over at http://premium.wpmudev.org from Andrew and Farms.

    Trent

  15. awarner20
    Member
    Posted 16 years ago #

    I'm aware of that plugin and eventually I plan on subscribing if need be. However, I am still early in development of my WPMU site and can't afford the monthly payment just yet. Too bad they couldn't somehow offer a one time payment on that plugin, but then how would they control it's usage?

    Anyway, I'm here for the long haul...

  16. andrea_r
    Moderator
    Posted 16 years ago #

    Buuuuut... you can join for a month and still keep the plugin. you just don't get support or updates after that.

    Besides, you do have to spend a little money to make money. :)

About this Topic