little.chimp
Forum Replies Created
-
AuthorPosts
-
little.chimpParticipant
I can get it to work if I remove all of my customisations, but it seems to be very temperamental and works 1 out of every 5 tests. Do you have a user facing test site set up so I can figure out if it’s the system or my installation?
little.chimpParticipantFront End PM PRO, downloaded it around 3 days ago from here.
little.chimpParticipantThis 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);
little.chimpParticipantIt’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>'; }
little.chimpParticipantSo 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.
little.chimpParticipantSorry, 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.
little.chimpParticipantJust 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;
});little.chimpParticipantI see. Unarchive would be a better term if it becomes a permeant fixture.
-
AuthorPosts