How to show a link only if a node author has a certain role
You can use menu_get_object() to easily and cleanly get information on what you looking at, eg, something along these lines:

$mgo=menu_get_object('user');

if ($mgo) { // we are looking at a user

  if (in_array('CERTAIN ROLE', $mgo-&gt;roles)) {

    // do whatever

  }

}


and if the user you are looking at, eg, user/###, has a CERTAIN ROLE, then you can do whatever.

Now, from your question, I am going to go out on a limb and assume you are creating this block from the Block UI and using the PHP Filter, so I guess it would look like this:

&lt;?php $mgo=menu_get_object('user') ?&gt;
&lt;?php if ($mgo): ?&gt;
  &lt;?php if (in_array('CERTAIN ROLE', $mgo-&gt;roles)): ?&gt;
    &lt;a href="/user/&lt;?php print $mgo-&gt;uid; ?&gt;/menu4"&gt;MENU4&lt;/a&gt;
  &lt;?php endif; ?&gt;
&lt;?php endif; ?&gt;


but I would strongly urge you to consider writing a module for this as the PHP filter opens up soooo many potential holes.

Also, as @olyn has pointed out, $user points to the logged in user, not to the owner of the profile you are looking at, so you will want to look into that in your code as well for your other links, eg, $user-&gt;uid is the uid of the currently logged in user; in my code above $mgo-&gt;uid is the user id of the profile you are looking at.