| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( !defined( 'ABSPATH' ) ) exit; |
| 4 |
|
| 5 |
|
| 6 |
function wpforo_has_shop_plugin( $userid = 0 ){ |
| 7 |
$profile_url = false; |
| 8 |
if (is_user_logged_in()){ |
| 9 |
// WooCommerce | Account Page URL |
| 10 |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 11 |
$profile_url = get_permalink(get_option('woocommerce_myaccount_page_id')); |
| 12 |
} |
| 13 |
} |
| 14 |
return $profile_url; |
| 15 |
} |
| 16 |
|
| 17 |
function wpforo_has_profile_plugin( $userid = 0 ){ |
| 18 |
$profile_url = false; |
| 19 |
if($userid){ |
| 20 |
// Ultimate Member | Profile Page URL |
| 21 |
if(class_exists('UM_API')){ |
| 22 |
um_fetch_user($userid); $profile_url = um_user_profile_url(); um_reset_user(); |
| 23 |
} |
| 24 |
// BuddyPress | Profile Page URL |
| 25 |
elseif(class_exists('BuddyPress')) { |
| 26 |
$profile_url = bp_core_get_user_domain($userid); |
| 27 |
} |
| 28 |
// Users Ultra | Profile Page URL |
| 29 |
elseif(class_exists('XooUserUltra')) { |
| 30 |
global $xoouserultra; $profile_url = $xoouserultra->userpanel->get_user_profile_permalink($userid); |
| 31 |
} |
| 32 |
// User Pro | Profile Page URL |
| 33 |
if (class_exists('userpro_api')) { |
| 34 |
global $userpro; $profile_url = $userpro->permalink($userid); |
| 35 |
} |
| 36 |
} |
| 37 |
return $profile_url; |
| 38 |
} |
| 39 |
|
| 40 |
function wpforo_seo_clear(){ |
| 41 |
|
| 42 |
if(!wpforo_feature('seo-meta')) return; |
| 43 |
|
| 44 |
if (is_wpforo_page()) { |
| 45 |
remove_action('wp_head','jetpack_og_tags'); // JetPack} |
| 46 |
if (defined('WPSEO_VERSION')) { // Yoast SEO |
| 47 |
remove_action('wp_head','wpseo_head', 20); |
| 48 |
remove_action('wp_head','wpseo_opengraph', 20); |
| 49 |
add_filter( 'wpseo_canonical', '__return_false' ); |
| 50 |
add_filter( 'wpseo_title', '__return_false' ); |
| 51 |
add_filter( 'wpseo_metadesc', '__return_false' ); |
| 52 |
add_filter( 'wpseo_author_link', '__return_false' ); |
| 53 |
add_filter( 'wpseo_metakey', '__return_false' ); |
| 54 |
add_filter( 'wpseo_locale', '__return_false' ); |
| 55 |
add_filter( 'wpseo_opengraph_type', '__return_false' ); |
| 56 |
add_filter( 'wpseo_opengraph_image', '__return_false' ); |
| 57 |
add_filter( 'wpseo_opengraph_image_size', '__return_false' ); |
| 58 |
add_filter( 'wpseo_opengraph_site_name', '__return_false' ); |
| 59 |
add_filter( 'wp_seo_get_bc_title', '__return_false' ); |
| 60 |
add_filter( 'wp_seo_get_bc_ancestors', '__return_false' ); |
| 61 |
add_filter( 'wpseo_whitelist_permalink_vars', '__return_false' ); |
| 62 |
add_filter( 'wpseo_prev_rel_link', '__return_false' ); |
| 63 |
add_filter( 'wpseo_next_rel_link', '__return_false' ); |
| 64 |
add_filter( 'wpseo_xml_sitemap_img_src', '__return_false' ); |
| 65 |
} |
| 66 |
if (defined('AIOSEOP_VERSION')) { // All-In-One SEO |
| 67 |
global $aiosp; |
| 68 |
remove_action('wp_head',array($aiosp,'wp_head')); |
| 69 |
} |
| 70 |
remove_action('wp_head','rel_canonical'); |
| 71 |
remove_action('wp_head','index_rel_link'); |
| 72 |
remove_action('wp_head','start_post_rel_link'); |
| 73 |
remove_action('wp_head','adjacent_posts_rel_link_wp_head'); |
| 74 |
} |
| 75 |
} |
| 76 |
add_action( 'parse_query', 'wpforo_seo_clear' ); |
| 77 |
|
| 78 |
|
| 79 |
?> |