Home Forums Theme Support Dokan Need to get User Subscription in PHP

This topic is: not resolved

This topic contains 8 replies, has 2 voices, and was last updated by  Bradley 3 years, 11 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #53726

    Bradley
    Member
    Post count: 5

    I Posted this earlier but have been away and the topic was closed.

    Hi,

    I need to get the Subsciption Package of a Seller.

    We have 3 subscriptions

    Silver, Gold, Elite

    If the User has an ELITE subscription I need to show the Reports tab if ‘else’ (any other or NO subscription) hide the Reports tab.

    I need this similar to the standard wordpress ‘is_user_logged_in()’ and ‘current_user_can()’

    I found this on your forums
    ‘_wpuf_subscription_pack and a parameter inside that named pack_id’

    but am having troubles impmlementing it into this code

    ‘if ( is_page(‘reports’) && ! is_user_logged_in() && ! [need subscription package check here] ) {

    This way I can show only certain tabs to certain user roles or users with a certain subscription.
    Basically – I need WordPress to Check the subscription of a user before ‘echoing' a statement (in this case a menu item on the dashboard) if the user's subscription is not XYZ then it echo's something else (in this case nothing at all just hides the item)

    Thank you.

    #53868

    towhid
    Participant
    Post count: 4505

    Hello Bradley,

    To avail this kind of addition you have to customize the plugin. But I am really sorry to say that we do not provide any customization services. If you need this option very urgently you can hire a developer you can do the customization on your own if you know how to programming.

    Thanks

    #53877

    Bradley
    Member
    Post count: 5

    Hey Towhid.

    Thanks for getting back to us.

    Can you give some direction on where to start with the customisation?

    OR

    Is it possible to assign subscription packs from your subscription plugin specific WordPress user roles?
    For example, when user purchases subscription A they are assigned the WordPress user role (A Subscriber)
    When they purchase subscription B they are assigned the WordPress user role (B Subscriber)
    When they dont renew after the subscription period they are automatically dropped back to WordPress user role (No subscription)

    I appreciate your help in this matter.

    As I said, any direction would be greatly appreciated.

    Thank you.

    #53884

    Bradley
    Member
    Post count: 5

    While your at it, if this ‘customisation' (which I don't believe is really customisation – just asking if you have a hook or filter I can jump on) has to be handled with alterations of Core Dokan Plugin Files.

    Can you please give me instructions on setting up a Template Hierarchy so I am not screwing myself next time your Plugin needs to be Updated.

    Again, Any Help would be Greatly Appreciated.

    Thank you.

    #54179

    towhid
    Participant
    Post count: 4505

    Hello Bradley,

    Try the following documentation which has the list of actions and filters.
    http://docs.wedevs.com/category/plugins/dokan-plugins/developer-documentation-dokan/

    Try the following documentation which depicts how to create a child theme without alternate the core theme.
    http://docs.wedevs.com/category/themes/dokan/child-theme/

    Thanks

    #54181

    Bradley
    Member
    Post count: 5

    Hi Towhid.

    Thank you for your help on this matter.

    We are using the DOKAN PLUGIN not the DOKAN THEME.

    We are using a custom theme and have already setup a child theme for code.

    Is there a Template Structure that the DOKAN PLUGIN uses (not the theme) so that we can modify the Plugins files without affecting the core DOKAN PLUGIN files.

    How I would imagine this working is similar to the WOOCOMMERCE PLUGIN that Dokan Utilises.
    There is a Template hierarchy Structure within WooCommerce that allows you to modify the core plugin files
    by copying them to your active theme directory, this then wont completely kill the site on a plugin upgrade.

    http://docs.woothemes.com/document/template-structure/

    Alternatively, you can edit these files in an upgrade safe way through overrides. Simply copy it into a directory within your theme named /woocommerce, keeping the same file structure, but removing the /templates/ subdirectory.

    What I am asking is if the DOKAN PLUGIN also has a similar template hierarchy setup.

    #54182

    Bradley
    Member
    Post count: 5

    Is it possible to wrap this code in a filter which checks what subscription (Dokan Subscriptions Plugin) a user has?

    /**
     * Unset an item from the menu
     *
     * @param  array  $urls
     *
     * @return array  
     */
    function prefix_dokan_add_seller_nav( $urls ) {
         
        unset( $urls['reviews'] );
     
        return $urls;
    }
     
    add_filter( 'dokan_get_dashboard_nav', 'prefix_dokan_add_seller_nav' );
    #54413

    towhid
    Participant
    Post count: 4505

    Hello Bradley,

    To customize the Dokan templates, you have to make a folder named dokan inside your theme folder and place files in it.

    Like the store.php file is now located inside “wp-content/plugins/dokan-plugin/templates” folder.
    So you have to copy that file and place in “wp-content/themes/yourtheme/dokan/” and do the customization.

    Thanks 🙂

    #55392

    Bradley
    Member
    Post count: 5

    Thank you thats great.

    I have yet to try this but im sure it will work.

    Thank you.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Need to get User Subscription in PHP’ is closed to new replies.