Hey I need some help with this bit of code it for PHP
So you visit the site and are logged in the code for your startpage is supposed to show you only your own latest activity, favorite, likes etc.. But for some reason I cannot get it to single out the logged in user, only everybody else. I did not write this code, but it is the only thing I have to work with.
// I added this bit to get the user info
// Get USER info
$user = JFactory::getUser();
$email = $user->email;
// This section joins to tables to display the complete record
// build the SQL query
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select ('com.article_id, com.email, com.publish_date, com.published, con.id, con.title, con.images');
// From the comments table
$query->from('#__joocomments as com');
// From the contents table
$query->from('#__content as con');
// Declaration to select to comment
// Select only the comments from the logged in user,
// But It never works no matter how I format it.
// I have been trying for months! Please tell me what I am doing wrong..
//Ordering the comments
$query->order('publish_date desc limit 20');
// Reset the query using our new query object
// Load the results as a list of stdClass objects.
$rows = $db->loadObjectList();
// Retrieve each value in the ObjectList