little.chimp

Forum Replies Created

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • in reply to: Ajax replies? #39567
    little.chimp
    Participant

    Front End PM PRO, downloaded it around 3 days ago from here.

    in reply to: Ajax replies? #39563
    little.chimp
    Participant

    This is what I’m using at the moment, but I don’t feel it’s ideal.

    add_filter( 'fep_form_submit_button', function( $button, $where ){
    	if( 'reply' == $where ){
    		$button = '<button type="submit" onclick="setTimeout(\'history.go(0);\',500);" class="fep-button" name="fep_action" value="'. esc_attr( $where ) .'">Reply</button>';
    	}
    	return $button;
    }, 10, 2 );

    This would be better if using Ajax to pull in the newest messages on the page, but I’m not sure how to implement it at this point.

    setTimeout("location.href = \'https://www.website.com/messages/?fepaction=viewmessage&fep_id=7#fep-messge-17\';",500);

    in reply to: fep_filter_read_receipt example and message recipient #39533
    little.chimp
    Participant

    It’s easy when you know how. Much appreciated.

    Final code in my front-end-pm-mod plugin.

    add_filter( 'fep_filter_read_receipt_individual', function( $receipt, $time, $participant ){
        if ($time > strtotime('-1 day')) {
        	$time = sprintf( __( '%s', 'front-end-pm' ), date("G:i", $time) );
    		// $time = sprintf( __( '%s ago', 'front-end-pm' ), human_time_diff($time) );
    	} elseif ($time > strtotime('-6 day')) {
    		$time = sprintf( __( '%s', 'front-end-pm' ), date("D G:i", $time) );
    	} else { 
    		$time = sprintf( __( '%s', 'front-end-pm' ), date("j M Y, G:i", $time) );
    	}
    	if ( $participant == get_current_user_id()) {
    		return '';
    	} else {
    		return '<div class="fep-msg-read fep-msg-read-pad"><b>Read</b> ' . $time. '</div>';
    	}
    }, 10, 3);
    
    add_filter( 'fep_filter_read_receipt', function( $output, $receipt ){
    	return implode( '', $receipt );
    }, 10, 2);

    And in related to the other question I asked, how do I get the recipient name (To:). This was as part of a custom template version of veiw-message-content.php.

    echo '<div class="fep-msg-author"><b>' . fep_user_name( fep_get_message_field( 'mgs_author' ) ) . '</b></div>';
    			$recipients = fep_get_participants( fep_get_the_id( $mgs_id ) );
    			foreach ( $recipients as $recipient ) {
    				if( fep_get_message_field( 'mgs_author', $mgs_id ) != $recipient )
    				echo '<div class="fep-msg-recipient">to ' . fep_user_name( $recipient ) . '</div>';
    			}
    in reply to: fep_filter_read_receipt example and message recipient #39528
    little.chimp
    Participant

    So this will filter the name and date, time.

    add_filter( 'fep_filter_read_receipt_individual', function( $receipt, $time, $participant ){
        if ($time > strtotime('-1 day')) {
    		$time = sprintf( __( '%s', 'front-end-pm' ), date("G:i", $time) );
    		// $time = sprintf( __( '%s ago', 'front-end-pm' ), human_time_diff($time) );
    	} elseif ($time > strtotime('-6 day')) {
    		$time = sprintf( __( '%s', 'front-end-pm' ), date("D G:i", $time) );
    	} else { 
    		$time = sprintf( __( '%s', 'front-end-pm' ), date("j M Y, G:i", $time) );
    	}
    	return '<b>Read</b> ' . $time;
    }, 10, 3);
    

    // Read 21:18

    How do I filter out the <hr /><div class=”fep-read-receipt”>…</div>?

    This was what I came up with before you pointed me towards the _individual filter…

    add_filter( 'fep_filter_read_receipt', function(){	
    	$participants = FEP_Participants::init()->get( fep_get_the_id(), false, true );
    	$time = array();
    	foreach ( $participants as $participant ) {
    		if ( ! $participant->mgs_read ) {
    			continue;
    		}
    		if ( fep_get_message_field( 'mgs_author' ) == $participant->mgs_participant ) {
    			continue;
    		}
    		$time = $participant->mgs_read;
    	}
    	return 'Read ' . date('G:i', $time);
    }, 10, 2);
    

    But I know that’s not the right way to do it. I’m still trying to feel my way through the plugin, but getting there.

    in reply to: fep_filter_read_receipt example and message recipient #39495
    little.chimp
    Participant

    Sorry, just to clarify, I was looking for an example of the fep_filter_read_receipt filter in use as I couldn’t decipher it from the core code to make customisations.

    in reply to: Archive > Inbox #39448
    little.chimp
    Participant

    Just too bring this thread to a conclusion.

    add_action( 'fep_message_table_bulk_actions', function(){
    $filters = array(
    'delete' => __( 'Delete', 'front-end-pm' ),
    'mark-as-read' => __( 'Mark as read', 'front-end-pm' ),
    'mark-as-unread'=> __( 'Mark as unread', 'front-end-pm' ),
    'archive'=> __( 'Archive', 'front-end-pm' ),
    'restore'=> __( 'Unarchive', 'front-end-pm' ),
    );
    return $filters;
    });

    in reply to: Archive > Inbox #39443
    little.chimp
    Participant

    I see. Unarchive would be a better term if it becomes a permeant fixture.

Viewing 7 posts - 16 through 22 (of 22 total)