When a RSS item was created from draft workspace it presented a wrong content, all its metadata (i.e. author, abstract, etc.) were empty.
SOLUTION:
We edited the class.tx_push2rss3ds_push.php located inside the push2rss_3ds extension folder in the following way:
function tt_news_DescriptionWrapper(){
if($_REQUEST['data']['tt_news']){
$tmpval = array_values($_REQUEST['data']['tt_news']);
$val = $tmpval[0];
}elseif($_REQUEST['cmd']['tt_news']){
$tmpval = array_values($_REQUEST['cmd']['tt_news']);
$uid = $tmpval[0]['version']['swapWith'];
$lolduid = array_keys($_REQUEST['cmd']['tt_news']);
$olduid = $lolduid[0];
$dbQuery = $GLOBALS['TYPO3_DB']->SELECTquery(
'*',
'tt_news',
'(uid = '.$uid.' and pid=-1) or uid='.$olduid,
'', '', ''
);
if($dbRes = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, $dbQuery)){
if (($GLOBALS['TYPO3_DB']->sql_num_rows($dbRes))==1){
$val=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbRes);
}
}
}
if($val['bodytext']!=''){
$val['bodytext'] = substr($val['bodytext'],0,300)."...";
}
$desc = "<table>";
$desc .= "<tr><td valign='top'><b>Author:</b></td><td>".$val['author']."</td></tr>";
$desc .= "<tr><td valign='top'><b>Email:</b></td><td>".$val['author_email']."</td></tr>";
$desc .= "<tr><td valign='top'><b>Description:</b></td><td>".$val['bodytext']."</td></tr>";
$desc .= "<tr><td valign='top'><b>Year:</b></td><td>".date("d-m-Y",$val['datetime'])."</td></tr>";
$desc .= "</table>";
return $desc;
}
//********************************************************************************************************************
function pub_DescriptionWrapper(){
if($_REQUEST['data']['user_bioversitypublications_data']){
$tmpval = array_values($_REQUEST['data']['user_bioversitypublications_data']);
$val = $tmpval[0];
}elseif($_REQUEST['cmd']['user_bioversitypublications_data']){
$tmpval = array_values($_REQUEST['cmd']['user_bioversitypublications_data']);
$uid = $tmpval[0]['version']['swapWith'];
$lolduid = array_keys($_REQUEST['cmd']['user_bioversitypublications_data']);
$olduid = $lolduid[0];
$dbQuery = $GLOBALS['TYPO3_DB']->SELECTquery(
'*',
'user_bioversitypublications_data',
'(uid = '.$uid.' and pid=-1) or uid='.$olduid,
'', '', ''
);
// t3lib_div::debug($dbQuery);exit;
if($dbRes = $GLOBALS['TYPO3_DB']->sql(TYPO3_db, $dbQuery)){
if (($GLOBALS['TYPO3_DB']->sql_num_rows($dbRes))==1){
$val=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($dbRes);
}
}
// t3lib_div::debug($olduid);exit;
}
if($val['abstract']!=''){
$val['abstract'] = substr($val['abstract'],0,300)."...";
}
$desc = "<table>";
$desc .= "<tr><td valign='top'><b>Author:</b></td><td>".$val['author']."</td></tr>";
$desc .= "<tr><td valign='top'><b>Abstract:</b></td><td>".$val['abstract']."</td></tr>";
$desc .= "<tr><td valign='top'><b>Publication year:</b></td><td>".$val['publication_year']."</td></tr>";
$desc .= "</table>";
return $desc;
}
//********************************************************************************************************************
function pub_TitleWrapper(){
// global $TYPO3_CONF_VARS,$TCA;
$tmpval = array_values($_REQUEST['data']['user_bioversitypublications_data']);
$val = $tmpval[0];
$desc = strip_tags($val['title']);
return $desc;
}
NOTE:
The function listed above were added previously by us to customize RSS items content; so we added the if statement to know when an item is created from draft workspace or when it's created from live workspace.
0 comments:
Post a Comment