Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Add the Job Listing Activity support!
- */
- add_post_type_support( 'job_listing', 'buddypress-activity' );
- /**
- * Track New Job Listing Posts.
- */
- function yz_job_listing_tracking_args() {
- // Check if the Activity component is active before using it.
- if ( ! bp_is_active( 'activity' ) ) {
- return;
- }
- // Set Tracking.
- bp_activity_set_post_type_tracking_args( 'job_listing', array(
- 'component_id' => buddypress()->blogs->id,
- 'action_id' => 'new_job_listing',
- 'bp_activity_front_filter' => __( 'Jobs', 'youzer' ),
- 'bp_activity_admin_filter' => __( 'created a new project', 'custom-domain' ),
- 'contexts' => array( 'activity', 'member' ),
- 'activity_comment' => true,
- 'bp_activity_new_post' => __( '%1$s created a new <a href="%2$s">project</a>', 'youzer' ),
- 'bp_activity_new_post_ms' => __( '%1$s created a new <a href="%2$s">project</a>, on the site %3$s', 'youzer' ),
- 'position' => 100,
- 'comment_action_id' => 'new_job_listing_comment',
- 'bp_activity_comments_admin_filter' => __( 'Commented a project', 'youzer' ),
- 'bp_activity_comments_front_filter' => __( 'Job Comments', 'youzer' ),
- 'bp_activity_new_comment' => __( '%1$s commented on the <a href="%2$s">project</a>', 'youzer' ),
- 'bp_activity_new_comment_ms' => __( '%1$s commented on the <a href="%2$s">project</a>, on the site %3$s', 'youzer' ),
- ) );
- }
- add_action( 'bp_init', 'yz_job_listing_tracking_args' );
- /**
- * Get Job Listing Post Content.
- */
- function yz_get_activity_job_listing_body( $content, $activity ) {
- if ( 'new_job_listing' == $activity->type ) {
- $post_content = yz_get_wall_new_post( $activity->secondary_item_id );
- return $post_content;
- }
- return $content;
- }
- add_filter( 'bp_get_activity_content_body', 'yz_get_activity_job_listing_body', 10, 2 );
Add Comment
Please, Sign In to add comment