Need some PHP help getting a menu function to work

Started by wynnyelle, February 03, 2015, 10:36:34 PM

Previous topic - Next topic

wynnyelle

Hi, this is a PHP based virtual pet game that I am developing, and it is built linked in with my SMF forum but the game itself is not SMF, so I'm looking to see if anyone knows what might be going wrong with it.

I'm trying to add a clickable link function to the individual page for each pet. It's already working on the group page, but im only able to add the menu option to the individual page, I cannot get the option to actually do anything. You can click it but it doesn't do anything.

I'm attaching the main file here. Anyone is free to take a look.

wynnyelle

...I wanted to edit in things I learnt since the posting, as I learnt them, but it isn;t letting me edit my message, so I'm going to have to add it in replies. My apologies.

Here's questions we have so far:


if(array_key_exists('u', $_REQUEST) && is_numeric($_REQUEST['u']) && $context['user']['is_admin']){
   $user_id = $_REQUEST['u'];
  }else{
   $user_id = $context['user']['id'];
  }


Quote
translation: if the array has the key 'u' in the request super global AND the value of u is a number
thats the first part
AND user is an admin
second part
then user id is equal to the value of u in the request super global array
I was trying to break it into just checking for if the array exists and is numeric
but then I can't really do the rest of the if within that logic block without checking admin.. and at that point the call to the method becomes almost as complex as whats already there

live627

Little known fact: Functions called by the profile menu ares passed $memID as the user ID of the profile being viewed - equivalent of $_REQUEST['u'], except that it is verified.

wynnyelle

Thank you so much! This should help us understand how our site works a lot better. This is a different menu, though. It's a custom one. It's the one like on this page:

http://xanje.com/index.php?action=pets&sa=show_pet&pet_id=169721

You won't see a menu there but it appears under the box with the words "Cute brown kitten..." it is not an SMF member profile menu. I attached the file that creates it.

wynnyelle

We still can't get this to work and I don't know how to move forward in taking the next step to getting it to work.

wynnyelle

This is still stuck. We can't get this menu to work. Please let me know if you need more info. I can provide it, probably.

Advertisement: