• Resolved Gustav

    (@4ever16)


    When i send a message the chat is updated LIVE.
    I want to manipulate the updated message LIVE.

    But the code i use is only printed as plain text and the iframe isnt shown.
    How do i show iframe in the LIVE message update? Not the old ones?

    Check the iframe code here. simple-ajax-chat.php

    function sac_getData($sac_lastID) {
    	
    	global $wpdb, $table_prefix, $sac_lastID, $sacGetChat;
    	
    	$loop = ''; 
    	
    	if (isset($_GET['sac_nonce_receive']) && wp_verify_nonce($_GET['sac_nonce_receive'], 'sac_nonce_receive')) {
    		
    		if ((isset($sacGetChat) && $sacGetChat === 'yes') && (!empty($sac_lastID) && is_numeric($sac_lastID))) {
    			
    			$query = $wpdb->get_results("SELECT * FROM ". $table_prefix ."ajax_chat WHERE id > ". $sac_lastID ." ORDER BY id DESC", ARRAY_A);
    			
    			for ($row = 0; $row < 1; $row++) {
    				
    				if (isset($query[$row]) && !empty($query[$row]) && is_array($query[$row])) {
    					
    					$id   = isset($query[$row]['id'])   ? $query[$row]['id']   : '';
    					$time = isset($query[$row]['time']) ? $query[$row]['time'] : '';
    					$name = isset($query[$row]['name']) ? $query[$row]['name'] : '';
    					$text = isset($query[$row]['text']) ? $query[$row]['text'] : '';
    					$url  = isset($query[$row]['url'])  ? $query[$row]['url']  : '';
    					
    					$time = sac_time_since($time);
    					
    $user = get_user_by('slug', $name);
    $test = get_user_meta( $user->ID, 'description', true);				
    				
    					
    					
    $loop = $id .'---<iframe src="https://MYWEBSITE.COM/'.$test.'"></iframe>---'. $text .'---'. $time .' '. esc_html__('ago', 'simple-ajax-chat') .'---'. $url .'---';
    					
    				}
    				
    			}
    			
    		}
    		
    	}
    	
    	echo $loop;
    • This topic was modified 5 years ago by Gustav.
    • This topic was modified 5 years ago by Gustav.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jeff Starr

    (@specialk)

    The SAC JavaScript is responsible for displaying real-time chats, located in /resources/sac.php.

    Thread Starter Gustav

    (@4ever16)

    So how do i print this?
    As i sed the iframe comes out as plain text and not an iframe.
    How do i print out the iframe in LIVE chat?

    simple-ajax-chat.php
    $loop = $id .'---<iframe src="https://MYWEBSITE.COM/'.$test.'"></iframe>---'. $text .'---'. $time .' '. esc_html__('ago', 'simple-ajax-chat') .'---'. $url .'---';

    Plugin Author Jeff Starr

    (@specialk)

    It would require significant custom coding, which unfortunately I do not have time for currently.

    Thread Starter Gustav

    (@4ever16)

    Ok ;(

    I thougth about a work around.

    Can you direct me in a way so when i press submit the CHAT is updated without using sac.php?

    Like updating #element instead?

    #element is actual chat element.

    So the chatbox element is updated.

    Plugin Author Jeff Starr

    (@specialk)

    Not sure, but can tell you that older versions of SAC did not require JavaScript. So the user could disable JavaScript in the browser and the chat would still work (by refreshing the page). I’m not sure which version though, I think version 20171104 was the last version that did not require JavaScript. I hope it helps.

    Thread Starter Gustav

    (@4ever16)

    Where do i find old versions?

    Plugin Author Jeff Starr

    (@specialk)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Why no HTML in new messages?’ is closed to new replies.