Supporter

Is there anyway to limit the use of this plugin to supporters or plans in the future to implement it?

  • LCDist
    • The Incredible Code Injector

    in pro blogs... ya that opens up a form to email whoever you have set as the support email... I was just liking the plugin "Support System" since it has the ticket system as well as FAQ Although offering the tickets to everyone and allowing supporters the ability to email support directly may be a nice idea too that way you can answer emails faster and get to tickets as you can

  • Mason
    • DEV MAN’s Sidekick

    Hiya LCDist,

    Something like this could be built into the plugin. We've done it for the wiki plugin - so you could use this as a template. Check lines 16-33 of wiki.php. You could modify this and embed it in incsub-support.php around line 25.

    It's custom work, but should get the job done. Thanks!

  • LCDist
    • The Incredible Code Injector

    so could I go like this

    if ( function_exists('is_supporter') && !is_supporter()) {
    add_action('init', 'incsub_support_init');
    add_action('admin_menu', 'incsub_support_menu');
    }
    else {
    add_action('init', 'incsub_support_init');
    add_action('admin_menu', 'incsub_support_menu');
    }

    add_action('network_admin_menu', 'incsub_support_network_menu');

    that would go in place of

    add_action('init', 'incsub_support_init');
    add_action('admin_menu', 'incsub_support_menu');
    add_action('network_admin_menu', 'incsub_support_network_menu');

    I admit I know next to nothing about php so if I just made an ass of myself sorry but seems to me that would make sense lol

  • LCDist
    • The Incredible Code Injector

    so I gave it a try... it does remove the menu items from nonsupporter sites.... unfortunatly it does the same from supporters as well lol

    if ( function_exists('is_supporter') && !is_supporter()) {
    add_action('init', 'incsub_support_init');
    add_action('admin_menu', 'incsub_support_menu');
    } Else {
    }
    add_action('network_admin_menu', 'incsub_support_network_menu');

    any ideas how I should change that?

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    I don't have an install to test this on properly, but I'd probably do it as follows for lines 41-61:

    if ( function_exists('is_supporter') && !is_supporter()) {
    	    function incsub_non_supporter_page() {
    		?>
    		<h3><?php _e('Pro Only...', 'incsub_wiki'); ?></h3>
    		<script type="text/javascript">
    		window.location = '<?php echo get_admin_url(); ?>supporter.php';
    		</script>
    		<?php
    	    }
    
    	    function incsub_non_suppporter_admin_menu() {
    		add_menu_page(__(' Premium Support', 'incsub_wiki'), __('Premium Support', 'incsub_wiki'), 'edit_posts', 'incsub_wiki', 'incsub_non_supporter_page', null, 30);
    	    }
    
    	    add_action('admin_menu', 'incsub_non_suppporter_admin_menu');
    	} else {
    
    	add_action('init', 'incsub_support_init');
    	add_action('admin_menu', 'incsub_support_menu');
    	add_action('network_admin_menu', 'incsub_support_network_menu');
    	}
  • LCDist
    • The Incredible Code Injector

    Well I tried it and everyone gets access to the support menu still...

    its like its not seeing if ( function_exists('is_supporter') && !is_supporter()) { as a valid function

    if I remove the stuff from else {} it vanishes from everyones page... which tells me its routing everyone through else {} ... so at a guess Id say its problem is in that line somehow.

    ofc Im not a programmer Im just using deductive reasoning lol so I may be wrong :slight_smile:

  • LCDist
    • The Incredible Code Injector

    if ( function_exists('is_supporter') && is_supporter()) {
    add_action('admin_menu', 'incsub_support_menu');
    }
    add_action('network_admin_menu', 'incsub_support_network_menu');

    Still wont work, wont go through the if statement to add the menus... if I add any outside of that if statement the menus are added

    I dont understand why it wont acknowledge that line

  • Mason
    • DEV MAN’s Sidekick

    Hiya LCDist,

    Using Aaron's code, I have the following on lines 38-47 of incsub-support.php. Can you verify that this is the same as yours?

    update_site_option('incsub_support_version', INCSUB_SUPPORT_VERSION);
    	}
    
    	add_action('init', 'incsub_support_init');
    
    	if ( function_exists('is_supporter') && is_supporter()) {
    	add_action('admin_menu', 'incsub_support_menu');
    	}
    
    	add_action('network_admin_menu', 'incsub_support_network_menu');

    Let us know. Thanks! (Edited as copy/paste error)

  • LCDist
    • The Incredible Code Injector

    Yep... it looks the same, even copy and pasted your code again in case I missed a , or somthin

    update_site_option('incsub_support_version', INCSUB_SUPPORT_VERSION);
    }

    add_action('init', 'incsub_support_init');

    if ( function_exists('is_supporter') && is_supporter()) {
    add_action('admin_menu', 'incsub_support_menu');
    }

    add_action('network_admin_menu', 'incsub_support_network_menu');

    if ( version_compare($wp_version, '3.0.9', '>') ) {

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    Sorry, but I don't actually know why this isn't working for you. This same code should work with pro-sites, but I just ran a test with this implemented in the supporter version and everything works exactly right.

    Are you sure you're looking at a non-supporter site to verify that the menu isn't there?

    Thanks.

  • LCDist
    • The Incredible Code Injector

    The problem isint that it dosent remove the sites from non supporter sites... the problem is it removes it from everyone but network admin menu

    if ( function_exists('is_supporter') && is_supporter()) {
    	add_action('admin_menu', 'incsub_support_menu');
    	}

    Its like it either doesent see this line or it cant process it but thats the problem... it dosent allow anyone to go through that if statement... non supporters and supporters alike

  • Mason
    • DEV MAN’s Sidekick

    Hiya LCDist,

    I'm totally stumped. I have it working correctly on one of my test installs. WordPress 3.2.1 multisite, Supporter 2.2.8, and support system 1.6.7. Can you verify your version numbers are all up to date?

    I'm attaching my copy of incsub-support.php here as well. Try just overwriting you file and see if it makes a difference somehow.

    Thanks!

  • LCDist
    • The Incredible Code Injector

    Installed yours and still nothin... Im half tempted to wipe and try again and start with problogs and this and work out form there to see where the problem is lol

    as for versions I have WP 3.2.1 multi, Problogs 3.0rc1 and support 1.6.7

  • LCDist
    • The Incredible Code Injector

    ok update... I decided to be crazy and tried if ( function_exists('is_supporter()') ) {
    add_action('admin_menu', 'incsub_support_menu');
    }

    Still wont pass through that line... so its not seeing the function is_supporter()

    is there a different problogs equivalent maybe, I know its suppose to work in problogs but Im runnin out of ideas

  • LCDist
    • The Incredible Code Injector

    Well I figured the issue out and its working properly now.... wasnt anything I did wrong or you did wrong... it was simple load order.

    My guess is the older supporter by being installed in muplugins and such it was given loading priority above all else... well now its in the normal plugins folder and it competes alphebetically for load time.

    Basically what that means is when we were calling the function if is_supporter exists... well it returned that it didnt exist cause well... it didnt yet. Problogs had yet to be loaded... it was next in queue basically.

    Least t hats what Im assuming cause when I changed the folder from inscub-support to zincsub-support everything started working like a charm.

    I did some more research and a guy in wordpress forums said if you add a function into a plugin itll get priority treatment but I figured Id leave that up to Aaron and the gang since Im guessing if load order can effect this plugin it can probably impact a lot more then my lil problem.

    http://wordpress.org/support/topic/how-to-change-plugins-load-order
    theres the post that I found on how to mess with load order.

    Edit* of course markepress has no issues so I dunno maybe it wasnt load order...maybe changeing folder names did somthin else... but still you guys are smarter then I am so you can draw your own conclusions lol

  • Aaron
    • CTO

    Good catch! Basically from now on you need to call is_supporter() inside of hooks to make sure they only run after the 'plugins_loaded' action. There isn't really another way around this other than changing calling code to best practice.

    So for example in the top of the incsub_support_menu() function add:

    if ( function_exists('is_supporter') && is_supporter())
         return;
  • Mason
    • DEV MAN’s Sidekick

    LCDist, I just did a celebratory toast for ya (it's coffee.... but it's still morning here). I'm glad to see this finally sorted for you :smiley:

    Thanks so much for reporting your findings here as well. It'll help us support other folks down the line :slight_smile:

  • retos
    • Design Lord, Child of Thor

    I understand now that the supporters module has moved into pro sites, the code should be:

    if ( function_exists('is_pro_site') && is_pro_site())
    return;

    Could a config flag be added so that admin can decide whether this plugin is for pro sites or for everyone?

  • Mason
    • DEV MAN’s Sidekick

    Could a config flag be added so that admin can decide whether this plugin is for pro sites or for everyone?

    Inside of Pro Sites you can set each plugin to a specific 'level' in pro sites. I think that'll do what you're looking for?

    Thanks!

  • LCDist
    • The Incredible Code Injector

    I think hes talking specifically about this plugin which prosites dosent limit... thats why I had to put that line of code in to make it register prosites.....

    That line of code shouldnt be put in if you dont want to limit it to prosites users so I dont know why you would need the admin level menu... however it is possible, youd have to have more code then the lil hack im using for it, which unfortunately is way beyond my level of programming.

    and as for the prosite function I think the line would be somthing like this

    if ( function_exists('is_pro_site') && is_pro_site($blog_id=false, $level=1)

    that way you could set what lvl of pro site gets the support system... but if you want all pro site users to have it the original is_supporter works just fine too... I have it working in my setup with prosites.

    least I think thats what you were asking.

    Also note the return thing wasnt working for me so I was using the code from above that that you enter into the php file if you scroll up you should see some lines like the following:

    if ( function_exists('is_supporter') && is_supporter()) {
    add_action('admin_menu', 'incsub_support_menu');
    }

    then I had to rename my directory to zincsub Im sure its possible another way it just didnt work for me and I have higher priority issues then to worry about a directory name atm lol.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.