Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-06-2013, 08:48 PM
ThatsDank ThatsDank is offline
 
Join Date: Jan 2013
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Turning a User Profile Field into a link

I would like my users to be able to enter their Twitter profile username like @username into a Single-Line Text Box. I was hoping I could make this username turn into a link on their profile that goes to (twitter.com/username) whatever they entered as their username. Any help would be very appreciated.
Reply With Quote
  #2  
Old 01-10-2013, 01:36 AM
grey_goose grey_goose is offline
 
Join Date: Jun 2009
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure, that's easy -- just call the profile field in the link. Here's an example of one I use to create links to our wiki:
Code:
<a href="http://mysite/wiki/index.php/{vb:raw post.field109}">
Reply With Quote
  #3  
Old 01-10-2013, 09:23 PM
ThatsDank ThatsDank is offline
 
Join Date: Jan 2013
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the reply but could you shed a little more light on how to do that? I am brand new to vBulletin. I can figure it out but I'll need a little bit more help. Thank you!
Reply With Quote
  #4  
Old 01-11-2013, 02:45 AM
grey_goose grey_goose is offline
 
Join Date: Jun 2009
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Start here:
https://www.vbulletin.com/forum/cont...-Profile-Field

Once you've made your profile field, look at the field number -- then edit whichever template is the one you want it to appear in, using the {vb:raw post.fieldx} variable to display that field.
Reply With Quote
  #5  
Old 06-04-2014, 06:31 AM
msmayz msmayz is offline
 
Join Date: May 2014
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'd like to bump this. I have a custom profile field -- "field7" -- which is a single-line text box where users enter the URL of their personal thread on my forum. I would like this to turn into a link. Which template do I add the HTML to? I tried adding this code to the userfield_textbox template, but it didn't work:

Code:
<a href="{vb:raw post.field7}">

If someone could verify that I'm using the right code and help me figure out where exactly I need to put this text in order to make field 7 turn into a link, I would really appreciate it!
Reply With Quote
  #6  
Old 06-04-2014, 08:50 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you'd want something like:
Code:
<a href="{vb:raw post.field7}">{vb:raw post.field7}</a>
if you were inserting it in postbit, that is.

But if you want it to show up on the profile page, I think you want to edit template memberinfo_profilefield and check $profilefield[profilefieldid] == 7. So something like:
Code:
<vb:if condition="$profilefield[profilefieldid] == 7">
<a href="{vb:raw profilefield.value}">{vb:raw profilefield.value}</a>
<vb:else />
{vb:raw profilefield.value}
</vb:if>

(the {vb:raw profilefield.value} is a line that already exists in the template, so you want to find that line and replace it with the above.
Reply With Quote
  #7  
Old 06-04-2014, 09:33 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oops, I posted this early this morning and I just noticed that it was wrong, you want to use {vb:raw profilefield.value} not {vb:raw post.field7}. I've fixed the post above.
Reply With Quote
  #8  
Old 06-05-2014, 03:41 AM
msmayz msmayz is offline
 
Join Date: May 2014
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much, kh99. I opened the memberinfo_profilefield template, which says this:

Code:
<dl>
<vb:if condition="$show['profilefield_edit']">
	<dt id="profilefield_title_{vb:raw profilefield.profilefieldid}" class="aboutme_left">{vb:raw profilefield.title}</dt>
	<dd id="profilefield_value_{vb:raw profilefield.profilefieldid}" class="aboutme_right">
		{vb:raw profilefield.value}
		<script type="text/javascript">
		<!--
		vBulletin.register_control("vB_ProfilefieldEditor", "{vb:raw profilefield.profilefieldid}");
		//-->
		</script>
	</dd>
<vb:else />
	<dt>{vb:raw profilefield.title}:</dt>
	<dd>{vb:raw profilefield.value}</dd>
</vb:if>

</dl>

If I'm following correctly, you're saying I should replace the text above in red with this:

Code:
<vb:if condition="$profilefield[profilefieldid] == 7">
<a href="{vb:raw profilefield.value}">{vb:raw profilefield.value}</a>
<vb:else />
{vb:raw profilefield.value}
</vb:if>

...and, strangely, it works to make field 7 into a hyperlink when a user is viewing their own profile in Edit mode, but when you click on "View your About Me as seen by everyone else," and when you view another user's profile, field 7 no longer appears as a hyperlink.

So, instead, I tried replacing this other text in blue:

Code:
<dl>
<vb:if condition="$show['profilefield_edit']">
	<dt id="profilefield_title_{vb:raw profilefield.profilefieldid}" class="aboutme_left">{vb:raw profilefield.title}</dt>
	<dd id="profilefield_value_{vb:raw profilefield.profilefieldid}" class="aboutme_right">
		{vb:raw profilefield.value}
		<script type="text/javascript">
		<!--
		vBulletin.register_control("vB_ProfilefieldEditor", "{vb:raw profilefield.profilefieldid}");
		//-->
		</script>
	</dd>
<vb:else />
	<dt>{vb:raw profilefield.title}:</dt>
	<dd>{vb:raw profilefield.value}</dd>
</vb:if>

</dl>

...and then field 7 started showing as a hyperlink in "as seen by everyone else" mode. Well, that's better, at least!

Then I thought, why not just replace both the red and the blue text? Perhaps this is what you were getting at in your post, but if so, I totally missed it. So, my final code looks like this:

Code:
<dl>
<vb:if condition="$show['profilefield_edit']">
	<dt id="profilefield_title_{vb:raw profilefield.profilefieldid}" class="aboutme_left">{vb:raw profilefield.title}</dt>
	<dd id="profilefield_value_{vb:raw profilefield.profilefieldid}" class="aboutme_right">
		<vb:if condition="$profilefield[profilefieldid] == 7">
                <a href="{vb:raw profilefield.value}" target="blank">{vb:raw profilefield.value}</a>
                <vb:else />
                {vb:raw profilefield.value}
                </vb:if>
		<script type="text/javascript">
		<!--
		vBulletin.register_control("vB_ProfilefieldEditor", "{vb:raw profilefield.profilefieldid}");
		//-->
		</script>
	</dd>
<vb:else />
	<dt>{vb:raw profilefield.title}:</dt>
	<dd><vb:if condition="$profilefield[profilefieldid] == 7">
        <a href="{vb:raw profilefield.value}" target="blank">{vb:raw profilefield.value}</a>
        <vb:else />
        {vb:raw profilefield.value}
        </vb:if></dd>
</vb:if>

</dl>

...and now field 7 appears as a hyperlink both in Edit mode and in "as seen by everyone else" mode. Woohoo! THANK YOU!
Reply With Quote
2 благодарности(ей) от:
kh99, tbworld
  #9  
Old 06-05-2014, 07:28 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That wasn't what I was getting at, I didn't realize it was using different code for the different pages. Anyway, I'm glad you got it figured out, good work, and thanks for posting the result.
Reply With Quote
  #10  
Old 06-07-2014, 07:43 AM
Elite_360_'s Avatar
Elite_360_ Elite_360_ is offline
 
Join Date: Nov 2012
Location: New Hampshire
Posts: 518
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=290163" target="_blank">e360 User's Social Links</a>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:05 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04324 seconds
  • Memory Usage 2,268KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (8)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete