Home › Forums › Front End PM PRO › Ajax replies?
Tagged: ajax, fep_redirect, Reload, Replies
- This topic has 6 replies, 2 voices, and was last updated 5 years, 4 months ago by Shamim Hasan.
- AuthorPosts
- July 23, 2020 at 5:08 pm #39559little.chimpParticipant
Is there a way to have replies added to a message thread via Ajax rather than a page reload, so it would seem more like instant messaging? If not, is there a function I can use that reloads the page after a reply is submitted, maybe with a delay, so at least the sender can see their message added to the thread?
July 23, 2020 at 5:50 pm #39563little.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);July 23, 2020 at 7:07 pm #39565Shamim HasanKeymasterWhich version of the plugin you are using?
Replies are already sent using ajax and added to the thread.
If it is not the case for you, you can check if you are using latest version of the plugin and is there any js error in that page.July 23, 2020 at 7:08 pm #39567little.chimpParticipantFront End PM PRO, downloaded it around 3 days ago from here.
July 23, 2020 at 7:46 pm #39570little.chimpParticipantI 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?
July 23, 2020 at 8:28 pm #39572little.chimpParticipantEven with a vanilla installation, I can’t get it to work consistently. It may be my hosting or the caching system, but I’ve decided to go with a javascript reload to cover my bases.
add_filter( 'fep_form_submit_button', function( $button, $where ){ if( 'reply' == $where ){ // $fep_message_id = fep_get_the_id(); // $website = site_url( '/messages/', 'https' ) . '?fepaction=viewmessage&fep_id=' . fep_get_parent_id($fep_message_id); $button = '<button type="submit" onclick="setTimeout(location.reload.bind(location), 1500);" class="fep-button" name="fep_action" value="'. esc_attr( $where ) .'">Reply</button>'; } return $button; }, 10, 2 );July 23, 2020 at 10:25 pm #39576Shamim HasanKeymasterI sent you a test website credentials to your email address to test reply. Let me know.
- AuthorPosts
You need to purchase ‘Front End PM PRO’ to create topic in this support forum.
If you already purchased ‘Front End PM PRO’ please LOGIN.