Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to get user id of activity

@arcangelgirl

Participant

Thank you for your answers! Looks like that I did not describe clear what is my problem, because what I tried from you suggestions it did not work.

There is the code that I’m using to generate “Give a point” button”

function one_star_points() {
	if ( ! function_exists( 'mycred' ) ) return;
	$current_id = get_current_user_id();
	$profile_id = bp_displayed_user_id();
	if ( $current_id == $profile_id ) return;
	echo '<div class="award-star-rating-img">';
	echo do_shortcode( '[mycred_send to="' . $profile_id . '" amount="1" ref="tip" log="Tipping"]Give a point[/mycred_send]' );
	echo '</div>';
}
add_action( 'one_star_points_button', 'one_star_points' );

To give points in user profile I used $profile_id = bp_displayed_user_id();
To give points in forum I used $profile_user_id = bbp_get_reply_author_id();

But i bumped into a problem when I want to give points to user in activity stream. I placed the button near every activity stream entry, so the user could give a point if the like what other user posted in activity stream. I used this code $profile_video_id = bp_get_activity_user_id(); There is no error or warning, but it’s not working, not giving points.

Also I would like to give a point if I like private message answer that other user send me. I used this $profile_message_id = bp_get_the_thread_message_sender_id() ;, but it says that “Missing the recipient for this shortcode.”.

Looks like that in the last two cases (activity stream and messages) something is wrong with indicating user id.
Any recommendations on this? I have tried many functions, but still can’t grab user ID in those last two..

Skip to toolbar