Using is_supporter function for pro sites

Hi,

Can anybody explain how to use is_supporter() for filtering different content for pro site member levels?

Thx

  • Philip John
    • DEV MAN’s Apprentice

    Hiya!

    The is_supporter() function can be used in many contexts to provide a different experience to supporters than non-supporters.

    For example, this code will show a message in the admin to supporters;

    function supporter_thanks(){
    if (is_supporter()){
    echo '<div id="message" class="updated fade"><p>Thanks for being a supporter! You're a lovely person.</p></div>';
    }
    }
    add_action('admin_notices', 'supporter_thanks');

    Hope that helps!

    Phil

  • webezy
    • Site Builder, Child of Zeus

    Hi Phil,

    Thanks for that but can you set filters for the different levels. I have a Pro Gold, Pro Silver and Pro Bronze levels. How can I create a statement that shows only info for that Pro level. What would the syntax be?

  • LCDist
    • The Incredible Code Injector

    youd want the function like this is_pro_site($blog_id=false, $level=1)

    as for integrating that into a line Im by no means an expert and probably have it wrong but it would be somthin like:

    if is_pro_site($blog_id=false, $level=1) {

    echo ‘level 1’

    }

    if is_pro_site($blog_id=false, $level=2) {

    echo ‘level 2’

    }

    if is_pro_site($blog_id=false, $level=3) {

    echo ‘level 3’

    }

    I may be wrong like I said but as far as I understand it would be somthin along those lines… you would need the is_pro_site however since it looks like you have 3 levels… the is_supporter just returns a true or false on if someone is a supporter of any level

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.