This topic has 4 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #173465
     psmorrow
    Participant

    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

    #173562
     Laura
    Moderator

    Hello, 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 solution

    Laura 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 🙂

    #173586
     Radu
    Moderator

    Hi,

    You can inspire from the next snippet.

    COPY CODE
    
    
    function 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 solution
    #173607
     psmorrow
    Participant

    Thanks!

    #173684
     Radu
    Moderator

    You’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
Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Plugins questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?