ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using one template for multiple user pages - Help

February 23, 2011 9:22pm

Subscribe [3]
  • #1 / Feb 23, 2011 9:22pm

    LewisSellers

    14 posts

    Hi There,

    I’m developing a charity website for a client of ours and Expression Engine is a brand new system to us. It looked like the best system to base their project on but unfortunately, I’ve hit a few bumps along the way!

    Basically, we’ve completed the front end of the site now and are getting on with the backend at the moment. The whole site is based around students volunteering for trips around the world.

    The site owner will give out a specific registration code for each trip, lets use the following trips as an example:

    Trip Destination #1: Gambia
    Registration code for Gambia: GAM01

    Trip Destination #2: India
    Registration code for India: IND1A

    There will a lot more trips in the future, so we need to make this as ‘clean coded’ as possible.

    I’ve purchased the solspace user module and the registration codes plugin to go with it. What happens at the minute is the following:

    1) A user goes to the website and can register with a code.. eg: GAM01
    2) The user is assigned to a default ‘members’ group and the registration code is stored against their name
    3) The user gets sent an email to confirm their registration, then can proceed to a login page

    I’ve developed a ‘volunteer dashboard’ where users should be able to login and see information specific to their trip… This is where I’m having problems.

    At the minute, the user will login and I’ve got all the placeholders in for their names and the ‘edit profile’ section, what I need to do is have the templates I’ve designed pull in content specific to their trip.

    How can I do this?

    Pages in their dashboard will be as follows:

    Dashboard (A quick overview of their trip, flight times, where they are flying from / too)
    Trip information (An Itinerary of their trip)
    Flight Details (Further Information on their flights)
    About the Country (information on the country they are visiting)
    Preparation Checklist (a quick checklist specific to that trip)

    All the information that needs to be filled in will be relevant to each person on that trip, so it doesn’t need anything user specific. If theres a way to somehow integrate the template with a channel and have a custom field in the channel that is read by the template to choose which content is displayed, that would be perfect… but I have no idea how to do this?

    I hope this makes sense… any help would be much appreciated! I’ve been racking my brains!!!!

    Kind Regards
    Lewis

  • #2 / Feb 23, 2011 9:29pm

    LewisSellers

    14 posts

    Hello all,

    Just thinking on my feet… would something like this work for the pages? Using ‘Trip Information’ as an example…

    {if RegistrationCode == "GAM01"}
    {exp:channel:entries channel="trip_details"}
    {gambia_content}
    {/exp:channel:entries}
    {/if}
    
    {if RegistrationCode == "IND1A"}
    {exp:channel:entries channel="trip_details"}
    {india_content}
    {/exp:channel:entries}
    {/if}

    Then I’ll just have to create a new field for each group on the channel… Or is that too messy? and would it even work…

    Any assistance would be fantastic..

    Ideally, it needs to already have all the code in place so the trip administrator can just fill in text rather than having to search through the code for the page like my suggestion above..

    Really, Expression Engine needs to think along the lines of:

    ** Look at channel ‘trip_information’ and output the content where channel field ‘registration_code’ == “GAM01” and where user field ‘registration_code’ = “GAM01 **

    That way, I could create a custom field for a channel called ‘trip_information’ and just create new content for each trip on channel whilst changing the registration code field… All expression engine needs to do then is match up the users registration code with the registration code entered by the trip admin and output the relevant ‘article’ for that channel.. How would I write that in Expression Engine language? :(

    Kind Regards
    Lewis

  • #3 / Feb 24, 2011 10:33am

    Sue Crocker

    26054 posts

    Hi, Lewis. When you register the member, are they put into a particular member group? Are they ever going to be going on more than one trip? Just a quick note, this may very well become more of a HowTo question, and may end up being moved to the CodeShare Corner.

  • #4 / Feb 24, 2011 11:35am

    LewisSellers

    14 posts

    Hi Sue,

    Thank you once again for your help!

    When a member is registered, they’re just entered into the standard ‘Members’ group no matter which trip they are on. No member will be going on more than one trip so pulling in the data from the ‘registration_code’ custom field seems like the best option.

    Does that give you any ideas 😊 ?

    Kind Regards
    Lewis

  • #5 / Feb 25, 2011 1:47am

    John Henry Donovan

    12339 posts

    Lewis,


    I would make a new custom field {trip_reg} for your trip channel. Then when you create a new trip just repeat the code in this custom field so you now have a code associated with the trip.

    Regarding your registration codes. Make sure they are being added to the custom profile fields as in example 3 here

    Then in your memebr profile/trip pages you can add something like this

    {exp:user:edit}
    {exp:channel:entries channel="trip_details" search:trip_reg="{member_profile_reg}"}
    {content}
    {/exp:channel:entries}
    {/exp:user:edit}

    or even this

    {exp:member:custom_profile_data}
    {exp:channel:entries channel="trip_details" search:trip_reg="{member_profile_reg}"}
    {content}
    {/exp:channel:entries}
    {/exp:member:custom_profile_data}

    This is presuming you have a generic custom field for your trip channel. {member_profile_reg} is the member profile field you created above

    Does that help?

    Moving this to the CodeShare Corner as more appropriate there

  • #6 / Feb 27, 2011 8:18am

    LewisSellers

    14 posts

    Hi John,

    Your an absolute genius!

    Thank you so much for that, you’ve helped massively. Looks like it works like a charm!

    Kind Regards
    Lewis

  • #7 / Mar 09, 2011 8:18pm

    LewisSellers

    14 posts

    Hi All,

    First of all, John, your suggestion worked perfectly so thank you for that.

    I’ve hit another slight problem and I know one way I could get around it, but it’s a bit sloppy.

    The client requires ‘Destination’ specific content, not just trip specific. Basically, if they have 10 trips to India, they need the same information on all those trips. But if they have trips to Gambia, the information for those needs to be different.

    At the minute, the only thing that separates users is their registration code which is Trip Specific (Not destination specific).

    The option I COULD use is adding a dropdown menu into the registration page that requires the user to select their destination. I could then use the same method as John suggested above by searching the channel for where the text in the ‘RegstrationCode’ field matches the text in the member profile ‘Registration_Code’ field but I feel this is a little bit sloppy.

    My second option would be the following (I’m just not sure how I implement it)...

    The ‘destination’ specific content is in one channel, and the ‘trip’ specific information is in another. One of the fields in the ‘trip’ specific information is called ‘Destination’. Is there anyway I can search the “Trip-Details” channel for where the “Destination” field matches the “Destination” field in the “aboutthecountry” channel?

    So basically, In my mind, the search string would be something like this (even though I know it’s not right!)

    {exp:user:edit}
    {exp:channel:entries channel="aboutthecountry" search: channel="trip-details" destination{channel="aboutthecountry" tripdetails}”}
    {content}
    {/exp:channel:entries}
    {/exp:user:edit}

    The code above made more sense when it was in my head but hopefully someone will understand where I’m coming from:

    Any help would be great!

    Kind Regards
    Lewis

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases