This topic has 5 replies, 3 voices, and was last updated 6 years by clyn.

  • Author
  • #197610
     clyn
    Participant

    Hi,

    I2m using CPT and registered to buddypress. Post publish show Activity stream show like this “Member A” posted new “CPT” … Code are below.

    1 – Some plugin action show like this on buddypress activiy and notfication “Member A upvoted for CPT with Title” but for same comment activity stream and notfication not shown with title. What can be the problem? Can you help me please…

    COPY CODE
    // allow tracking of our CPT
    
    add_post_type_support( 'job_listing', 'buddypress-activity' );
    
    // creating the dropdown filter on activity and members page
    
    function customize_page_tracking_args_joblist() {
    
    // Check if the Activity component is active before using it.
    
    if ( ! bp_is_active( 'activity' ) ) {
    
    return;
    
    }
    
    bp_activity_set_post_type_tracking_args( 'job_listing', array(
    
    'component_id'             => 'activity', // unique ID
    
    'action_id'                => 'new_job', // new_$post_type where new_ is mandatory
    
    'comment_action_id' => 'new_job_comment',
    
    'bp_activity_comments_admin_filter' => __( 'Comments about job', 'custom-textdomain' ), // label for the Admin dropdown filter
    
    'bp_activity_comments_front_filter' => __( 'Job Comments', 'custom-textdomain' ),        // label for the Front dropdown filter
    
    'bp_activity_new_comment'           => __( '%1$s commented on the <a href="%2$s">Job</a>', 'custom-textdomain' ),
    
    'bp_activity_new_comment_ms'        => __( '%1$s commented on the <a href="%2$s">Job</a>, on the site %3$s', 'custom-textdomain' ),
    
    'bp_activity_admin_filter' => __( 'Published a new job', 'text-domain' ),
    
    'bp_activity_front_filter' => __( 'Job', 'text-domain' ),
    
    'contexts'                 => array( 'activity', 'member' ), // swa & member activity page
    
    'activity_comment'         => true,
    
    'bp_activity_new_post'     => __( '%1$s posted a new <a href="%2$s">Job</a>', 'text-domain' ),
    
    'bp_activity_new_post_ms'  => __( '%1$s posted a new <a href="%2$s">Job</a>, on the site %3$s', 'text-domain' ),
    
    'position'                 => 200,
    
    ) );
    
    }
    
    add_action( 'init', 'customize_page_tracking_args_joblist', 1000 );

    Also i visited and follow and tested below codes but never show comment with post title

    https://gist.github.com/modemlooper/9693b591d8c36288496d

    https://webdevstudios.com/2015/10/06/buddypress-adding-custom-notifications/

    #197611
     clyn
    Participant

    ah this is image for sample

    Attachments:
    You must be logged in to view attached files.
    #197615
     Kieran_SQ
    Moderator

    Hi,

    I will assign this ticket to one of our developers for review to see if they can assist. However this appears to fall under custom development and is likely to not covered within the scope of the support offered with the theme.

    You may need to hire a developer if you are unable to extend third party code to meet your custom code requirements. One of our developers will be in touch with you as soon as they can, Monday to Friday, East European Time.

    Thanks,

    Kieran

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.

    #197622
     clyn
    Participant

    Ok thanks. At the moment this code create buddypress activity with title but still cant find activity stream and notification comment with post title…

    COPY CODE
    function monkey1980_include_post_type_title( $action, $activity ) {
    	if ( empty( $activity->id ) ) {
    		return $action;
    	}
    
    	if ( 'new_mot' != $activity->type ) {
    		return $action;
    	}
    	
    
    	preg_match_all( '/<a.*?>([^>]*)<\/a>/', $activity->action, $matches );
    
    	if ( empty( $matches[1][1] ) || 'Mot' != $matches[1][1] ) {
    		return $action;
    	}
    
    	$post_type_title = bp_activity_get_meta( $activity->id, 'post_title' );
    
    	if ( empty( $post_type_title ) ) {
    		switch_to_blog( $activity->item_id );
    
    		$post_type_title = get_post_field( 'post_title', $activity->secondary_item_id );
    
    		// We have a title save it in activity meta to avoid switching blogs too much
    		if ( ! empty( $post_type_title ) ) {
    			bp_activity_update_meta( $activity->id, 'post_title', $post_type_title );
    		}
    
    		restore_current_blog();
    	}
    
    	return str_replace( $matches[1][1], esc_html( $post_type_title ), $activity->action );
    }
    add_filter( 'bp_activity_custom_post_type_post_action', 'monkey1980_include_post_type_title', 10, 2 );
    #197797
     Radu
    Moderator

    Hi,
    We cannot offer support for custom code.
    Follow this : https://webdevstudios.com/2015/10/06/buddypress-adding-custom-notifications/ compare you code with this one maybe you had missed something.

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #197806
     clyn
    Participant

    Ok Radu…
    Thanks

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?