Hi all, I am using PHPfox on my website and I would like to change a feed to show one specific users activity. Below is the current code that generates the RSS, I essentially want to only show post from user "Candice". I have tried adding if statements with no luck...Could someone help with the formatting? list($iCnt, $aRows) = Phpfox::getService('blog')->get(array('AND blog.is_approved = 1 AND blog.privacy = 1 AND blog.post_status = 1'), 'blog.time_stamp DESC', 0, Phpfox::getParam('rss.total_rss_display')); foreach ($aRows as $iKey => $aRow) { $aRows[$iKey]['description'] = $aRow['text']; $aRows[$iKey]['link'] = Phpfox::itemUrl('blog', $aRow['title_url'], $aRow['user_name']); $aRows[$iKey]['creator'] = $aRow['full_name']; } PHP: Thanks!
list($iCnt, $aRows) = Phpfox::getService('blog')->get(array('AND blog.is_approved = 1 AND blog.privacy = 1 AND blog.post_status = 1'), 'blog.time_stamp DESC', 0, Phpfox::getParam('rss.total_rss_display')); foreach ($aRows as $iKey => $aRow) { if($aRow['full_name'] != 'NAME_HERE') continue; $aRows[$iKey]['description'] = $aRow['text']; $aRows[$iKey]['link'] = Phpfox::itemUrl('blog', $aRow['title_url'], $aRow['user_name']); $aRows[$iKey]['creator'] = $aRow['full_name']; } PHP:
Actually, I spoke to soon...The feed is still displaying updates from all users rather than just the one I enter in "NAME HERE". Any ideas? Thanks
he did it wrong list($iCnt, $aRows) = Phpfox::getService('blog')->get(array('AND blog.is_approved = 1 AND blog.privacy = 1 AND blog.post_status = 1'), 'blog.time_stamp DESC', 0, Phpfox::getParam('rss.total_rss_display')); foreach ($aRows as $iKey => $aRow) { if($aRow['full_name'] != 'NAME_HERE') break; $aRows[$iKey]['description'] = $aRow['text']; $aRows[$iKey]['link'] = Phpfox::itemUrl('blog', $aRow['title_url'], $aRow['user_name']); $aRows[$iKey]['creator'] = $aRow['full_name']; } PHP: I am not sure if it will work, but you could try it
The above won't work. The second it doesn't get the name you want, it's just going to break the loop. Continue would have been better. Wouldn't it be better to add the condition to the where clause in your query? I've never used PHPFox, so I'm not too sure how it works, however I'm assuming you could just do something like this: list($iCnt, $aRows) = Phpfox::getService('blog')->get(array('AND blog.is_approved = 1 AND blog.privacy = 1 AND blog.post_status = 1 AND blog.full_name = "NAME HERE"'), 'blog.time_stamp DESC', 0, Phpfox::getParam('rss.total_rss_display')); PHP:
Thanks for the replies the last attempt appears to be filtering the results but it is filtering down to zero entries...Any other ideas? Thanks!