Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • jvinch – this is the code I use for the Featured Members on the homepage:

    <div class="widget">
    <h2 class="widgettitle"><?php _e( 'Featured Members', 'buddypress' ) ?></h2>

    <?php $users = BP_Core_User::get_random_users( 2, 1 ) ?>

    <?php if ( $users['users'] ) { ?>
    <ul id="featured-member-list" class="item-list">
    <?php foreach( $users['users'] as $user ) : ?>
    <li>
    <div class="item-title"><strong><?php echo bp_core_get_userlink( $user->user_id ) ?></strong></div>
    <div class="item-avatar">
    <a href="<?php echo bp_core_get_userlink( $user->user_id, false, true ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?></a>
    </div>

    <div class="item">
    <!-- div class="item-meta"><span class="activity"><?php echo bp_core_get_last_activity( get_usermeta( $user->user_id, 'last_activity' ), __('active %s ago') ) ?></span></div -->

    <?php if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?>
    <!-- ?php $random_data = xprofile_get_random_profile_data( $user->user_id, true ); ? -->
    <div class="item-title profile-data">
    <strong>About Me: </strong><?php echo BP_XProfile_ProfileData::get_value_byid( 2, $user->user_id ); ?>
    </div>
    <div class="item-title profile-data">
    <strong>RV Type: </strong><?php echo preg_replace('/^.*?"(.*?)".*$/', '$1', BP_XProfile_ProfileData::get_value_byid( 3, $user->user_id ) ); ?>
    </div>
    <?php } ?>
    </div>
    </li>
    <?php endforeach; ?>
    </ul>
    <?php } else { ?>
    <div id="message" class="info">
    <p><?php _e( 'There are no members to feature.', 'buddypress' ) ?></p>
    </div>
    <?php } ?>
    </div>

    I have this on my site using a plugin I wrote for WPMU, I’m working on integrating it into the BP users page but right now it’s just on the WP Write page to set your location for each post. It also tracks users current locations to display them on a Sitewide map.

    I’ll try to get it together to post as a plugin.

    You can take a look at: myrv20.com

    The site is no where near complete but you are welcome to take a look.

    The duplicate posts show up because a different user edited the post, I’m not sure what this is used for, maybe to show posts you contributed to or something..

    Anyway, to remove the duplicate posts all you need to do is add one word to the SELECT statement. Just add DISTINCT between “SELECT” and “p.post.id” so it looks like this: SELECT DISTINCT p.post_id, p.blog_id FROM…

    That will have the query return only one result for the post even though there are two rows in the table.

    The problem with the post showing up even if it is NOT published is because the post was previously save as “published” and has been changed to “unpublished”. The code currently returns if the status is unpublished so the existing entry never gets removed. To fix this you’ll need to edit a few lines in bp-blogs.php.

    Around line 268

    Change this:

    if ( !$post || $post->post_type != 'post' || $post->post_status != 'publish' || $post->post_password != ''")
    return false;

    To this:

    if ( !$post || $post->post_type != 'post')
    return false;

    This change is need to keep us in the process so we can update an existing entry if it’s status has changed.

    Around line 384

    Change this:

    /* Don't record this if it's not a post, not published, or password protected */
    if ( $post->post_type != 'post' || $post->post_status != 'publish' || $post->post_password != '' )
    return false;

    /**
    * Check how many recorded posts there are for the user. If we are
    * at the max, then delete the oldest recorded post first.
    */
    if ( BP_Blogs_Post::get_total_recorded_for_user() >= TOTAL_RECORDED_POSTS )
    BP_Blogs_Post::delete_oldest();

    if ( !BP_Blogs_Post::is_recorded( $post_id, $blog_id ) ) {
    if ( $post->post_status == 'publish' ) {
    $recorded_post = new BP_Blogs_Post;

    To this:

    /* Don't record this if it's not a post */

    if ( $post->post_type != 'post' )
    return false;

    if ( !BP_Blogs_Post::is_recorded( $post_id, $blog_id ) ) {
    if ( $post->post_status == 'publish' ) {
    /* gwrey
    Moved the test for max total records inside this
    block so we will only delete a record IF we are going to add a new one
    */
    /**
    * Check how many recorded posts there are for the user. If we are
    * at the max, then delete the oldest recorded post first.
    */
    if ( BP_Blogs_Post::get_total_recorded_for_user() >= TOTAL_RECORDED_POSTS )
    BP_Blogs_Post::delete_oldest();

    $recorded_post = new BP_Blogs_Post;
    $recorded_post->user_id = $user_id;

    Also needed so we keep going and update any existing entries

    Around line 419

    Change this:

    if ( $post->post_status != 'publish' )
    BP_Blogs_Post::delete( $post_id, $blog_id );

    To this:

    if ( $post->post_status != 'publish' || $post->post_password != '')
    BP_Blogs_Post::delete( $post_id, $blog_id );

    This will delete a post from the BP posts log if it is no longer published or if a password has been added.

    Around line 423

    Change this:

    add_action( 'publish_post', 'bp_blogs_record_post' );

    To this:

    add_action( 'save_post', 'bp_blogs_record_post' );

    This will update the post data any time it is saved, not just when published.

    I’m seeing this error

    jQuery(“ul.first”).autoCompletefb is not a function

    http://domain.com/wp-content/mu-plugins/bp-messages/js/autocomplete/init.php?ver=2.6.5

    Line 4

    I cannot send messages to any user if I type in the username. If I click on “Send Message” from a user’s profile it works fine.

    If I look at the page source, the /wp-content/mu-plugins/bp-messages/js/autocomplete/jquery.autocompletefb.js is being loaded along with the other autocomplete files.

Viewing 4 replies - 1 through 4 (of 4 total)
Skip to toolbar