Title: Subscription pack info PHP variables
Last modified: July 25, 2021

---

# Subscription pack info PHP variables

 *  Resolved [wouthaksteen](https://wordpress.org/support/users/wouthaksteen/)
 * (@wouthaksteen)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/subscription-pack-info-php-variables/)
 * I am experiencing some issues with the [wpuf-sub-info] shortcode. When I add 
   it to my page, it shows up on the frontend on the top left of the page instead
   of where I put the shortcode.
 * Therefore I want to write some custom PHP code myself to output the pack info
   on the frontend. Could someone provide me the PHP functions I need for this (
   like how to get the current pack name, price and amount of posts left)? I can’t
   seem to find them in the plugin files (I’m kind of a noob in PHP). Thanks!

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

 *  [MM Aurangajeb](https://wordpress.org/support/users/aurangajeb/)
 * (@aurangajeb)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/subscription-pack-info-php-variables/#post-14707239)
 * Hello [@wouthaksteen](https://wordpress.org/support/users/wouthaksteen/)
 * > I am experiencing some issues with the [wpuf-sub-info] shortcode
 * → Firstly, please note the right shortcode is `[wpuf_sub_info]` and here is a
   output from my testing site/page after inserting- [https://prnt.sc/1gpab7n](https://prnt.sc/1gpab7n).
   It should working fine.
 * Besides, you can look into these files/functions references to know how to get
   current_users subscription packs info.
 *     ```
       /wp-content/plugins/wp-user-frontend/class/subscription.php shortcode > 
       wpuf_sub_info & wpuf_sub_pack.
       function reference subscription_info() line 746 and subscription_packs() line 757
       ```
   
 * `/wp-content/plugins/wp-user-frontend/includes/class-user-subscription.php function
   reference current_pack() line no 51-66`
 * I hope this will helps.
    Thanks.
 *  Thread Starter [wouthaksteen](https://wordpress.org/support/users/wouthaksteen/)
 * (@wouthaksteen)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/subscription-pack-info-php-variables/#post-14710088)
 * Thanks for the help. I have tried looking into the code but I cannot seem to 
   find a way to print the info using a PHP snippet. For example, if I would want
   to print the pack name from the php snippet, do you know how I should do that?
 * Something along the lines of
 *     ```
       <?php
       $current_user_id = get_current_user_id();
       $sub_pack = wpuf_get_current_sub( $current_user_id );
   
       echo $sub_pack;
       ?>
       ```
   
 *  [MM Aurangajeb](https://wordpress.org/support/users/aurangajeb/)
 * (@aurangajeb)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/subscription-pack-info-php-variables/#post-14716218)
 * Hi again,
 * If you want to print `Sub Info` through PHP then you can use `do_shortcode` method
   like:
 *     ```
       <?php
           echo do_shortcode ('[wpuf_sub_info]');
       ?>
       ```
   
 * For further developer information, please reach our devs through our [GitHub channel](https://github.com/weDevsOfficial/wp-user-frontend/issues).
   
   Thanks!
 *  Thread Starter [wouthaksteen](https://wordpress.org/support/users/wouthaksteen/)
 * (@wouthaksteen)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/subscription-pack-info-php-variables/#post-14719478)
 * 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?
 *  Thread Starter [wouthaksteen](https://wordpress.org/support/users/wouthaksteen/)
 * (@wouthaksteen)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/subscription-pack-info-php-variables/#post-14730220)
 * 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](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 5 replies - 1 through 5 (of 5 total)

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

 * ![](https://ps.w.org/wp-user-frontend/assets/icon-256x256.gif?rev=2818776)
 * [User Frontend: AI Powered Frontend Posting, User Directory, Profile, Membership & User Registration](https://wordpress.org/plugins/wp-user-frontend/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-user-frontend/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-user-frontend/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-user-frontend/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-user-frontend/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-user-frontend/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [wouthaksteen](https://wordpress.org/support/users/wouthaksteen/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/subscription-pack-info-php-variables/#post-14730220)
 * Status: resolved