checking member level via php

could a dev drop in and give me the function I could use to verify if a user has a specific valid subscription?

i didn't really like the idea of having just a masked download link (couldn't get it to work but i'm guessing you're using http redirects, right?) so I wrote a little script that allows me to store files behind my server root and only allowing subscribers to download.

One major limitation is I can't limit downloads to a specific subscription. knowing the above would help and maybe allow me to contribute something to this :slight_smile:

  • Jonathan
    • The Incredible Code Injector

    @Marcus,

    I'm not a dev, just a user as yourself, but I've been using these functions with huge success in restricting access via custom template/code and even sub-blogs.

    current_user_is_member()
    current_user_on_level($level_id)
    current_user_on_subscription($sub_id)

    Cheers,
    Jonathan

  • DavidM
    • DEV MAN’s Mascot

    Thanks for posting that Jonathan! Gave ya a few rep points for the helpful tip. :slight_smile:

    And just for reference for anyone intending on using those functions, the ids can be found by simply hovering your mouse over the membership levels or subscriptions when in the lists at either Membership > Levels or Membership > Subscriptions.

    Thanks,
    David

  • sam_skirrow
    • Flash Drive

    Hi,
    I'm seeing alot about this code here:
    current_user_is_member()
    current_user_on_level($level_id)
    current_user_on_subscription($sub_id)

    And think it is precisely what I need, i'm jut wondering if you could quickly develop on how I would use it to restrict content based on user level id.

    For example, I have this content:
    <?php echo get_property_price($post->ID);?>

    how can I make it so that this is revealed to someone with a level ID of 17?

    Thanks for your help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.