To add extra fields to membership levels, follow this example:
We add a new MESSAGES RESTRICTION and SHOP. The following codes goes to kleo-child/functions.php
This manipulates the text that shows in the memberships page:
COPY CODE
/* These restrictions will appear to be configured in Theme options - 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;
}
If you need more information, follow this thread http://seventhqueen.com/support/forums/topic/membership-levels-price-page