My issue is when an advert is posted the advert is shared to the easy social profile
This is how it is outputting in the stream

This is the script the sorts this
is anyone able to tell me what is breaking the script?
This is how it is outputting in the stream

This is the script the sorts this
jimport('joomla.plugin.plugin');
require_once( JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php' );
require_once(JPATH_ADMINISTRATOR.'/components/com_djclassifieds/lib/djimage.php');
require_once(JPATH_ADMINISTRATOR.'/components/com_djclassifieds/lib/djseo.php');
require_once(JPATH_ADMINISTRATOR.'/components/com_djclassifieds/lib/djsocial.php');
class plgDJClassifiedsEasysocialstream extends JPlugin{
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
}
public function onAfterDJClassifiedsSaveAdvert( $row, $is_new ){
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$category = '';
$catslug = '0:all';
$pluginParams = $this->params;
if($row->user_id && ($is_new==1 || $pluginParams->get('stream_on_edit', 0)==1)){
$stream = Foundry::stream();
$template = $stream->getTemplate();
$actor = Foundry::user( $row->user_id );
$template->setActor( $actor->id , 'user' );
//echo '<pre>';print_R($actor);die();
$profile_link = DJClassifiedsSocial::getUserProfileLink($row->user_id,'easysocial');
$item_title = '<a href="'.$profile_link.'">'.$actor->name.'</a> ';
if($row->cat_id){
$query = "SELECT * FROM #__djcf_categories WHERE id='".$row->cat_id."' LIMIT 1";
$db->setQuery($query);
$category = $db->loadObject();
$catslug = $category->id.':'.$category->alias;
}
$ad_link = DJClassifiedsSEO::getItemRoute($row->id.':'.$row->alias,$catslug);
if($is_new){
//$act->cmd = 'djclassifieds.newadvert';
$item_title .= JText::_('PLG_DJCLASSIFIEDS_EASYSOCIALSTREAM_ADDED_ADVERT');
$item_content .= JText::_('PLG_DJCLASSIFIEDS_EASYSOCIALSTREAM_NEW_ADVERT');
}else{
//$act->cmd = 'djclassifieds.editadvert';
$item_title .= JText::_('PLG_DJCLASSIFIEDS_EASYSOCIALSTREAM_EDITED_ADVERT');
$item_content .= JText::_('PLG_DJCLASSIFIEDS_EASYSOCIALSTREAM_CHANGED_ADVERT');
}
//echo $item_title;die();
$item_content .= ' <div class="es-stream-market-item__label">
<i class="fa fa-shopping-bag"></i>
</div><a href="'.$ad_link.'">'.$row->name.'</a></br>';
$item_content .= $row->intro_desc;
$item_imgs = DJClassifiedsImage::getAdsImages($row->id);
if($item_imgs){
$item_content .= '<br /><br />';
for($i=0; $i<count($item_imgs); $i++){
if($i==3){break;}
$item_content .= '<div class="es-stream-market-item">
<div class="es-stream-market-item__media">
<div class="es-stream-market-item__label">
<i class="fa fa-shopping-bag"></i>
</div><div class="es-stream-market-item__img"><a href="'.$ad_link.'"><img src="'.JURI::base().$item_imgs[$i]->thumb_s.'" alt="" /></a>
</div>';
}
}
$template->setTitle( $item_title );
$template->setType( 'full' );
$template->setContent( $item_content );
$template->setContext( $row->id , 'djclassifieds' );
$template->setVerb( 'create' );
//$template->setLocation('http://www.google.pl');
//$template->setSideWide( true )
$stream->add( $template );
//echo '<pre>';print_r($template);die();
//$my = Foundry::user();
}
return true;
}
is anyone able to tell me what is breaking the script?