Skip to:
Content
Pages
Categories
Search
Top
Bottom

single message thread sender id issue


  • stegtflesk
    Participant

    @stegtflesk

    I am trying to sort messageids gotten from the messageloop by the sender ids. But nothing seems to let be access the sender ids. I know the bp_get_the_thread_message_sender_id() can only be used inside a single thread. But how to i get inside? 🙂

    <?php $aMessages = array();?>
    <?php if ( bp_has_message_threads() ) : ?>
    
    <?php while ( bp_message_threads() ) : bp_message_thread(); ?>
    <?php if (!array_key_exists (bp_get_the_thread_message_sender_id() , $aMessages )): ?>
    <?php 
    $aMessages[bp_get_the_thread_message_sender_id()]['id'] = bp_get_message_thread_id();
    var_dump($aMessages);
    ?>
    <?php endif;?>
    				   
    <?php endwhile; ?>
    				 
    <?php else: ?>
    				 
    <div id="message" class="info">
    <p>There are no messages to display.</p>
    </div>
    				 
    <?php endif;?>

    EDIT

    <?php global $thread_template;?>
    <?php $display_name = bp_core_get_user_displayname( $thread_template->message->sender_id ); ?>

    This code is not working either :/

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

  • stegtflesk
    Participant

    @stegtflesk

    I solved it with

    	<?php  global $messages_template;?>
    	<?php  echo 'id = '.$messages_template->thread->last_sender_id ?>
    

    Dont know if it is a viable solution though


    Bharat
    Participant

    @chavodbharat

    Thank you very much stegtflesk

    good job keep it up

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar