The Partner Discounts page is located at the University Site. Links to it can be found at University and GBES.COM via the BuddyPanel and “Resources” menus, respectively. The page is publicly accessible, but features content that is available only to logged in members.

The page is enabled via Elementor templates, including a Loop Grid built around a custom post type – Partners (partner) – and Partner Flipbox Item template. It also depends on an Advanced Custom Fields interface, with custom code in gbes-university/buddyboss/partners-page.php).

Listings can be viewed and added or edited in the post-type editor at Partners.

				
					/** 
 * Partners Page Flipbox Shortcodes, front and back
 */
add_shortcode( 'partners-box-front', 'partners_box_front_handler' ) ;
function partners_box_front_handler() {
	
	$post_id = get_the_ID() ; 
	$user_id = get_current_user_id() ; 
	
	ob_start() ; 
	
	$image = get_field( 'partner_image', $post_id );
	$size = 'medium'; // (thumbnail, medium, large, full or custom size)
	
	echo '<div class="partner-box__wrapper">' ; 
	
	if( $image ) {
		echo wp_get_attachment_image( $image, $size );
	}
	
	echo '<p class="partner-content">' ; 
	echo get_field( 'public_content', $post_id ) ;
	echo '<br />' ; 
	//custom function, to parse for specific group access type 
	//remove gbesu_has_learning_hub_level_access to test for logged_in status
	if ( $user_id && gbesu_has_learning_hub_level_access( $user_id ) ) :
	echo get_field( 'customer_only', $post_id ) . '<br /><span class="how-to-use">How to use <i class="fa-duotone fa-solid fa-arrow-right-arrow-left"></i></span>' ;
	elseif ( $user_id ) : 
	echo '<br />Subscriber Only' ; 
	else:  
	echo '<br />Log In to View Offer' ; 
	endif ; 
	echo '</p>' ;
	echo '</div>' ;
	
	return ob_get_clean() ; 
	
}
add_shortcode( 'partners-box-back', 'partners_box_back_handler' ) ;
function partners_box_back_handler() {
	
	$post_id = get_the_ID() ; 
	$user_id = get_current_user_id() ; 
	$target_icon = get_field( 'target', $post_id ) ? ' <i class="fa-duotone fa-solid fa-arrow-up-right-from-square"></i>' : '' ;
	
	ob_start() ; 
	
	echo '<div class="partner-box__wrapper partner-box-back__wrapper">' ;
	echo '<p class="partner-content">' ; 
	echo get_field( 'public_content_back', $post_id ) ;
	echo '<br />' ; 
	if ( $user_id && gbesu_has_learning_hub_level_access( $user_id ) ) :
	echo get_field( 'customer_only_back', $post_id ) . $target_icon ; 
	elseif ( $user_id ) : 
	//echo '<a href="' . network_home_url(). 'catalog/subscription/product-gbes-subscriptions/">Subscriber Only</a>' ; 
	echo 'Subscriber Only' ;
	else:
	echo 'Log in to View Offer' ; 
	endif ; 
	echo '</p>' ;
	echo '</div>' ;
	
	return ob_get_clean() ; 
	
}
/** 
 * @dependencies ACF custom field group_access_type, Learndash Groups
 */
function gbesu_has_learning_hub_level_access( $user_id ) {
	
	$group_ids = learndash_get_users_group_ids( $user_id ) ;
	foreach( $group_ids as $group_id ) {
		
		$access_type = get_field( 'group_access_type', $group_id ) ;
		if ( in_array( $access_type, array( 'group_pro_access', 'group_core_access', 'full_access' ) ) ) {
			
			return true ; 
			
		}
		
	}
	
	return false ; 
	
}

				
			

Related Posts