1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 How to display timezone in user's Account -> Information ?

Discussion in 'Styling and Customization Questions' started by DistortedDorian, Apr 17, 2014.

  1. DistortedDorian

    DistortedDorian Active Member

    Hey there,

    I'm wondering how I can display timezone in user's Account -> Information, which template do I need to edit?
     
  2. Amaury

    Amaury Well-Known Member

    You can create a custom profile field for this where users can input their time zone. :)
     
  3. DistortedDorian

    DistortedDorian Active Member

    Hey,
    timezone field already exists in /account/preference and I want it to be displayed in user's Account -> Information (look at the screenshot)
     

    Attached Files:

  4. Amaury

    Amaury Well-Known Member

    As I said, create a custom profile field.
     
  5. DistortedDorian

    DistortedDorian Active Member

    How would I use custom user field for that?
    I would have to add every timezone manually then, would I? And a option to change timezone already exists in /account/preference but it's not displayed in user's Account -> Information.
     
  6. Amaury

    Amaury Well-Known Member

    No, allow the members to input their own.
     
  7. DistortedDorian

    DistortedDorian Active Member

  8. Amaury

    Amaury Well-Known Member

    I've already told you how you can accomplish this.
     
  9. Steve F

    Steve F Well-Known Member

    Most likely will require a add-on to automatically display a users time zone as the information is not available to the member_view template.

    That would work but is not the results the OP is looking for I assume.
     
  10. DistortedDorian

    DistortedDorian Active Member

    Sorry, but it's not the right solution that i'm looking for.

    I think that would actually require only template modification because I was able to add the Time Zone: question in Registration template.
    But I can't find the right code for adding that to member_view.
     
  11. Andrej

    Andrej Well-Known Member

    Code:
    <xen:if is="{$user.timezone}">
    <dl><dt>{xen:phrase time_zone}:</dt><dd>{$user.timezone}</dd></dl>
    </xen:if>
    Added it somewhere after the other fields (gender, birthday, etc.). Produces this:
    2014-04-20 19-02-16 Myself.png

    Haven't figured out how to show the full value although.
     
    Steve F likes this.
  12. DistortedDorian

    DistortedDorian Active Member

    Thank you!
    It's best so far, any other suggestions?
     
  13. DistortedDorian

    DistortedDorian Active Member

    Hmm, I tried your code but it's not working for me, I pasted it under <xen:if is="{$user.occupation}"> and I fixed all the spaces (tabs)
     
  14. Andrej

    Andrej Well-Known Member

    Did you edit the template corresponding to the correct style? There is no reason this code shouldn't work. Make sure it is a separate entity as well.
     
  15. DistortedDorian

    DistortedDorian Active Member

    Hmmm, can you perhaps do a screenshot of your member_view or paste it on pastebin?
     
  16. Andrej

    Andrej Well-Known Member

    Code:
    <li id="info" class="profileContent">
                    <xen:if hascontent="true">
                        <div class="section">
                            <h3 class="textHeading">{xen:phrase about}</h3>
                            <div class="primaryContent">
                                <xen:contentcheck>
                                    <xen:if hascontent="true">
                                        <div class="pairsColumns aboutPairs">
                                        <xen:contentcheck>
                                            <xen:if is="{$user.gender}">
                                                <dl><dt>{xen:phrase gender}:</dt> <dd><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if></dd></dl>
                                            </xen:if>
                                            <xen:if is="{$birthday}">
                                                <dl><dt>{xen:phrase birthday}:</dt> <dd>{xen:date $birthday.timeStamp, $birthday.format} <xen:if is="{$birthday.age}">({xen:phrase age}: {xen:number $birthday.age})</xen:if></dd></dl>
                                            </xen:if>
    
                                            <xen:if is="{$user.homepage}">
                                                <dl><dt>{xen:phrase home_page}:</dt> <dd><a href="{xen:string censor, $user.homepage, 'x'}" rel="nofollow" target="_blank">{xen:string censor, $user.homepage}</a></dd></dl>
                                            </xen:if>
    
                                            <xen:if is="{$user.location}">
                                                <dl><dt>{xen:phrase location}:</dt> <dd><a href="{xen:link 'misc/location-info', '', 'location={xen:string censor, $user.location, '-'}'}" target="_blank" rel="nofollow" itemprop="address" class="concealed">{xen:string censor, $user.location}</a></dd></dl>
                                            </xen:if>
    
                                            <xen:if is="{$user.occupation}">
                                                <dl><dt>{xen:phrase occupation}:</dt> <dd>{xen:string censor, $user.occupation}</dd></dl>
                                            </xen:if>
                                          
                                            <xen:if is="{$user.timezone}">
                                                <dl><dt>{xen:phrase time_zone}:</dt><dd>{$user.timezone}</dd></dl>
                                            </xen:if>
                                          
                                            <xen:if is="{$customFieldsGrouped.personal}">
                                                <xen:foreach loop="$customFieldsGrouped.personal" value="$field">
                                                    <xen:include template="custom_field_view" />
                                                </xen:foreach>
                                            </xen:if>
                                        </xen:contentcheck>
                                        </div>
                                    </xen:if>
     
    Amaury likes this.
  17. DistortedDorian

    DistortedDorian Active Member

    I'm not sure what is mine looks like this:
    Code:
            <xen:if hascontent="true">
            <div class="section infoBlock">
                <dl class="secondaryContent pairsJustified">
                <xen:contentcheck>
                    <xen:if is="{$user.gender}">
                        <dl><dt>{xen:phrase gender}:</dt>
                            <dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if></dd></dl>
                    </xen:if>
    
                    <xen:if is="{$birthday}">
                        <dl><dt>{xen:phrase birthday}:</dt>
                            <dd><span class="dob" itemprop="dob">{xen:date $birthday.timeStamp, $birthday.format}</span> <xen:if is="{$birthday.age}"><span class="age">({xen:phrase age}: {xen:number $birthday.age})</span></xen:if></dd></dl>
                    </xen:if>
    
                    <xen:if is="{$user.homepage}">
                        <dl><dt>{xen:phrase home_page}:</dt>
                            <dd><a href="{xen:string censor, $user.homepage, 'x'}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd></dl>
                    </xen:if>
    
                    <xen:if is="{$user.location}">
                        <dl><dt>{xen:phrase location}:</dt>
                            <dd><a href="{xen:link misc/location-info, '', 'location={xen:string censor, $user.location, 'x'}'}" rel="nofollow" target="_blank" itemprop="address">{xen:string censor, $user.location}</a></dd></dl>
                    </xen:if>
    
                    <xen:if is="{$user.occupation}">
                        <dl><dt>{xen:phrase occupation}:</dt>
                            <dd itemprop="role">{xen:string censor, $user.occupation}</dd></dl>
                    </xen:if>
    
                    <xen:if is="{$user.timezone}">
                        <dl><dt>{xen:phrase time_zone}:</dt>
                            <dd itemprop="role">{xen:string censor, $user.timezone}</dd></dl>
                    </xen:if>
    
                    <xen:if is="{$user.timezone}">
                        <dl><dt>{xen:phrase time_zone}:
                            </dt><dd>{$user.timezone}</dd></dl>
                    </xen:if>
    
                </xen:contentcheck>
                </dl>
            </div>
            </xen:if>
    
    this code pretty much is broken because it's copy & pasted so here is a pastebin link: http://pastebin.com/RxxBdTXD
    I did this in member_view, is that right template and do I need to edit something else?
    I have Xenforo 1.3.1.
     
  18. Andrej

    Andrej Well-Known Member

    Its the correct template. Not sure why you have duplicate code in line 30 and 35? If you still not manage to get it to work, and if you are comfortable providing Admin CP access, start a conversation with me. Not sure why you would have problems with such simple edit.
     

Share This Page