Guest User

Untitled

a guest
Mar 22nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * Add the Job Listing Activity support!
  5. */
  6. add_post_type_support( 'job_listing', 'buddypress-activity' );
  7.  
  8. /**
  9. * Track New Job Listing Posts.
  10. */
  11. function yz_job_listing_tracking_args() {
  12.  
  13. // Check if the Activity component is active before using it.
  14. if ( ! bp_is_active( 'activity' ) ) {
  15. return;
  16. }
  17.  
  18. // Set Tracking.
  19. bp_activity_set_post_type_tracking_args( 'job_listing', array(
  20. 'component_id' => buddypress()->blogs->id,
  21. 'action_id' => 'new_job_listing',
  22. 'bp_activity_front_filter' => __( 'Jobs', 'youzer' ),
  23. 'bp_activity_admin_filter' => __( 'created a new project', 'custom-domain' ),
  24. 'contexts' => array( 'activity', 'member' ),
  25. 'activity_comment' => true,
  26. 'bp_activity_new_post' => __( '%1$s created a new <a href="%2$s">project</a>', 'youzer' ),
  27. 'bp_activity_new_post_ms' => __( '%1$s created a new <a href="%2$s">project</a>, on the site %3$s', 'youzer' ),
  28. 'position' => 100,
  29. 'comment_action_id' => 'new_job_listing_comment',
  30. 'bp_activity_comments_admin_filter' => __( 'Commented a project', 'youzer' ),
  31. 'bp_activity_comments_front_filter' => __( 'Job Comments', 'youzer' ),
  32. 'bp_activity_new_comment' => __( '%1$s commented on the <a href="%2$s">project</a>', 'youzer' ),
  33. 'bp_activity_new_comment_ms' => __( '%1$s commented on the <a href="%2$s">project</a>, on the site %3$s', 'youzer' ),
  34. ) );
  35. }
  36. add_action( 'bp_init', 'yz_job_listing_tracking_args' );
  37.  
  38. /**
  39. * Get Job Listing Post Content.
  40. */
  41. function yz_get_activity_job_listing_body( $content, $activity ) {
  42.  
  43. if ( 'new_job_listing' == $activity->type ) {
  44. $post_content = yz_get_wall_new_post( $activity->secondary_item_id );
  45. return $post_content;
  46. }
  47.  
  48. return $content;
  49. }
  50.  
  51. add_filter( 'bp_get_activity_content_body', 'yz_get_activity_job_listing_body', 10, 2 );
Add Comment
Please, Sign In to add comment