By Sunny on Monday, 10 April 2017
Replies 7
Likes 0
Views 843
Votes 0
I'm trying to insert a auto stream item from a custom component into easysocial stream. Everything is working perfect, just one issue i'm having. The href links are getting rendered as text and not as hyperlink.

my code is as below:


$message = 'I like '.$value->company_name.' and i think its price should be " '.$value->target_price.' "
<a href="/ '.$viewlink.' ">View this</a> | <a href="/ '.$userlink.' ">View All</a>' ;

require_once(JPATH_ROOT . '/administrator/components/com_easysocial/includes/easysocial.php');
ES::initialize();
$stream = ES::stream();
$template = $stream->getTemplate();
$template->setActor( $value->user_id , 'user' );
$template->setContext( $value->user_id , 'article' ); //story
$template->setContent( $message );
$template->setTitle( $title );
$template->setVerb( 'create' );
//$template->setSideWide( true );
$stream->add( $template );


In the above content is getting rendered as:

I like Premier toys and i think its price should be 15
<a href="/myurl/index.php/category/view/16-premier-toys">View this</a> | <a href="/myurl/index.php/display/971-demo-user">View All</a>


$message is not getting rendered as html, and raw text is being shown.

Can you please guide me on how to get href activated in stream.

Secondly i wanted to also ask how can i have #tag included in the $message? Basically i want the message to include #premiertoys hastag

regards
Sunny
Hi Sunny,

Since EasySocial do support bbcode parser, you can try to change the <a> tag with bbcode url format, eg:
[gist type="php"]I like Premier toys and i think its price should be 15
View this | View All[/gist]

EasySocial will then automatically convert it into hyperlink during display.
·
Monday, 10 April 2017 18:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Azrul,

Thank for pointing in the right direction, one small issue though, as i need to echo the link dynamically i tried:


[url = '.$viewlink.']View this[/url]

this resulted the href link is rendered as:
http://localhost/myurl/View%20this instead of http://localhost/myurl/myurl/index.php/category/view/16-premier-toys

if i try this


'.$viewlink.'


the hyperlink link is correct but the text displays the url myurl/myurl/index.php/category/view/16-premier-toys
·
Monday, 10 April 2017 19:41
·
0 Likes
·
0 Votes
·
0 Comments
·
I am sorry but we are unable to provide support for custom codes.
·
Monday, 10 April 2017 21:59
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post