Turning Custom Profile Field Into Link

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ellendway
    Member
    • Jan 2011
    • 66
    • 4.2.X

    [Forum] Turning Custom Profile Field Into Link

    Hello everyone,

    I've got a question about Custom Profile Fields. I was able to add new fields to a profile but I want to turn some of these fields to url links. Is there any chance to do it?

    Thanks
    Attached Files
    Last edited by Ellendway; Sat 17 Nov '12, 6:35am.
  • djbaxter
    Senior Member
    • Aug 2006
    • 1418
    • 4.2.5

    #2
    Do you mean you want to take the contents of a field and post it as a live link somewhere in your forum?

    If so, find the appropriate template where you want the link displayed and use something like the following:

    <a href="{vb:raw post.fieldX}" target="_blank">{vb:raw post.fieldX}</a>

    Replace fieldX with the id number of the custom field, e.g., field6 or field 9.
    Psychlinks Web Services Affordable Web Design & Site Management
    Specializing in Small Businesses and vBulletin/Xenforo Forums

    Comment

    • Ellendway
      Member
      • Jan 2011
      • 66
      • 4.2.X

      #3
      Thanks for the answer but this is not what I want. I'd like to have URLs to other websites (eg Facebook or Twitter).

      Comment

      • djbaxter
        Senior Member
        • Aug 2006
        • 1418
        • 4.2.5

        #4
        That IS what you want. If you place a URL to any site you like in custom profile field6, you can have it displayed anywhere you like as <a href="{vb:raw post.fieldX}" target="_blank">{vb:raw post.fieldX}</a> by placing that code in the appropriate location. That might even by right below the text field in the member profile if you wish. Or you could get fancy and even hide the text field if not empty and replace it with the active link.

        For example, if custom field6 contains https://www.vbulletin.com/forum/showthread.php/410824-Turning-Custom-Profile-Field-Into-Link?p=2358880#post2358880, using the code above the contents of the field would be converted as <a href="https://www.vbulletin.com/forum/showthread.php/410824-Turning-Custom-Profile-Field-Into-Link?p=2358880#post2358880" target="_blank">https://www.vbulletin.com/forum/showthread.php/410824-Turning-Custom-Profile-Field-Into-Link?p=2358880#post2358880</a> and would be displayed as a live link: https://www.vbulletin.com/forum/show...80#post2358880
        Psychlinks Web Services Affordable Web Design & Site Management
        Specializing in Small Businesses and vBulletin/Xenforo Forums

        Comment

        • Ellendway
          Member
          • Jan 2011
          • 66
          • 4.2.X

          #5
          Good. May I know the location where I must add the code? Just to be really honest I have no idea where to add that.

          Thanks.

          Comment

          • djbaxter
            Senior Member
            • Aug 2006
            • 1418
            • 4.2.5

            #6
            That depends on where you want the link to be displayed. You would edit the postbit or postbit_legacy template if you want it to appear on members' posts. If you want it to appear somewhere in the profile, you would edit one of the Modify User Options templates (e.g., modifyoptions) or one of the Member Info templates (e.g., MEMBERINFO).

            If you're unsure about editing templates, you may need to solicit paid or volunteer help to do it. But the first step is identifying where you want it to appear... then perhaps I can give you more specific code to enter and tell you where to enter it.
            Psychlinks Web Services Affordable Web Design & Site Management
            Specializing in Small Businesses and vBulletin/Xenforo Forums

            Comment

            • Ellendway
              Member
              • Jan 2011
              • 66
              • 4.2.X

              #7
              I'd like to have that on a profile page in About Me tab.

              Comment

              • djbaxter
                Senior Member
                • Aug 2006
                • 1418
                • 4.2.5

                #8
                Originally posted by Ellendway
                I'd like to have that on a profile page in About Me tab.
                OK. I'm in the middle of some other stuff so this isn't quite correct yet, but this is a quick start that perhaps others can refine (or I can do more research later):

                In template memberinfo_block_aboutme:

                FIND:

                Code:
                        {vb: raw block_data.fields}
                BEFORE/ABOVE this ADD:

                Code:
                <dl>
                <dt>Links:</dt>
                <dd>Link 1: <a href="{vb:raw $bbuserinfo.field7}" target="_blank">{vb:raw $bbuserinfo.field7}</a></dd>
                <dd>Link 2: <a href="{vb:raw $bbuserinfo.field8}" target="_blank">{vb:raw $bbuserinfo.field8}</a></dd>
                <br />
                </dl>
                1. Change "Link 1" and "Link 2" to appropriate labels like Twitter, Facebook, or whatever.
                2. Change field7 and field8 to the specific ID numbers of your custom fields.
                3. Then add further links as required.


                You can also explore other locations for this code as you wish.

                ERROR:This code as written is INCORRECT because it will display the links for the member VIEWING the About Me profile, NOT the links for the member being viewed. What needs to be changed is the $bbuserinfo part in the links but I haven't identified yet what it needs to be changed to (again, limited time at the moment).

                Anyone else want to chime in here? If not bump the thread and I'll try to look further later...
                Psychlinks Web Services Affordable Web Design & Site Management
                Specializing in Small Businesses and vBulletin/Xenforo Forums

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...