Custom Restrictions for Private Content

Enable your own restriction rules for private content shortcode and enahnce the flexibility of restrictions.

Enable Custom Rules for Private Content

You can define your own custom rules for the private content shortcode. Use the following shortcode for defining restrictions.
[upme_private custom_restriction_key='profile_staus'  custom_restriction_value='active'  ] Place member only content here[/upme_private]

Use unique value for custom_restriction_key and define the restriction values through custom_restriction_value. Then you can implement the restrictions as shown in the following filter implementations.

Filter

– upme_validate_private_content, upme_private_content_restriction_info

Description

– Enable custom restriction rules on private content shortcode.

Parameters

– Status for allowed/not allowed, Various parameters( user_id => ‘User ID’ , value => ‘Restriction rule value’ , key => ‘Restriction rule key’)

Usage
add_filter( 'upme_validate_private_content', 'upme_validate_private_content', 10 ,2);
function upme_validate_private_content($status,$params){
	global $upme_private_content;

	$user_id = isset($params['user_id']) ? $params['user_id'] : 0;
	$key 	 = isset($params['key']) ? $params['key'] : '';

	switch($key){
		case 'profile_staus':
			$value = isset($params['value']) ? $params['value'] : '';

			if($value == strtolower(get_user_meta($user_id,'upme_user_profile_status',true))){
				$status = true;
			}else{
				$status = false;
			}
			break;
		default:
			break;
	}

	return $status;
}

add_filter('upme_private_content_restriction_info','upme_private_content_restriction_info',10,2);
function upme_private_content_restriction_info($display,$params){
	if($params['restriction_type'] == 'profile_staus'){
		$display = "This content is only available for active profile status";
	}
	return $display;
}

Get your copy of User Profiles Made Easy on CodeCanyon