芝麻web文件管理V1.00
编辑当前文件:/home/seolotod/critterchoice.com/wp-content/themes/rehub-theme/buddypress/bp_custom.php
displayed_user->id)) ? $bp->displayed_user->id : ''; if($userid){ $totalposts = count_user_posts( $userid, $post_type = 'post' ); $class = ( 0 === $totalposts ) ? 'no-count' : 'count'; } else { $class = 'hiddencount'; $totalposts = ''; } $post_name = rehub_option('rh_bp_user_post_name'); $post_slug = rehub_option('rh_bp_user_post_slug'); $post_position = rehub_option('rh_bp_user_post_pos'); $addnewpage = rehub_option('rh_bp_user_post_newpage'); $editpage = rehub_option('rh_bp_user_post_editpage'); $member_type = rehub_option('rh_bp_user_post_type'); $post_slug = ($post_slug) ? trim($post_slug) : 'posts'; $post_position = ($post_position) ? trim((int)$post_position) : 40 ; $member_type = ($member_type) ? trim($member_type) : ''; $cssid = 'posts'; if($member_type){ $cssid = 'hiddenposts'; $usertype = bp_get_member_type($userid, false); if(!empty($usertype) && is_array($usertype)){ $member_type = explode(',', $member_type); foreach ($member_type as $type) { $type = trim($type); if (in_array($type, $usertype)){ $cssid = 'posts'; break; } } } } $post_text = $post_name .'
'.$totalposts.'
'; bp_core_new_nav_item( array( 'name' => $post_text, 'slug' => $post_slug, 'screen_function' => 'articles_screen_link', 'position' => $post_position, 'default_subnav_slug' => $post_slug, 'item_css_id' => $cssid, ) ); if($addnewpage){ bp_core_new_subnav_item( array( 'name' => esc_html__('Add new', 'rehub-theme'), 'slug' => 'addnew', 'parent_url' => untrailingslashit($bp->displayed_user->domain) . '/'. $post_slug.'/', 'parent_slug' => $post_slug, 'screen_function' => 'articles_screen_link_addnew', 'position' => 20, 'user_has_access' => bp_is_my_profile(), ) ); } if($editpage){ bp_core_new_subnav_item( array( 'name' => esc_html__('Edit', 'rehub-theme'), 'slug' => 'editposts', 'parent_url' => untrailingslashit($bp->displayed_user->domain) . '/'. $post_slug.'/', 'parent_slug' => $post_slug, 'screen_function' => 'articles_screen_link_edit', 'position' => 30, 'user_has_access' => bp_is_my_profile(), ) ); } } if(rehub_option('rh_bp_user_product_name') !=''){ $bp=buddypress(); $userid = (!empty($bp->displayed_user->id)) ? $bp->displayed_user->id : ''; if($userid){ $totalposts = count_user_posts( $userid, $post_type = 'product' ); $class = ( 0 === $totalposts ) ? 'no-count' : 'count'; } else { $class = 'hiddencount'; $totalposts = ''; } $post_name = rehub_option('rh_bp_user_product_name'); $post_slug = rehub_option('rh_bp_user_product_slug'); $post_position = rehub_option('rh_bp_user_product_pos'); $addnewpage = rehub_option('rh_bp_user_product_newpage'); $editpage = rehub_option('rh_bp_user_product_editpage'); $member_type = rehub_option('rh_bp_user_product_type'); $post_slug = ($post_slug) ? trim($post_slug) : 'offers'; $post_position = ($post_position) ? trim((int)$post_position) : 41 ; $member_type = ($member_type) ? trim($member_type) : ''; $cssid = 'products'; if($member_type){ $cssid = 'hiddenproducts'; $usertype = bp_get_member_type($userid, false); if(!empty($usertype) && is_array($usertype)){ $member_type = explode(',', $member_type); foreach ($member_type as $type) { $type = trim($type); if (in_array($type, $usertype)){ $cssid = 'products'; break; } } } } $post_text = $post_name .'
'.$totalposts.'
'; bp_core_new_nav_item( array( 'name' => $post_text, 'slug' => $post_slug, 'screen_function' => 'deals_screen_link', 'position' => $post_position, 'default_subnav_slug' => $post_slug, 'item_css_id' => $cssid, ) ); if($addnewpage){ bp_core_new_subnav_item( array( 'name' => esc_html__('Add new', 'rehub-theme'), 'slug' => 'addnew', 'parent_url' => untrailingslashit($bp->displayed_user->domain) . '/'. $post_slug.'/', 'parent_slug' => $post_slug, 'screen_function' => 'deals_screen_link_addnew', 'position' => 20, 'user_has_access' => bp_is_my_profile(), ) ); } if($editpage){ bp_core_new_subnav_item( array( 'name' => esc_html__('Edit', 'rehub-theme'), 'slug' => 'editproducts', 'parent_url' => untrailingslashit($bp->displayed_user->domain) . '/'. $post_slug.'/', 'parent_slug' => $post_slug, 'screen_function' => 'deals_screen_link_edit', 'position' => 30, 'user_has_access' => bp_is_my_profile(), ) ); } } do_action( 'rh_content_setup_nav_profile' ); } add_action( 'bp_setup_nav', 'rh_content_setup_nav_profile' ); endif; if(!function_exists('articles_screen_link')){ function articles_screen_link() { function articles_screen_content() { $displayeduser = bp_displayed_user_id(); ?>
$displayeduser, 'show' => 12, 'columns' => $columns, 'enable_pagination' => '2' ); if (rehub_option('archive_layout') == 'blog') { echo wpsm_regular_blog_loop_shortcode($args); } elseif (rehub_option('archive_layout') == 'newslist') { $args['type'] = '2'; echo wpsm_small_thumb_loop_shortcode($args); } elseif (rehub_option('archive_layout') == 'communitylist') { echo wpsm_small_thumb_loop_shortcode($args); } elseif (rehub_option('archive_layout') == 'deallist') { echo wpsm_offer_list_loop_shortcode($args); } elseif (rehub_option('archive_layout') == 'grid' || rehub_option('archive_layout') == 'gridfull'){ echo wpsm_grid_loop_mod_shortcode($args); } elseif (rehub_option('archive_layout') == 'columngrid' || rehub_option('archive_layout') == 'columngridfull'){ echo wpsm_columngrid_loop_shortcode($args); } elseif (rehub_option('archive_layout') == 'compactgrid' || rehub_option('archive_layout') == 'compactgridfull'){ echo wpsm_compactgrid_loop_shortcode($args); } elseif (rehub_option('archive_layout') == 'dealgrid' || rehub_option('archive_layout') == 'dealgridfull'){ echo wpsm_compactgrid_loop_shortcode($args); } elseif (rehub_option('archive_layout') == 'cardblog' || rehub_option('archive_layout') == 'cardblogfull'){ echo wpsm_colorgrid_shortcode($args); } else{ echo wpsm_compactgrid_loop_shortcode($args); } ?>
post_content; $content = apply_filters('the_content', $content); echo '
'.$content.'
'; } } add_action( 'bp_template_content', 'articles_screen_link_addnew_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } } if(!function_exists('articles_screen_link_edit')){ function articles_screen_link_edit() { function articles_screen_link_edit_content() { $get_pageid = rehub_option('rh_bp_user_post_editpage'); if($get_pageid){ $get_page = get_post((int)$get_pageid); $content = $get_page->post_content; $content = apply_filters('the_content', $content); echo '
'.$content.'
'; } } add_action( 'bp_template_content', 'articles_screen_link_edit_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } } if(!function_exists('deals_screen_link')){ function deals_screen_link() { function deals_screen_content() { if ( class_exists( 'Woocommerce' ) ) { $displayeduser = bp_displayed_user_id(); ?>
$displayeduser, 'show' => 12, 'columns' => $columns, 'enable_pagination' => '2' ); $current_design = rehub_option('woo_design'); if ($current_design == 'grid') { echo wpsm_woogrid_shortcode($args); } elseif ($current_design == 'gridtwo') { $args['gridtype'] = 'compact'; echo wpsm_woogrid_shortcode($args); } elseif ($current_design == 'gridrev') { $args['gridtype'] = 'review'; echo wpsm_woogrid_shortcode($args); } elseif ($current_design == 'griddigi') { $args['gridtype'] = 'digital'; echo wpsm_woogrid_shortcode($args); } elseif ($current_design == 'deallist') { echo wpsm_woolist_shortcode($args); } elseif ($current_design == 'list'){ echo wpsm_woorows_shortcode($args); } else{ echo wpsm_woocolumns_shortcode($args); } ?>
post_content; $content = apply_filters('the_content', $content); echo '
'.$content.'
'; } } add_action( 'bp_template_content', 'deals_screen_link_addnew_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } } if(!function_exists('deals_screen_link_edit')){ function deals_screen_link_edit() { function deals_screen_link_edit_content() { $get_pageid = rehub_option('rh_bp_user_product_editpage'); if($get_pageid){ $get_page = get_post($get_pageid); $content = $get_page->post_content; $content = apply_filters('the_content', $content); echo '
'.$content.'
'; } } add_action( 'bp_template_content', 'deals_screen_link_edit_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } } /** Example of Group Extension API if ( bp_is_active( 'groups' ) && rehub_option('rehub_bp_group_products') !='') : class Group_Extension_Offers extends BP_Group_Extension { function __construct() { $args = array( 'slug' => 'products', 'name' => 'products', 'nav_item_position' => 105, 'nav_item_name' => rehub_option('rehub_bp_group_products'), ); parent::init( $args ); } function display( $group_id = NULL ) { $creator = bp_get_group_creator_id(); $totaldeals = count_user_posts( $creator, $post_type = 'product' ); if($totaldeals > 0){ include(rh_locate_template('buddypress/groups/single/offers.php')); } } } bp_register_group_extension( 'Group_Extension_Offers' ); endif; **/ /* Get the Resized Cover Image URL otherwise Background styled URL */ if( ! function_exists( 'rh_cover_image_url' ) ) : function rh_cover_image_url( $object_dir, $height, $background = false ) { if( $object_dir == 'members' ) { $item_id = bp_get_member_user_id(); } elseif( $object_dir == 'groups' ) { $item_id = bp_get_group_id(); } else { $item_id = 0; } $get_cover_image_url = bp_attachments_get_attachment('url', array( 'object_dir' => $object_dir, 'item_id' => $item_id ) ); if(!empty($get_cover_image_url)){ } elseif(rehub_option('rehub_bpheader_image') !=''){ $get_cover_image_url = esc_url(rehub_option('rehub_bpheader_image')); } $resized_cover_image_url = ''; if( $get_cover_image_url ) { $resized_cover_image = new WPSM_image_resizer(); $resized_cover_image->src = $get_cover_image_url; $resized_cover_image->height = $height; $resized_cover_image_url = $resized_cover_image->get_resized_url(); } if( $background && $resized_cover_image_url ) { echo 'background-image:url('. $resized_cover_image_url .')'; } else { echo ''.$resized_cover_image_url; } } endif; if( ! function_exists( 'rh_nologedin_add_buttons' ) ) : function rh_nologedin_add_buttons() { if( ! is_user_logged_in() && rehub_option('userlogin_enable') == '1') { ?>
'new_product', 'bp_activity_admin_filter' => esc_html__( 'Published a new product', 'rehub-theme' ), 'bp_activity_front_filter' => esc_html__( 'Products', 'rehub-theme' ), 'contexts' => array( 'activity', 'member' ), 'activity_comment' => true, 'bp_activity_new_post' => '%1$s '.esc_html__( 'posted a new', 'rehub-theme' ).'
'.esc_html__( 'product', 'rehub-theme' ).'
', 'bp_activity_new_post_ms' => '%1$s '.esc_html__( 'posted a new', 'rehub-theme' ).'
'.esc_html__( 'product', 'rehub-theme' ).'
,'.esc_html__( 'on the site', 'rehub-theme' ).' %3$s', 'position' => 100, ) ); } add_action( 'bp_init', 'rh_customize_product_tracking_args' ); add_filter('bp_get_messages_content_value', 'rh_custom_message_placeholder_in_bp_message' ); function rh_custom_message_placeholder_in_bp_message(){ if(!empty($_GET['ref'])){ $content = esc_html__('I am interested in: ', 'rehub-theme').urldecode($_GET['ref']); $content = esc_html($content); } elseif(!empty( $_POST['content'] )){ $content = wp_kses_post($_POST['content']); } else{ $content = ''; } return $content; } if (rehub_option('rh_bp_custom_message_profile') !=''){ function rh_bp_custom_message_profile(){ echo do_shortcode(rehub_option('rh_bp_custom_message_profile')); echo '
'; } add_action('bp_before_profile_loop_content', 'rh_bp_custom_message_profile' ); } function rh_bp_custom_register_membertype(){ ?>
findbyPk($item_id); if(is_array($order)){ list($amount, $currency) = \CashbackTracker\application\components\Commission::calculateCashback($order); $cashback = \CashbackTracker\application\helpers\CurrencyHelper::getInstance()->currencyFormat($amount, $currency); }else{ $cashback = ''; } $text = __('You got new cashback', 'rehub-theme').' - '.$cashback; $memberlink = bp_members_get_user_url( $secondary_item_id).'notifications'; // WordPress Toolbar if ( 'string' === $format ) { $return = apply_filters( 'rh_cashback_point_format_filter', $text, $text, $memberlink, $item_id); // Deprecated BuddyBar } else { $return = apply_filters( 'rh_cashback_point_format_filter', array( 'text' => $text, 'link' => $memberlink, ), $text, $memberlink, $item_id); } return $return; } } add_filter( 'bp_notifications_get_notifications_for_user', 'cashback_point_format_bp_notifications', 10, 5 ); add_action('cbtrkr_order_approve', 'rh_approvedcash_bp_notificator'); function rh_approvedcash_bp_notificator($order) { if(!empty($order) && function_exists('bp_notifications_add_notification')){ $userid = $order['user_id']; $item_id = $order['id']; bp_notifications_add_notification( array( 'user_id' => $userid, 'item_id' => $item_id, 'secondary_item_id' => $userid, 'component_name' => 'rh_cshbackcomponent', 'component_action' => 'rh_cshback_action', 'date_notified' => bp_core_current_time(), 'is_new' => 1, ) ); } } }