Can’t Private Message
-
Hi Greg,
sorry to ask , about the page before that was fine to private message from the advert listing , but after few plugin update or theme update ( not sure ) the message button seem like cannot to work and showing some extra wording ” Responses ”
https://www.greyclublife.com/wp-content/uploads/2020/12/Screen-Shot-2020-12-06-at-8.09.17-PM.png
here is my code in function.php
add_action( “init”, function() {
remove_action( ‘adverts_tpl_single_bottom’, ‘adverts_single_contact_information’ );
}, 200 );add_action( “init”, “only_bp_contact_on_ad_details”, 50 );
function only_bp_contact_on_ad_details() {
remove_action( ‘adverts_tpl_single_bottom’, ‘adverts_single_contact_information’ );
remove_action( ‘adverts_tpl_single_bottom’, ‘adext_contact_form’ );
}add_action(“adverts_post_type”, “customize_adverts_post_type”, 10, 2);
function customize_adverts_post_type( $args, $type = null ) {
if( $type != “advert” ) {
return $args;
}if(!isset($args[“rewrite”])) {
$args[“rewrite”] = array();
}$args[“rewrite”][“slug”] = “Speed-datings”;
return $args;
}add_filter( “adverts_post_type”, function( $args, $post_type ) {
if( $post_type != “advert” ) {
return $args;
}
$args[“name”] = “custom name …”;
$args[“menu_name”] = “custom menu name …”;
$args[“rewrite”][“slug”] = “speed-datings”;
return $args;
}, 10, 2 );add_action(“init”, “my_init_14392”, 20);
function my_init_14392() {
remove_action(‘template_redirect’, ‘adverts_disable_default_archive’);
add_action(‘template_redirect’, ‘my_disable_default_archive’);
}
function my_disable_default_archive() {
if(is_post_type_archive( “advert” ) && ! is_feed()) {
wp_redirect( get_permalink( adverts_config( “ads_list_id” ) ) );
exit;
}
}
add_filter( “wp”, “paying_members_only_init”, 50 );
function paying_members_only_init() {
if( is_singular( ‘advert’ ) && !current_user_can( “edit_posts” ) ) {
remove_action( ‘adverts_tpl_single_bottom’, ‘adverts_single_contact_information’ );
remove_action( ‘adverts_tpl_single_bottom’, ‘adext_contact_form’ );
remove_action( ‘adverts_tpl_single_bottom’, ‘adext_bp_send_private_message_button’, 50 );add_action( ‘adverts_tpl_single_bottom’, “premium_members_only”, 5 );
}
}
function premium_members_only( $post_id ) {
$flash = array( “error” => array(), “info” => array(), “warn” => array() );
$flash[“warn”][] = array(
“message” => __( “只有 Special Member 才能回復PM給灰友,請聯絡MrGrey了解更多。微信:MrGreyKL888, 可以在以下留言Comment您的介紹,對方會PM/私聊你,如果對你有興趣的話,如有興趣貢獻贊助者,我們將會開啟私聊功能以回饋貢獻贊助者,更多詳情請點擊這裡:https://www.mymassage.club/contribution-account/contribution-program/.” ),
“icon” => “adverts-icon-block”
);
adverts_flash( $flash );
}add_action(“adverts_post_type”, “enable_adverts_comments”);
function enable_adverts_comments( $args ) {
$args[“supports”][] = “comments”;
return $args;function print_promoted_badge( $post_id ) {
$pricing_id = get_post_meta( $post_id, “payments_listing_type”, true );
$product = wc_get_product( $pricing_id );
$post = get_post( $post_id );if( ! is_object( $product ) ) {
return;
}if( $post->menu_order < 1 ) {
return;
}if($product->get_price() > 0) {
echo ‘<span class=”promoted-item-badge” style=”position:absolute; top: 5px; right: 5px; background: black; “>Promoted</span>’;
}
}
add_action( “adverts_list_after_title”, “print_promoted_badge” );
add_action( “adverts_tpl_single_top”, “print_promoted_badge” );
add_action( “adverts_tpl_single_details”, “print_promoted_badge” );
}
- The topic ‘Can’t Private Message’ is closed to new replies.