This topic has 41 replies, 19 voices, and was last updated 7 years by romanzy.

  • Author
  • #13909
     mckown
    Participant

    How do we add featured items to membership levels on the pricing page? I see where we can hide items such as “Send Private Messages” but we need to be able to add items outside of social features because those are what really makes the difference between a free & paid membership .. such as “Access to Premium Pages” “Free Monthly Downloads” and so on. I don’t mind hardcoding these into the theme or plugin for now .. just need to know what file to alter.

    #14077
     Abe
    Keymaster

    Hi,
    See my example below where I add a new MESSAGES RESTRICTION and SHOP. The following codes goes to kleo-child/functions.php

    This manipulates the text that shows in the memberhips page:

    COPY CODE
    
    
    /* These restrictions will appear to be configured in Sweetdate - Memberships */
    add_filter('kleo_pmpro_level_restrictions', 'kleo_my_levels_checkmarks');
    function kleo_my_levels_checkmarks($settings) {
     
        $settings = array (
    		//NEW RESTRICTION MESSAGES page with name: message
            array(
                'title' => __('Restrict Messages page','kleo_framework'),
                'front' => __('Access messages page','kleo_framework'),
                'name' => 'message'
            ),
    		//NEW RESTRICTION SHOP page with name: shop
            array(
                'title' => __('Restrict Shop page','kleo_framework'),
                'front' => __('Access Shop page','kleo_framework'),
                'name' => 'shop'
            ),
            array(
                'title' => __('Restrict members directory','kleo_framework'),
                'front' => __('View members directory','kleo_framework'),
                'name' => 'members_dir'
            ),
            array(
                'title' => __('Restrict viewing other profiles','kleo_framework'),
                'front' => __('View members profile','kleo_framework'),
                'name' => 'view_profiles'
            ),
            array(
                'title' => __('Restrict access to groups directory','kleo_framework'),
                'front' => __('Access group directory','kleo_framework'),
                'name' => 'groups_dir'
            ),
            array(
                'title' => __('Restrict access to single group page','kleo_framework'),
                'front' => __('Access to groups','kleo_framework'),
                'name' => 'view_groups'
            ),
            array(
                'title' => __('Restrict users from viewing site activity','kleo_framework'),
                'front' => __('View site activity','kleo_framework'),
                'name' => 'show_activity'
            ),
            array(
                'title' => __('Restrict users from sending private messages','kleo_framework'),
                'front' => __('Send Private messages','kleo_framework'),
                'name' => 'pm'
            ),
            array(
                'title' => __('Restrict users from adding media to their profile using rtMedia or bpAlbum','kleo_framework'),
                'front' => __('Add media to your profile','kleo_framework'),
                'name' => 'add_media'
            )
        );
        return $settings;
    }
    

    If you need also to apply restrictions to some links and not just show some text in the levels page, this makes the page restrictions to happen:

    COPY CODE
    
    // restrict profile area - Messages page
    add_action('kleo_pmro_extra_restriction_before_my_profile','kleo_my_custom_restrict1');
    
    function kleo_my_custom_restrict1()
    {
    	//full current url
    	$actual_link = kleo_full_url();
    	//our request uri
    	$uri = str_replace(untrailingslashit(home_url()),"",$actual_link);
    
    	//restrict messaging page url
    	if(preg_match("/^\/".bp_get_members_root_slug()."\/". bp_get_loggedin_user_username()."\/messages\/?/", $uri))
    	{
    		
    		$my_restrictions =  array('message' => array(
    				//2 - restrict certain levels. 0 -restrict none; 1 - restrict all
    				'type' => 2,
    				//levels that you apply the restrictions to
    				'levels' => array(2,3),
    				//'not_member' => 1, //restrict users without a membership level
    				//'guest' => 1 // restrict not logged in users
    			)
    		);
    		//We use the name "message" from the new restriction added above
    		kleo_check_access('message',$my_restrictions);
    	}
    }
    
    //Restrict Shop page
    add_filter('kleo_pmpro_match_rules', 'kleo_my_custom_restrict2');
    
    function kleo_my_custom_restrict2($restrictions) {
    	//regular expression for shop page
    	$restrictions["/^\/shop\/?$/"] = array('name' => 'shop');
    	return $restrictions;
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #20888
     Splendor
    Participant

    I need to add this to my job page, the later code could then suffice?

    #20957
     Abe
    Keymaster

    If you have a page, then go to that page edit in wp admin and apply the restrictions from that page. It should look like in the attachment.

    For the restriction to appear in the Levels page then you need to use the first code example

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    Attachments:
    You must be logged in to view attached files.
    #20976
     Splendor
    Participant

    oki, because I added membership levels and I check those but it seems to ignore those. But seems to work on other pages.

    Attachments:
    You must be logged in to view attached files.
    #21143
     Abe
    Keymaster

    Well if it is a special page from a plugin then that could happen and you will have to do some plugin related checks to check for that page and apply the restrictions manually

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #23825
     potion5
    Participant

    Very nice, thank you. I used a custom post type to allow ordinary admins (not developers) to easily change membership features from the admin back-end. I’ve included the code below. However, I do not think that this should be solved using custom post types. Is there a way to hook into the Theme Options -> Membership admin panel and add an editable list of features there instead?

    COPY CODE
    <?php
    /**
     * @package Membership_Features
     * @version 0.1
     */
    /*
    Plugin Name: Membership Features
    Description: Implements a custom post type, "Feature", which replaces the default features used in the membership pricing table of  the <a href="http://themeforest.net/item/kleo-next-level-premium-wordpress-theme/6776630">Kleo Theme</a>. To use, first create new features as required, then enable or disable them in the Theme Options -> Memberships.
    Author: Potion
    Version: 0.1
    */
    
    /**
     * Register custom post type: membership_feature 
     */
    add_action( 'init', 'create_feature_post_type' );
    function create_feature_post_type() {
    	register_post_type( 'membership_feature',
    		array(
    			'labels' => array(
    				'name'               => _x( 'Features' ),
    				'singular_name'      => _x( 'Feature' ),
    				'add_new'            => _x( 'Add New' ),
    				'add_new_item'       => __( 'Add New Feature' ),
    				'edit_item'          => __( 'Edit Feature' ),
    				'new_item'           => __( 'New Feature' ),
    				'all_items'          => __( 'All Features' ),
    				'view_item'          => __( 'View Feature' ),
    				'search_items'       => __( 'Search Features' ),
    				'not_found'          => __( 'No features found' ),
    				'not_found_in_trash' => __( 'No features found in Trash' ),
    				'parent_item_colon'  => '',
    				'menu_name'          => __( 'Features' ),
    			),
    			'public'             => true,
    			'publicly_queryable' => true,
    			'show_ui'            => true,
    			'show_in_menu'       => true,
    			'query_var'          => true,
    			'rewrite'            => array( 'slug' => 'feature' ),
    			'capability_type'    => 'post',
    			'has_archive'        => true,
    			'hierarchical'       => false,
    			'menu_position'      => 120,
    			'supports'           => array( 'title')
    		)
    	);
    }
    
    /**
     * Use membership_feature posts to populate features for Kleo Theme Membership Level Pricing Table
     */
    add_filter('kleo_pmpro_level_restrictions', 'kleo_my_levels_checkmarks');
    function kleo_my_levels_checkmarks($settings) {
    
    	$args = array(
    		'post_type' => 'membership_feature',
    		'posts_per_page' => -1);
    
    	query_posts( $args );
    
    	if (have_posts) {
    	
    		$settings = array ();
    		
    		while (have_posts()) : the_post();
    
    			array_push( $settings, array(
    					'title' => __('Restrict ' . get_the_title(), 'kleo_framework'),
    					'front' => __( get_the_title(), 'kleo_framework'),
    					'name' => basename(get_permalink($post->ID))
    				)
    			);
    			
    		endwhile;
    	}
    
    	wp_reset_query();
    	
        return $settings;
    }
    
    #23845
     Abe
    Keymaster

    Thanks for sharing. We will think of a solution.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #23848
     bwoolley
    Participant

    Plus one for being able to more easily specify the contents of the tables without coding… 🙂

    #24793
     Adam
    Participant

    @abe this seems to only work when user profiles are found at /members/username

    if(preg_match(“/^\/”.bp_get_members_root_slug().”\/”. bp_get_loggedin_user_username().”\/messages\/?/”, $uri))

    what about when root profiles are enabled?

    I tried this:
    if(preg_match(“/^\/”. bp_get_loggedin_user_username().”\/messages\/?/”, $uri))

    but it didn’t work either

    #24801
     Adam
    Participant

    @caitlin

    how to make the custom restrictions match URI when root profiles are enabled?

    getting:
    PHP Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash

    when I try to modify for URLs that do not contain /members/

    #24808
     Adam
    Participant

    /members/, $uri

    it’s always simpler than I think. Well there goes a few hours.

    #24809
     Adam
    Participant

    I meant /messages/, $uri

    #27379
     andpixels
    Participant

    Abe,

    This didn’t really solve the question that was initially asked. Basically, how do you add custom content into the various levels. For example I want to add something in Level 2 & 3 but not Level 1, I should be able to type that content into 2 & 3.

    See attachment showing the variations of each level. How do we do this?

    Attachments:
    You must be logged in to view attached files.
    #27382
     andpixels
    Participant

    Also, I don’t see how the code above changes the permissions for a user level within a Forum for BBPress. Can you update the code above or write a new version that would allow us to select the user level that is able to see a forum page?

    #27384
     andpixels
    Participant

    Solved my last permission issue with the PMPro BBPress Forums security addon.

    #27884
     Parkproductions
    Participant

    How does the example code work if I have 3 membership options and want to add unique features to one box? At the moment it will add a feature to all price tables not just a specific one.

    #28295
     Abe
    Keymaster

    Right now you can’t add a feature to just one level. It appears in all levels. You could write it int he description field from the level edit.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #28313
     Parkproductions
    Participant

    Thanks for the response, I hope this feature can be added to new updates of the theme.

    #29454
     cinechopper
    Participant

    I’m sorry, but I absolutely cannot find the kleo-child/functions.php location to change things. I’m trying to change the membership levels or even just delete them. Can someone help me? I’m a long time WP user but a coding noob.
    Thanks!

    Attachments:
    You must be logged in to view attached files.
    #29802
     moosemanmedia
    Participant

    Up 1, it really seems like natural option that should be available: change features according to the different levels. Using the description field is rather limited (layoutwise…)

    #29845
     Abe
    Keymaster

    @cinechopper you need to upload your child theme in case you haven’t. the full path on your server should be wp-content/themes/kleo-child

    After you define your features they should appear in Theme options – Memberships so you can configure each feature for each level to set if is available or not for that level

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #30096
     cohiba
    Participant

    I would like to add additional user fields after payment. 1. With KLEO theme is this really as easy as just clicking/adding the fields in the user field add edit page? & 2. Is it possible to create drop-down options for user fields?

    Also, is there any way to collect user information prior to subscription payment? Thanks!

    -CG

    #30409
     Abe
    Keymaster

    @cohiba
    Payment process and Paid memberships pro is somehow the same as for Sweetdate so if you want that functionality you will have to implement it yourself.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #30670
     creativesinside
    Participant

    Hi! Just bought this theme! So I am a bit confused! Since there are different membership levels … each one would have different abilities right??? Isn’t that the point?

    So I have to use custom code as in above in order to do this?

    There is not some easy way in the theme?

    They all automatically have the same features?

    #30863
     Abe
    Keymaster

    Hi, after you add the code above to change our default descriptions, you will find them in Theme options – Memberships where you can configure them for each level. Based on your config they will appear checked or greyed out.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #30867
     lchild
    Participant

    Hi!

    I’ve just added the codes above to add options to the Membership Levels, but all restrictions appear on all Levels, without making any distinction regarding the Level for which it was configured…

    What I mean is, they all appear with a checkmark, even if they’re restricted on that specific Level. What can I do?

    Thanks for replying!

    Laura

    #31198
     Abe
    Keymaster

    Well I will just copy/paste my answer above:

    “Hi, after you add the code above to change our default descriptions, you will find them in Theme options – Memberships where you can configure them for each level. Based on your config they will appear checked or greyed out. “

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #31200
     creativesinside
    Participant

    Just wanted to say Thanks!

    #31212
     lchild
    Participant

    Thank you Abe, I’ll try it out right now!!!

    Laura

    #35226
     xsoftweb
    Participant

    @Abe,
    I don’t think it really make sense not to be able to change the membership level content. We are the users, we want something different from the default listing. I support andpixels’ suggestion.

    Each level with different features and content. Please inform your team to work on it as soon as possible.

    #35282
     Abe
    Keymaster

    xsoftweb I don’t think you have read my posts in the topic since it does just that 😉

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #35284
     Parkproductions
    Participant

    what a way to ask for a feature…

    #52571
     khudro-soft
    Participant

    Hi i want to know how can i add extra field such as company name, company address in pmpro registration?

    Please give me a solution asap i am struggling so much .

    Thank You

    #53087
     Abe
    Keymaster

    Hi, you should read this https://github.com/strangerstudios/pmpro-register-helper

    Also if it is our of your tech knowledge scope maybe you will have to hire a developer to implement that

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #65941
     maxhilton
    Participant

    Hi,

    Can I know where can I paste this code ? I’m not good in coding part so please kindly guide me on this. Thanks.

    ——————————————————————————————————-
    <?php
    /**
    * @package Membership_Features
    * @version 0.1
    */
    /*
    Plugin Name: Membership Features
    Description: Implements a custom post type, “Feature”, which replaces the default features used in the membership pricing table of the Kleo Theme. To use, first create new features as required, then enable or disable them in the Theme Options -> Memberships.
    Author: Potion
    Version: 0.1
    */

    /**
    * Register custom post type: membership_feature
    */
    add_action( ‘init’, ‘create_feature_post_type’ );
    function create_feature_post_type() {
    register_post_type( ‘membership_feature’,
    array(
    ‘labels’ => array(
    ‘name’ => _x( ‘Features’ ),
    ‘singular_name’ => _x( ‘Feature’ ),
    ‘add_new’ => _x( ‘Add New’ ),
    ‘add_new_item’ => __( ‘Add New Feature’ ),
    ‘edit_item’ => __( ‘Edit Feature’ ),
    ‘new_item’ => __( ‘New Feature’ ),
    ‘all_items’ => __( ‘All Features’ ),
    ‘view_item’ => __( ‘View Feature’ ),
    ‘search_items’ => __( ‘Search Features’ ),
    ‘not_found’ => __( ‘No features found’ ),
    ‘not_found_in_trash’ => __( ‘No features found in Trash’ ),
    ‘parent_item_colon’ => ”,
    ‘menu_name’ => __( ‘Features’ ),
    ),
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘show_in_menu’ => true,
    ‘query_var’ => true,
    ‘rewrite’ => array( ‘slug’ => ‘feature’ ),
    ‘capability_type’ => ‘post’,
    ‘has_archive’ => true,
    ‘hierarchical’ => false,
    ‘menu_position’ => 120,
    ‘supports’ => array( ‘title’)
    )
    );
    }

    /**
    * Use membership_feature posts to populate features for Kleo Theme Membership Level Pricing Table
    */
    add_filter(‘kleo_pmpro_level_restrictions’, ‘kleo_my_levels_checkmarks’);
    function kleo_my_levels_checkmarks($settings) {

    $args = array(
    ‘post_type’ => ‘membership_feature’,
    ‘posts_per_page’ => -1);

    query_posts( $args );

    if (have_posts) {

    $settings = array ();

    while (have_posts()) : the_post();

    array_push( $settings, array(
    ‘title’ => __(‘Restrict ‘ . get_the_title(), ‘kleo_framework’),
    ‘front’ => __( get_the_title(), ‘kleo_framework’),
    ‘name’ => basename(get_permalink($post->ID))
    )
    );

    endwhile;
    }

    wp_reset_query();

    return $settings;
    }
    ——————————————————————————————————–

    #65961
     Abe
    Keymaster

    Hi @maxhilton
    please don’t paste long text files here and instead attach them as text files. That is probably a wordpres plugin from the header so you can add it as a plugin on your site. Alternatively the code can be added to child theme/functions.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #122545
     zzkamikazezz
    Participant

    Hi

    I am just wondering if there is now a way to do this?
    I would like my membership pricing table to look like this:

    Free User:-
    Create events to share
    Search events
    Personal profile page
    VIEW MEMBERS DIRECTORY
    VIEW MEMBERS PROFILE
    ACCESS GROUP DIRECTORY
    ACCESS TO GROUPS
    SEND PRIVATE MESSAGES (Greyed out)
    ADD MEDIA TO YOUR PROFILE (Greyed out)
    Access to member only discounts (grey out, this will link to a protected page with discount codes)

    Supporter:-
    Create events to share
    Search events
    Personal profile page
    VIEW MEMBERS DIRECTORY
    VIEW MEMBERS PROFILE
    ACCESS GROUP DIRECTORY
    ACCESS TO GROUPS
    SEND PRIVATE MESSAGES
    ADD MEDIA TO YOUR PROFILE
    Access to member only discounts
    Help keep the site up and running (this item is unique to this membership type in the table)

    #122567
     Abe
    Keymaster

    @zzkamikazezz please follow the example I have given here: https://archived.seventhqueen.com/forums/topic/membership-levels-price-page?bbp_reply_to=14077&_wpnonce=b440ba9eea#new-post

    You will need a bit of programming knowledge. try to contact a programmer/developer to help if you need to make custom changes

    All the best

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #122574
     zzkamikazezz
    Participant

    Hi, that link you shared links to this page and the post new topic section, was that intended or is there more info in another thread you can share?

    Thanks

Viewing 40 posts - 1 through 40 (of 42 total)

The topic ‘Membership Levels add extra fields’ is closed to new replies.

Log in with your credentials

Forgot your details?