Need to get User Subscription in PHP

This topic contains 8 reply and 2 voices, and was last updated by Bradley 8 years, 9 months ago
Viewing 8 Posts - 1 through 8 (of 8 total)
Author Posts
June 30, 2015 at 2:24 pm 53726
Bradley 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.
July 1, 2015 at 12:28 pm 53868
towhid towhid

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

July 1, 2015 at 1:15 pm 53877
Bradley Bradley

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.

July 1, 2015 at 1:52 pm 53884
Bradley Bradley

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.

July 4, 2015 at 9:42 am 54179
towhid towhid

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

July 4, 2015 at 10:09 am 54181
Bradley Bradley

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.

July 4, 2015 at 10:11 am 54182
Bradley Bradley

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' );
July 6, 2015 at 12:57 pm 54413
towhid towhid

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 🙂

July 13, 2015 at 12:03 pm 55392
Bradley Bradley

Thank you thats great.

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

Thank you.

Viewing 8 Posts - 1 through 8 (of 8 total)