-
Author
-
September 12, 2017 at 21:05 #173465psmorrowParticipant
Hi,
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 #173562LauraModeratorHello, 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 solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
September 13, 2017 at 21:26 #173586RaduModeratorHi,
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 #173684RaduModeratorYou’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
The forum ‘Plugins questions’ is closed to new topics and replies.