Ajax replies?


Home Forums Front End PM PRO Ajax replies?

This topic is: Not Resolved
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #39559
    little.chimp
    Participant

    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?

    #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);

    #39565
    shamim
    Keymaster

    Which 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.

    #39567
    little.chimp
    Participant

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

    #39570
    little.chimp
    Participant

    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?

    #39572
    little.chimp
    Participant

    Even 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 );
    #39576
    shamim
    Keymaster

    I sent you a test website credentials to your email address to test reply. Let me know.

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

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.