danjapro Posted March 17, 2011 Share Posted March 17, 2011 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 */ Quote Link to comment Share on other sites More sharing options...
Ionisis Posted March 30, 2011 Share Posted March 30, 2011 i don't know what framework your using, but it looks like you're not passing ANY info to the objects/functions that create the user, and which would yield the user's ID. I expected to see a $_GET['userid'] or something. I'm just curious, are you trying to write this because you WANT to code your own site, or because you have no choice? I've always wonder that about people trying to do this stuff. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.