Hi Michelle,

One tinsy little help with my code here. I have this:

          <?php if (!empty($user_relationships_api)): ?>
                <?php print $user_relationships_api_link; ?>
          <?php else: ?>
                <?php print l('Register to add as friend', 'user/register'); ?>
          <?php endif; ?> 

Works perfect no problem there. But my dilemma is that the 'register to add as friend' is visible to someone who's viewing their own profile. Which is only intended for the anonymous user. This one should be blank when viewing own profile.

Would really appreciate any help. Thanks.

Comments

michelle’s picture

Just check to make sure the logged in user and the owner of the profile aren't the same:

<?php global $user ?>
<?php if ($user->uid != $account->uid): ?>
  <?php print l('Register to add as friend', 'user/register'); ?>
<?php endif; ?>

Michelle

halloffame’s picture

Status: Active » Fixed

Thanks my superstar! Ahihi.

Just for reference to other user who might need the same thing.

<?php if (!empty($user_relationships_api)): ?>
   <?php print $user_relationships_api_link; ?>
   <?php else: ?>
      <?php global $user ?>
      <?php if ($user->uid != $account->uid): ?>
      <?php print l('Register to add as friend', 'user/register'); ?>
      <?php endif; ?>
<?php endif; ?>
michelle’s picture

Great, glad it worked for you. :)

Michelle

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.