2

I have a sports site I'm building where each team is set up as a user within a 'team' member group. I have a channel called 'Schedule' that has only 2 fields; a user field to relate the schedule to a team and then a table for the list of games.

On the front-end if I have a profile page for each team (ie: http://www.example.com/{username}). I'm having trouble outputting the correct schedule based on the username in the URL?

  • Are you able to pull a User from the username? Have you set up this page in your Routes? – Bryan Redeagle Jun 18 '14 at 18:06
  • Let's have a look at your templates too! That would help us help you :) – Mark Busnelli Jr Jun 18 '14 at 18:10
1

Without knowing how your templates look, I can only give you a basic example:

{% set team    = craft.users.username(craft.request.lastSegment) %}
{% set entries = craft.entries.section('schedules').relatedTo(team) %}

This should give you all entries in the schedules channel which have a relation to the team username.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.