-
Author
-
September 12, 2017 at 21:05 #173465
psmorrow
ParticipantHi,
I’m experimenting with bbPress, and I am trying to increment an xprofile field with the user’s count of replies when a user adds a reply to a topic. Can you provide an example function to get me started?
Thanks so much in advance for your help!
Pete
September 13, 2017 at 17:42 #173562Laura
ModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 13, 2017 at 21:26 #173586Radu
ModeratorHi,
You can inspire from the next snippet.
COPY CODEfunction update_my_custom_x_profile_bbpress() { global $current_user; get_currentuserinfo(); // echo '<br>Replies: '.bbp_get_user_reply_count_raw(bbp_get_reply_author_id()); // echo '<br>Topics: '. bbp_get_user_topic_count_raw(bbp_get_reply_author_id()); $user_replies_count = bbp_get_user_reply_count_raw(bbp_get_reply_author_id()); $user_topic_count = bbp_get_user_topic_count_raw(bbp_get_reply_author_id()); //xprofile_set_field_data( $field, $user_id, $value, $is_required = false ); xprofile_set_field_data('user_replies_count', $current_user->id, $user_replies_count); xprofile_set_field_data('user_topic_count', $current_user->id, $user_topic_count); } add_action('bbp_new_reply', 'update_my_custom_x_profile_bbpress';)NOTE: I haven’t tested the snippet.
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 14, 2017 at 18:40 #173684Radu
ModeratorYou’re welcome
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Plugins questions’ is closed to new topics and replies.