hiding specific links

hello ther,

If I view my profile within my application, I can see 2 links. 1 = get in touch and 2 = friend request.

Obviously if this is my own profile, I dont want to contact myself, nor add myself as a friend.

So - I had this that I found in the book:

<% if logged_in? and @user != @logged_in_user %>

When added to the page which shows my profile, it looks like this:

<% if logged_in? and @user != @logged_in_user %> <div class="users_profile"> <h2> <span class="header">Actions</span> <br clear="all" /> </h2> <ul>

  <li> <%= link_to "Get in touch",                     :controller => "email",                     :action => "correspond",                     :id => @user.username %>

  </li>

  <li> <%= friendship_status(@logged_in_user, @user) %>      <% unless Friendship.exists?(@logged_in_user, @user) %>

  <%= link_to "Buddy up with #{@user.username}",       { :controller => "friendship", :action => "create",         :id => @user.username },         :confirm => "Send buddy request to #{@user.username}?" %>

  <% end %>

  <% end %>

</ul>

</div>

However - even with this in place, I still get the links to contact myself, and add myself as a friend.

I then thought - perhaps I could add the hide_edit_links to the links i wish to hide.

So I added; <% unless hide_edit_links? %> before the 2 links. Unfortunately this only seems to hide these for all users. So - if i view someone e;ses profile, I cannot email them or add as a friend.

Any suggestions how I hide these links, without hiding all links?

Thanks for reading - hope someone can help.

So what are the values of those three variables at that point? You don't show how any of them are being set...

A ghetto but simple and quick way to figure out what is going on, is to do a logger.info in your controller action of these:

logged_in? @user @logged_in_user

I think you will quickly identify your problem then