if (@in_array($user->uid, array_keys(buddylist_get_buddies($account->uid))) && user_access('maintain buddy list')) {
  print "<a href=\"buddy/delete/".$user->uid."\">remove " .$user->name. " from your buddylist</a>";
  }
else {
  if ($user->uid != $account->uid && user_access('maintain buddy list')) {
  print "<a href=\"buddy/add/".$user->uid."\"> Add me! </a>";  
  }
}

I want to put images in the place of the "Add me" "Remove me" word links. I'm still a beginner at php, so whenever I would try to put a clickable image there, an erorr comes up. Does anyone know how I can go about doing this?

Thanks.

Comments

Tobias Maier’s picture

I hope it works it's untested

if (@in_array($user->uid, array_keys(buddylist_get_buddies($account->uid))) && user_access('maintain buddy list')) {
  print "<a href=\"buddy/delete/".$user->uid."\"><img src=\"images/remove_me.png\" alt=\"remove " .$user->name. " from your buddylist\" title=\"remove " .$user->name. " from your buddylist\" /></a>";
  }
else {
  if ($user->uid != $account->uid && user_access('maintain buddy list')) {
  print "<a href=\"buddy/add/".$user->uid."\"><img src=\"images/add_me.png\" alt=\"Add me!\" title=\"Add me!\" /></a>";
  }
}

a great beginner error is to forget to escate the "
so if you write something like
Hello "You"
on the screen you have to write

echo "hello \"You\"";
// or
echo 'hello "YOU"';

for more infos go to http://www.php.net

prettyeyes’s picture

WOW! It really worked! Thanks for your help!