Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • mykrabuilding
    Participant

    @mykrabuilding

    thanks again Henry! this is working but its pulling the same date for the two different users Im currently displaying. I dont feel right about using up your time for free, so Im talking to the boss about whether I can get a budget to spend on getting this coded properly. Are you up for freelance work?
    cheers


    mykrabuilding
    Participant

    @mykrabuilding

    i noticed the “buddypress sitewide activity widget” plugin achieves what I want to do but I cant figure out how despite crawling through the code for hours…


    mykrabuilding
    Participant

    @mykrabuilding

    still struggling with this one!


    mykrabuilding
    Participant

    @mykrabuilding

    thanks henry – gave it a crack and unfortunately got: Fatal error: Cannot use string offset as an array
    appreciate your help! ill keep trying to wrap my head around it and let you know if I work it out
    cheers


    mykrabuilding
    Participant

    @mykrabuilding

    i think i am! ive created a function in functions.php as follows:

    /**
      * get user last update timestamp
      */
    function get_user_last_update_timestamp() {
    	$update = get_usermeta( bp_get_member_user_id(), 'bp_latest_update' );
    	$activity = bp_activity_get_specific( array( 'activity_ids' => $update['id'] ) );
    	$activity = $activity[0];
    	$time = $activity->recorded_time;
    	echo $time;
    }

    and im calling it from my page template (which contains a stripped down version of the code from the members-loop.php file) as follows:

    <?php
    /*
    Template Name: In Out Page
    */
    ?>
    <?php get_header(); ?>
    <div class="sleeve_main">
    	<div id="main">
    		<h2><?php the_title(); ?></h2>
    <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
        <?php do_action( 'bp_before_directory_members_list' ); ?>
      <ul id="members-list" class="item-list" role="main">
      <?php while ( bp_members() ) : bp_the_member(); ?>
         <li>
          <div class="item-avatar">
             <?php bp_member_avatar(); ?>
             <?php bp_member_name(); ?>
          </div>
           <div class="item">
            <div class="item-title">
                <?php if ( bp_get_member_latest_update() ) : ?>
                   <span class="update"><?php bp_member_latest_update(array( 'view_link' => false )); ?></span>
                <?php endif; ?>
            </div>
            <div class="item-meta"><span class="activity"><?php get_user_last_update_timestamp(); ?></span></div>
            <?php do_action( 'bp_directory_members_item' ); ?>
            </div>
            <div class="action">
                <?php do_action( 'bp_directory_members_actions' ); ?>
           </div>
           <div class="clear"></div>
       </li>
     <?php endwhile; ?>
     </ul>
     <?php do_action( 'bp_after_directory_members_list' ); ?>
     <?php bp_member_hidden_fields(); ?>
    <?php else: ?>
       <div id="message" class="info">
          <p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p>
       </div>
    <?php endif; ?>
    		</div> <!-- main -->
    </div> <!-- sleeve -->
    <?php get_footer(); ?>

    mykrabuilding
    Participant

    @mykrabuilding

    Thanks again @henrywright!
    unfortunately being only intermediate with php and new to buddypress Im still having trouble getting this to work. Ive tried creating a new function with the code you provided and calling it from my template page, also tried including the code directly into the template but no luck so far. Any other tips you could give me?
    Cheers


    mykrabuilding
    Participant

    @mykrabuilding

    Thanks for your quick reply Henry!
    What youre saying makes sense however Im sure there must be a way to do this! When I look in the mysql database theres a table named bp_activity in which I can see the users status updates stored with type “activity_update”. In another column there is the date recorded. The member loop must be pulling the text for the last status update from this table, I just need to figure out how to get it to also pull the date out so I can use it.

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