Please remove the Online Course from your cart if you wish to make other purchases.' ), esc_url( wc_get_cart_url() ) ); wc_add_notice( $notice, 'notice' ); return false; } } // Trial Product is not in cart or being added. return $passed_validation; } add_filter( 'woocommerce_add_to_cart_validation', 'example_cart_filtering', 100, 2 ); add_shortcode( 'visitor', 'visitor_check_shortcode' ); function visitor_check_shortcode( $atts, $content = null ) { if ( ( !is_user_logged_in() && !is_null( $content ) ) || is_feed() ) return $content; return ''; } function member_only_shortcode($atts, $content = null) { if (is_user_logged_in() && !is_null($content) && !is_feed()) { return $content; } } add_shortcode('member_only', 'member_only_shortcode'); /************************ DONNIE'S CODE SNIPPETS END ******************************/ // Remove WP Version From Styles add_filter( 'style_loader_src', 'sdt_remove_ver_css_js', 9999 ); // Remove WP Version From Scripts add_filter( 'script_loader_src', 'sdt_remove_ver_css_js', 9999 ); // Function to remove version numbers function sdt_remove_ver_css_js( $src ) { if ( strpos( $src, 'ver=' ) ) $src = remove_query_arg( 'ver', $src ); return $src; } // Check Sort Parameters function check_sort_parameters($order) { if ( $order == "" || $order == "ASC" || !isset($order)) { $order_array['order'] = "ASC"; } else { $order_array['order'] = "DESC"; } if ( $order == "" || $order == "ASC") { $order_array['link'] = "DESC"; } else { $order_array['link'] = "ASC"; } return($order_array); } function restrict_level_content_filter( $content ) { if ( current_user_can('administrator') ) { return $content; } $restricted_content_message = '
Sorry, but you do not have permission to view this content.
';
if ( is_page('free-downloadable-level-1-practitioner')) {
$practitioner_level = get_practitioner_level();
if ( in_array( $practitioner_level, array('Level 1 Intern', 'Level 1 Practitioner', 'Level 2 Practitioner', 'Level 3 Practitioner') ) ) {
return $content;
} else {
return $restricted_content_message;
}
}
if ( is_page('free-downloadable-level-2-practitioner')) {
$practitioner_level = get_practitioner_level();
if ( in_array( $practitioner_level, array('Level 2 Practitioner', 'Level 3 Practitioner') ) ) {
return $content;
} else {
return $restricted_content_message;
}
}
if ( is_page('free-downloadable-level-3-practitioner')) {
$practitioner_level = get_practitioner_level();
if ( in_array( $practitioner_level, array('Level 3 Practitioner') ) ) {
return $content;
} else {
return $restricted_content_message;
}
}
// Returns the content.
return $content;
}
function get_practitioner_level() {
$user_id = get_current_user_id();
$practitioner_level = get_user_meta( $user_id, 'practitioner_level', true );
return $practitioner_level;
}
add_filter( 'the_content', 'restrict_level_content_filter', 20 );
require get_stylesheet_directory() . '/woo/qhht-api.php';
// User extra locations
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
|
|
|
Extra Location
Extra City |
|
Extra State |
|
Extra Country |