Last active
February 3, 2020 09:57
-
-
Save manchumahara/9ba8eb69305befdd0ba0858548debd51 to your computer and use it in GitHub Desktop.
buddyPress posting for poll vote example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$buddy_post = array( | |
'id' => false, | |
// Pass an existing activity ID to update an existing entry. | |
'action' => sprintf(__( '%s has voted poll: <a target="_blank" href = "%s">%s</a>', 'cbxpollproaddon' ), bp_core_get_userlink( bp_loggedin_user_id() ), esc_url(get_permalink( $poll_id )), esc_attr(get_the_title( $poll_id )) ), | |
// The activity action - e.g. "Jon Doe posted an update" | |
'content' => apply_filters( 'cbxpoll_buddypress_vote_usernote', __( '<blockquote>I have voted on this poll, why not you ?</blockquote>', 'cbxpollproaddon' ), $user_id, $poll_id ), | |
'component' => 'cbxpoll', | |
// The name/ID of the component e.g. groups, profile, mycomponent | |
'type' => 'cbxpoll_vote', | |
// The activity type e.g. activity_update, profile_updated | |
'primary_link' => '', | |
// Optional: The primary URL for this item in RSS feeds (defaults to activity permalink) | |
'user_id' => $user_id, | |
// Optional: The user to record the activity for, can be false if this activity is not for a user. | |
'item_id' => $poll_id, | |
// poll post id | |
'secondary_item_id' => $vote_id, | |
// recorded vote id | |
'recorded_time' => bp_core_current_time(), | |
// The GMT time that this activity was recorded | |
'hide_sitewide' => false, | |
// Should this be hidden on the sitewide activity stream? | |
'is_spam' => false, | |
// Is this activity item to be marked as spam? | |
); | |
bp_activity_add( $buddy_post ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment