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.

Image fieldtype for members

October 10, 2011 1:51pm

Subscribe [4]
  • #1 / Oct 10, 2011 1:51pm

    Luke Sturgeon

    17 posts

    I need each member to upload a logo and then when looping through a channel I will show the logo for the author of each post. This works fine when I’m not logged in, but as soon as I login I can no longer see the {photo_url} for the authors because the logged in user overrides those details.

    I am able to see any custom fields, so if I can upload an image as a custom field I wont have a problem. However I’m not able to choose a file fieldtype for custom member fields, only text input, text area and selected list.

    How can I create an image / file fieldtype for member profiles?

  • #2 / Oct 10, 2011 2:45pm

    jonathanmelville

    132 posts

    Maybe you could give Gravatar a try. It sounds like it’s a good fit for what you’re trying to do.

     

  • #3 / Oct 11, 2011 3:25am

    John Henry Donovan

    12339 posts

    Hi Luke,

    What version of EE are you using?

    Can you share your template code with us.

    If you use {avatar_url} then that is the URL to the avatar image associated with the entry’s author.

  • #4 / Oct 11, 2011 3:34am

    Luke Sturgeon

    17 posts

    Hi John,

    I’m using v2.2.2, here’s the current code:

    <ol id="jobs">
    
    {exp:super_search:results
     channel='jobs'
     redirect_post='yes'
     num='10'
    }
    
    {exp:member:custom_profile_data member_id='{author_id}'} 
    
    <li{if sticky == 'y'} class="featured_job"{/if}>
    
     {if sticky == 'y'}<h2>FEATURED JOB</h2><p>{/if}<br />
     <div class="job_detail"><br /></p><h3><a href="http://{entry_id_path=job-search/job}">{title}</a></h3>
    <p> {job_description}</p>
    
    <p> <strong>{billing_company} | {job_location} | {job_pay_rate}</strong><br />
     </div><!--job_detail--><br />
     {if photo_url}{photo_url}{/if}<br />
     <br />
    </li></p>
    
    <p>{/exp:member:custom_profile_data}</p>
    
    <p>{/exp:super_search:results}</p>
    
    <p></ol>

    I’m already using {photo_url} which is the member’s profile photo as opposed to the avatar photo. If I’m logged out it works fine. But when a user is logged in I get the logged in users {photo_url} not the authors even if I specify the member_id in the custom_profile_data tag.

    I was doing some more research and it seems you can only access custom fields when logged in, because the global member fields only show the current logged in user’s values.

    I was thinking I might have to hard-code the photo_url in the entry when it’s created. I will be able to access the image but it means the images won’t be dynamic which might cause problems if a member needs to upload a new logo and nothing on the website changes.

    Notes: Remember that the profile information for the current visitor to a page such as {screen_name}, {location}, {email}, etc. are always available in any template as Global Variables. Therefore, only use this tag if you need to show custom profile data (that is, fields that you have created in the Custom Profile Page) or member data for a specific user.

  • #5 / Oct 11, 2011 5:21am

    Luke Sturgeon

    17 posts

    Once solution that might work is to keep the same member photo functionality in the account pages and build an extension that duplicates the {photo_url} in to a custom field such as {custom_photo_url} which can be easily accessed afterwards.

    I also need to geocode the members address and store lat and long values and check if another custom field is null and insert a default value.

    I think I will need to find a developer to work with for this extension because it’s beyond my skillset. And needs to work with Solspace’s User addon.

  • #6 / Oct 11, 2011 10:34am

    Sue Crocker

    26054 posts

    Hi, Luke. Sounds like you have a plan in place. 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