Skip to:
Content
Pages
Categories
Search
Top
Bottom

create a group activity when a new custom type post is created


  • sk_tamilan
    Participant

    @sk_tamilan

    WordPress Version 4.1
    BuddyPress Version Version 2.1.1

    I have created a custom field called location under a custom post type called rewards.
    I have also created groups which have these location names.

    I want to be able to create a group activity stream whenever a user posts a new reward and have been trying hours to get this to work.

    $group_id = (int) BP_Groups_Group::group_exists($group_name); //working

    I am using a custom bp_activity_before_save action when the post type is reward. Could you please tell me how I can change the action as such : –

      $activity_group_action = sprintf( __( '%1$s has created a new reward %2$s in the group  %3$s :  %5$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>','<a href="' . bp_get_group_permalink( $group_id ) . '">' .$group_id .": ". esc_attr( bp_get_group_name( $group_id ) ) . '</a>' );
            

    and then add this to the groups activity feed whenever a new reward post is created whereby the location name custom field matches with the groups name. I tried using the bp_activity_add function but its not working

    Thank you

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘create a group activity when a new custom type post is created’ is closed to new replies.
Skip to toolbar