Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying a user's total number of posts and registry date?


  • POS2012
    Participant

    @pos2012

    There are a few things I really always look at when participating in a forum, and that is “role”, “total number of posts” and “registry date” of the ones who answers the topic.

    By looking at those few informations I quickly make up my mind as to how much weight I should put on the persons opinions.

    If the person has 1256 posts and was registered 09.09.2008, then I often would add more weight to that person’s opinions than a person with just 5 posts and registered 04.20.2012…

    So, is there a way to add some php code tp for instance

    wp-content/plugins/bbpress/bbp-theme-compat/bbpress/loop-single-reply.php

    to get:

    - User’s total number of posts

    - User’s registry date

    I was able to get the user’s role by following this:

    http://bbpress.org/forums/topic/displaying-user-role-beside-their-replies

    Thank you :-)

Viewing 6 replies - 1 through 6 (of 6 total)

  • POS2012
    Participant

    @pos2012

    Just want to chime in again:

    In the WP database the table wp_users is where the registry date is. The column is user_registered and I probably need how I would like the date to show?

    I am no programmer, so just have a vague idea how to get the info:

    Probably get the user’s ID, then get the date from the table/ column and row, and then print it in a certain date output?


    perineo
    Participant

    @perineo

    bump
    very interested in this both things


    Daniel Lemes
    Participant

    @daniel_iceman

    To get register date i’m using:

    echo 'Member since: '.date("Y/m/d", strtotime(get_userdata(bbp_get_reply_author_id())->user_registered));

    Still working to show post count, soon i’ll get it ;)


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    For right now, you can use the bbp_get_user_topic_count_raw and bbp_get_user_reply_count_raw functions, respectively. These will eventually be replaced with cached functions, probably using usermeta to keep the counts.


    koendb
    Participant

    @koendb

    
    <?php 
    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());
    ?>
    

    Output:
    Replies: 3
    Topics: 2

    or use

    
    echo 'Messages: ';
    echo bbp_get_user_reply_count_raw(bbp_get_reply_author_id()) + bbp_get_user_topic_count_raw(bbp_get_reply_author_id()); 
    

    Output:
    Messages 5


    FreeWPress
    Participant

    @freewpress

    Hi all, and thanks to @koebdb for tricks, but i have a little question, read this:

    <?php 
    echo '<br>Messages: '.bbp_get_user_post_count(bbp_get_reply_author_id());
    ?>

    This function exist in includes/users/options.php, is written to show all messages from one users, but if you use it return 0…. WHY?

    This is the function:

    /**
     * Output a users total post count
     *
     * @since bbPress (r3632)
     *
     * @param int $user_id
     * @param boolean $integer Optional. Whether or not to format the result
     * @uses bbp_get_user_post_count()
     * @return string
     */
    function bbp_user_post_count( $user_id = 0, $integer = false ) {
    	echo bbp_get_user_post_count( $user_id, $integer );
    }
    	/**
    	 * Return a users total post count
    	 *
    	 * @since bbPress (r3632)
    	 *
    	 * @param int $user_id
    	 * @param boolean $integer Optional. Whether or not to format the result
    	 * @uses bbp_get_user_id()
    	 * @uses get_user_option()
    	 * @uses apply_filters()
    	 * @return string
    	 */
    	function bbp_get_user_post_count( $user_id = 0, $integer = false ) {
    
    		// Validate user id
    		$user_id = bbp_get_user_id( $user_id );
    		if ( empty( $user_id ) )
    			return false;
    
    		$topics  = bbp_get_user_topic_count( $user_id, true );
    		$replies = bbp_get_user_reply_count( $user_id, true );
    		$count   = (int) $topics + $replies;
    		$filter  = ( true === $integer ) ? 'bbp_get_user_post_count_int' : 'bbp_get_user_post_count';
    
    		return apply_filters( $filter, $count, $user_id );
    	}

    Now i have used the second of koendb and it works fine…

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.