Unable to access profile page unless logged in

I’m having an issue where if a user, that is not registered is browsing the marketplace listings and clicks on a username that posted the listing, they are directed to a 404 page.
The profile page only shows up if they are logged in. How can I redirect users that click on a username to be redirected to a login/registration page?

www.marketplace.sharetribe.com/en/myusername – > will only take them to the profile page if they are logged into the marketplace. Otherwise it throws a 404 error

Hi there!

A couple ideas of things to check:

  • is the user banned (or was at some point)?
  • is the marketplace set as private?

If this is already online (and not in your local environment), maybe you could share an actual link where it happens?

Let us know!

The marketplace is not private.
Here is the link to the website
https://www.rentspace.io/
When browsing the listings, try clicking the username of the person that has posted the listing. It will redirect you to a markeplace unavailable message

Thanks for sharing those details! Quite strange indeed.

I can’t think of anything right now however note that the page displayed isn’t a 404 page but a 500 page, a server error.
The page may exist but the application/server isn’t able to deliver it for some reason.

One good way to move forward would be to check your logs and see if there’s any information there, probably you’ll be able to find more details about the server error.

Keep us posted!

@thomasmalbaux Thank you for your assistance. Yes the issue is in the code. Receiving an error message that inbox_path is undefined even though it is defined, it’s also in routes.rb file. Also it means that it actually works while user is logged in.

Rendered social/_social_nav.html.erb (244.5ms)
 Completed 500 Internal Server Error in 502ms (ActiveRecord: 119.0ms)
 

 ActionView::Template::Error (undefined local variable or method `inbox_path' for #<#<Class:0x007f5e8e43c710>:0x007f5e8fdee348>):
           <a href="#">Notifications<span class="<%= get_badge_class(@person.friends.count) %>"><%= @person.friends.count %></span></a>
           </li>
    <li>
      <a href="<%= inbox_path %>" class="<%= 'active' if action_name == 'show' && controller_name == 'inboxes' %>">Messages
     14:         <span class="<%= get_badge_class(@person.friends.count) %>"><%= unread_count %></span></a>
     15:     </li>
     16:     <li>
   app/views/social/_social_nav.html.erb:13:in `_app_views_social__social_nav_html_erb__4237919624931205881_70022054441920'
   app/views/layouts/social.html.erb:65:in `_app_views_layouts_social_html_erb___2249255753954774039_70022045433980'
   app/controllers/people_controller.rb:68:in `show'
   lib/rack_middleware/current_marketplace_appender.rb:13:in `call'
   lib/rack_middleware/custom_cookie_renamer.rb:11:in `call'
   lib/rack_middleware/enforce_ssl.rb:23:in `call' 

routes.rb has

get "/people/:person_id/inbox/:id", :to => redirect("/fi/people/%{person_id}/messages/%{id}")

...............................................................................................

 resource :inbox, :only => [:show]

        resources :messages, :controller => :conversations do
          collection do
            get :received, to: 'inboxes#show'