This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add the code at the end of wplms-customizer.php file in wplms customizer plugin | |
add_shortcode('unit_content_profile_field','vibe_unit_content_profile_field'); | |
function vibe_unit_content_profile_field($atts, $content = null){ | |
extract(shortcode_atts(array( | |
'id' => '', | |
'profile_field' => '', | |
'profile_field_value'=>'', | |
), $atts)); | |
global $post; | |
global $post; | |
if(empty($id)){ | |
$id=$post->ID; | |
} | |
$user_id=get_current_user_id(); | |
$user_profile_field=bp_get_profile_field_data( 'field='.$profile_field.'&user_id=' .$user_id ); | |
if(get_post_type($id)!='unit' || !is_user_logged_in() || !isset( $user_profile_field)) | |
return '[unit_content_profile_field]'; | |
if(isset($profile_field) && isset($user_profile_field) && isset($profile_field_value) && $profile_field_value==$user_profile_field) | |
return apply_filters('the_content',$content); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment