• Resolved wouthaksteen

    (@wouthaksteen)


    Hi, I recently opened a question that someone has stated as ‘resolved’. However, it is not resolved and therefore I am adding it again.

    What I am trying to accomplish is something where I can customize what text to show the user. So I want to show them the following sentence:

    ‘You currently have X posts left.’

    In PHP that would translate to

    <?php
    $posts_left = some_function();
    
    echo "<p>You currently have {$posts_left} posts left.</p>";
    ?>

    So essentially what I’m asking is; what php function do I need to get the amount of posts/products left as a variable in php?

    Do you have any idea how this is possible? The shortcode just doesn’t work for me, even after disabling all plugins and custom css/php. It shows up on the top left, outside of the row and column I have put the code into. It is unusable at the moment.

    See how it looks for yourself. https://prnt.sc/1iosmrt.

    I would like to place it underneath the title ‘subscriptions’ but somehow the info is put at the top of my page.

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @wouthaksteen

    I’m not sure how you get the active subscription info output above the page title/header. By default, it always prints the active subscription pack’s info after the page header/title (inside the post/entry-content class). Like below:

    Backend – https://prnt.sc/1md8i1m
    Frontend – https://prnt.sc/1mdac88

    Remember, WPUF doesn’t allow users to use multiple subscriptions packages or subscription pack-up-gradation at a time. So this message will appear on the subscription pack so that the user can cancel the existing pack and purchase another.

    Noteworthy: If you want to change the strings, you can use the translation method, or if your theme supports the sidebar, you can use the shortcode [wpuf_sub_info] to show the current active subscription pack’s details on the sidebar (https://prnt.sc/1mdnrky).

    So essentially what I’m asking is; what php function do I need to get the amount of posts/products left as a variable in php?

    -> Note: As per our support policy, we’re unable to help with a custom solution. Your current situation may need to write a good amount of custom code that we cannot provide. I already shared you our respected file location and functions which facilitate that output. So if you are unable to manipulate according to your own needs, kindly take help from a WordPress Expert or look for help on the StackOverflow.

    Apart from this, if you want to get current users subscription pack’s info you may need to call the respected data like below:

    //using utility
    $sub_pack = wpuf_get_user( get_current_user_id() )->subscription()->current_pack();
    //directly from meta
    $sub_pack = get_user_meta( get_current_user_id(), '_wpuf_subscription_pack', true );

    Since this is a public forum, I’m keeping this thread open for a few more days if anyone wants to help with your custom solution.
    Thanks.

    Hey there!

    This thread has been inactive for a while, so I’m going to mark it Resolved. Please feel free to open a new thread/topic if any other questions arise!

    Regards!🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Subscription pack info’ is closed to new replies.