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.

Custom Member Fields in Templates

November 07, 2011 11:16am

Subscribe [3]
  • #1 / Nov 07, 2011 11:16am

    koko.pelli

    176 posts

    Hi all,

    I am trying to output custom fields from the Member Module into a standard EE template.

    From this thread: http://ellislab.com/forums/viewthread/122889/

    I thought I could use th following code, but it doesn’t seem to be working (The screen name appears, but not the custom field).

    {if logged_in}
         {exp:member:custom_profile_data}
              {screen_name}, {m_field_id 3}
         {/exp:member:custom_profile_data}
    {/if}

    Thank you
    Simon 😊

  • #2 / Nov 08, 2011 4:59am

    koko.pelli

    176 posts

    Crikey, page 4 already :(

    Anyone know how I can do this?

    Thanks
    Simon

  • #3 / Nov 08, 2011 5:52am

    Mark Bowen

    12637 posts

    Hi Simon,

    The code you have shown above is that a direct copy / paste from your template there?

    If so then you can’t (as far as I know anyway) have custom member field short-names that have spaces in them. Should that perhaps read {m_field_id_3} instead?

    Also is that definitely the short name you have called your custom field as that looks more like the field name that will be used in the database and not what is stored in :

    Members > Member Fields > Field Name

    Check that you’re definitely using the correct field short name there.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #4 / Nov 08, 2011 6:04am

    koko.pelli

    176 posts

    Hi Mark,

    Thanks for coming back to me 😊

    I tried both, with the underscore also, but that didn’t work either.

    I first tried the field name but that wasn’t pulling anything in either. That’s when I did a bit of a search and found the thread I linked to in my first post.

    If I use the actual short code from the member field, it just returns as blank.

  • #5 / Nov 08, 2011 6:08am

    Mark Bowen

    12637 posts

    Hi Simon,

    Can you let us know what you have set here :

    Members > Member Fields > Field Name (Name of your custom field)

    Also you mentioned in your original post that you were doing this in a standard template. What exactly do you mean by standard template?

    You’re not trying to do this in the member templates are you?

    Mark

  • #6 / Nov 08, 2011 6:12am

    koko.pelli

    176 posts

    Hi Mark,

    For the custom field I have:

    Field ID: 3
    Label: First Name
    Name: member_first_name

    Field ID: 4
    Label: Last Name
    Name: member_last_name

    By standard template I mean a template I have created in Template Manager. Not in the member templates.

    Many thanks for your help
    Simon

  • #7 / Nov 08, 2011 7:01am

    Mark Bowen

    12637 posts

    Hi Simon,

    In that case do you get anything when you test this code in a new template :

    {exp:member:custom_profile_data}
            {screen_name}, {member_first_name}
    {/exp:member:custom_profile_data}

    Best wishes,

    Mark

     

  • #8 / Nov 08, 2011 7:06am

    koko.pelli

    176 posts

    Hi Mark,

    Tried with a completely new template with just the code you posted above. The only code that appears id the Screen Name.

    Thanks
    Simon

  • #9 / Nov 08, 2011 9:23am

    Sue Crocker

    26054 posts

    Hi, Simon.

    I created a brand new template with the following code in it:

    <h3>Member Testing of Custom Fields</h3>
    
    <p> {exp:member:custom_profile_data}<br />
              {screen_name}, {skype}<br />
         {/exp:member:custom_profile_data}

    I’m logged in, and my screen_name and Skype name showed up as expected. Did you set the field to be visible ?

  • #10 / Nov 08, 2011 9:40am

    koko.pelli

    176 posts

    Hi Sue,

    The field is set to be visible in public profiles.

    It is a custom member field, does that make a difference?

    Also, is it right that I am attempting to pull it in with the Field Name, i.e, {member_last_name]

  • #11 / Nov 09, 2011 7:04am

    koko.pelli

    176 posts

    Sorry, is it ok to bump posts up after 24 hours?

    Really stuck on this one.

  • #12 / Nov 09, 2011 7:09am

    koko.pelli

    176 posts

    I have it working! I have no idea how but it now works!

    Many thanks for your help 😊

  • #13 / Nov 09, 2011 7:15am

    Sue Crocker

    26054 posts

    Hey, all I did was give you an example that worked. 😊 Glad things are working again.. Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases