- <% if @user and @this_user.id == @user.id %>
- <%= link_to 'new post', :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
+<br />
+
+<% if @this_user %>
+ <% if @user == @this_user %>
+ <%= link_to 'New diary post', :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
+ <% end %>
+<% else %>
+ <% if @user %>
+ <%= link_to 'New diary post', :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>