• 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 ?

Amaury

Well-known member
#6
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.
No, allow the members to input their own.
 

Steve F

Well-known member
#9
Hey there,

I'm wondering how I can display timezone in user's Account -> Information, which template do I need to edit?
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.

I've already told you how you can accomplish this.
That would work but is not the results the OP is looking for I assume.
 
#10
I've already told you how you can accomplish this.
Sorry, but it's not the right solution that i'm looking for.

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.
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.
 

Andrej

Well-known member
#11
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.
 
#13
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:
View attachment 72073

Haven't figured out how to show the full value although.
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)
 

Andrej

Well-known member
#14
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.
 

Andrej

Well-known member
#16
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>
 
#17
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.
 

Andrej

Well-known member
#18
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.