The code works, only problem is. It only loads the user information, ONLY for the user that is logged in.
If another user ids viewed witha different userid, it DEOS NOT produce their information.
I just want the userid in url to return the information on that user, not the user logged in or user with the session ID.
PLESE TELL me waht to do to acheive this.
// Set cookie
$userid = JRequest::getVar('userid');
$data = new stdClass();
//$model =& $this->getModel('Profile');
//$album = & $this->get( 'Data');
$my = CFactory::getUser();
// Test if userid is 0, check if the user is viewing its own profile.
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
// Return with empty data
if ($user->id == null || empty($user->id)) {
//return false;
}
// Query the database for the user
$sql = 'SELECT * FROM jos_muscol_albums WHERE user_id = ' . $user->id;
//$query = 'SELECT user_id FROM #__muscol_albums WHERE id = ' . $album_id ;
$result = mysql_query($sql) or die('Error, No Album Search failed');
//$result = mysql_query($sql) or die('Error, No Album Search failed<br />' . mysql_error());
if (mysql_num_rows($result) > 0) {
list($id, $year, $name) = mysql_fetch_array($result);
// Display the results
//echo $id . '<br />' . $user->id . '<br />' . $year;
//echo $name;
// Preform id return check and redirecto to correct url
//$id=JRequest::getVar($prefix . 'id') ;
if ($user->get('id') == 0 || $userid == 0 || $userid <> $user->get('id')){
//$url = JURI::root() . 'index.php?' . $component . '&id=' . $id . '&tmpl=component&print=1';
$url=JURI::root().'index.php?'.$component.'&id='.$id.'&tmpl=component&print=1';
for($i=1;$i<count($type);$i++){
$url.='&'.$type[$i].'='.$layout[$i];
}
} else {
$url = JURI::root() . 'index.php?option=com_muscol&view=album&id=1&tmpl=component&print=1';
}
} else {
echo 'No results exist!';
}
/* Creating URL */