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

XF 1.1 how to create custom field for member-page-URL ?

erich37

Well-known member
#1
how to make a custom-profile-field for each user, which automatically shows the Member-page-URL for each user ?

I mean for example:

my Member-Website-URL is:
http://xenforo.com/community/members/erich37.764/

So I would like to create a profile-field for each member, which should automagically display the URL for each Member-page.
Saying: each member has his very unique website with that specific URL and this URL should show-up in the Member-Profile.

Many thanks!
 

Jake Bunce

XenForo moderator
Staff member
#2
Profile fields don't have access to the user information so you can't build a profile link in the value or display HTML.

Where do you want to display that link? A template edit would probably suffice.
 

erich37

Well-known member
#3
well, I was just thinking of putting the member-page-URL into the "Information-Tab" of the respective user....
So showing the user that he has his very own "website" URL for his profile.
 

Jake Bunce

XenForo moderator
Staff member
#4
If you are viewing the information tab inside of some one's profile then you are already in their profile. o_O

You can edit the Information tab by editing this template:

Admin CP -> Appearance -> Templates -> member_view

For example, add the red code to add a profile link at the top:

Code:
			<li id="info" class="profileContent">

				<a href="{xen:link members, $user}">Your own website</a>

				<xen:if is="{$user.signature}">
					<div class="section">
						<h3 class="textHeading">{xen:phrase signature}</h3>
						<div class="primaryContent">
							<div class="baseHtml signature ugc">{xen:raw $user.signatureHtml}</div>
						</div>
					</div>
				</xen:if>

				<xen:if hascontent="true">
					<div class="section">
						<h3 class="textHeading">{xen:phrase about}</h3>

						<div class="secondaryContent">
							<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>{xen:string censor, $user.location}</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="{$customFieldsGrouped.personal}">
											<xen:foreach loop="$customFieldsGrouped.personal" value="$field">
												<xen:include template="custom_field_view" />
											</xen:foreach>
										</xen:if>
									</xen:contentcheck>
									</div>
								</xen:if>

								<xen:if is="{$user.about}"><div class="baseHtml ugc">{xen:raw $user.aboutHtml}</div></xen:if>
							</xen:contentcheck>
						</div>
					</div>
				</xen:if>

				<div class="section">
					<h3 class="textHeading">{xen:phrase interact}</h3>

					<div class="primaryContent">
						<div class="pairsColumns contactInfo">
							<dl>
								<dt>{xen:phrase content}:</dt>
								<dd><ul>
									<xen:hook name="member_view_search_content_types">
									<li><a href="{xen:link search/member, '', 'user_id={$user.user_id}'}">{xen:phrase find_all_content_by_x, 'name={$user.username}'}</a></li>
									<li><a href="{xen:link search/member, '', 'user_id={$user.user_id}', 'content=thread'}">{xen:phrase find_all_threads_by_x, 'name={$user.username}'}</a></li>
									</xen:hook>
								</ul></dd>
							</dl>
							<xen:if is="{$canStartConversation}">
								<dl><dt>{xen:phrase conversation}:</dt> <dd><a href="{xen:link 'conversations/add', '', 'to={$user.username}'}">{xen:phrase start_conversation}</a></dd></dl>
							</xen:if>
							<xen:if is="{$customFieldsGrouped.contact}">
								<xen:foreach loop="$customFieldsGrouped.contact" value="$field">
									<xen:include template="custom_field_view" />
								</xen:foreach>
							</xen:if>
						</div>
					</div>
				</div>
			</li>
 

Chimpie

Well-known member
#6
Another nice place for this would be the Share this Page section in the bottom left. The URL could be listed/shown there. Maybe an auto copy (Ctrl+C) button.

(just brainstorming)
 

erich37

Well-known member
#7
Another nice place for this would be the Share this Page section in the bottom left. The URL could be listed/shown there. Maybe an auto copy (Ctrl+C) button.

(just brainstorming)
great idea!

I think it would be great to show the user: hey, you`ve got your own page here at our forum.