Echo the level of subscription a user is on

Hi,

I have read posts that give these codes:

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

I am trying to Echo the ID for the level of subscription a user has but echoing the above do not seem to be working. What is the exact code to echo the subscription ID? I have tried

echo current_user_on_subscription($sub_id);
and
echo $sub_id;

Please help, this is driving me nuts! haha

  • aristath
    • Recruit

    Hello there @current_user_on_subscription, I hope you're well today!

    The above functions are simply conditional checks.
    They return true or false, they do not return any data other than that.

    I was looking at the plugin code bu couldn't find how to do exactly what you want to achieve.
    As a workaround (though not ideal) you can use something like this:

    <?php
    
    if ( current_user_on_level( '1' ) ) :
      echo '1';
    elseif ( current_user_on_level( '2' ) ) :
      echo '2';
    elseif ( current_user_on_level( '3' ) ) :
      echo '3';
    elseif ( current_user_on_level( '4' ) ) :
      echo '4';
    endif;

    I hope that helps!

    Cheers,
    Ari.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.