Announcement

Collapse
No announcement yet.

Custom Profile Field - Add to Thread/Under Avatar Graphic?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] Custom Profile Field - Add to Thread/Under Avatar Graphic?

    I have added a custom profile field for my users, and they have started using it. Shows up just fine in the memberlist page.

    But how do I get the custom field text to show up under their avatar in a discussion thread? or anywhere in the thread? i can see the location profile field show sup, but how do I do this on a custom field?

    Thanks, I've been looking in the manual but do not see this referenced anywhere...

  • #2
    Assuming you are using the Postbit Legacy mode. Edit the postbit_legacy template to add the following.

    Code:
    <vb:if condition="$post['userid']">
    <hr />
    <dl class="userinfo_extra">
    
    <!-- added the following custom fields information -->
    
    <vb:if condition="$post['field1']">Name: {vb:raw post.field1}
    <br /><br /></vb:if>
    
    <vb:if condition="$post['field2']">Location: {vb:raw post.field2}
    <br /><br /></vb:if>
    Change the field number as needed.

    Comment


    • #3
      Awesome, thanks. I guess I thought it was in the admincp settings somewhere else...

      Thanks

      Comment


      • #4
        Originally posted by Andy View Post
        Assuming you are using the Postbit Legacy mode. Edit the postbit_legacy template to add the following.

        Code:
        <vb:if condition="$post['userid']">
        <hr />
        <dl class="userinfo_extra">
         
        <!-- added the following custom fields information -->
         
        <vb:if condition="$post['field1']">Name: {vb:raw post.field1}
        <br /><br /></vb:if>
         
        <vb:if condition="$post['field2']">Location: {vb:raw post.field2}
        <br /><br /></vb:if>
        Change the field number as needed.
        Or a more semantically correct version would be:

        PHP Code:
        <vb:if condition="$post['userid']">
        <
        hr />
        <
        dl class="userinfo_extra">
        <!-- 
        added the following custom fields information -->
        <
        vb:if condition="$post['field1']">
         <
        dt>Name</dt> <dd>{vb:raw post.field1}</dd>
        </
        vb:if>
        <
        vb:if condition="$post['field2']">
         <
        dt>Location</dt> <dd>{vb:raw post.field2}</dd>
        </
        vb:if> 
        Because the field names and values are part of a definition list <dl>, they ought to be marked up as definition term <dt> and definition description <dd> pairs.
        My vBulletin: CADTutor - AutoCAD Forums

        Comment


        • #5
          Worked great! Thanks again

          Comment


          • #6
            Hi,

            I am not a coder but would love to use this information, could you explain what needs to be done in simpler terms? I know what you mean by edit the postbit legacy template, I am user what information to add in the post.field section. My custom profile field is a multiple choice check box.

            Many Thanks
            vBulletin - v4.0.4u1 (CMS), GoDaddy Hosting, Linux OS, MY SQL Database

            Addons:- vBH Add New Tabs 1.2, Forum Category Icons Advanced 1.2.4, Mini Photo Edit 1.0.1, VBadvanced CMPS 4.0.1, VSa Advanced New Posts 3.0.2, VSa Advanced Registration 2.0.1

            Comment


            • #7
              The information you need is the custom field name that you have created in the ACP. This will be in the form: "fieldnumber" (e.g. field6, field7, field8 etc.) and you can see it in the User Profile Field Manager screen. The input method is not relevant, so id doesn't matter whether you are using a check box, drop-down or just a text box.

              Click image for larger version

Name:	field.png
Views:	1
Size:	7.7 KB
ID:	3679705

              Once you have the custom field name that you want to display in postbit, build the code lines required to display it. For example, if I want to display the CPU a member is using (from the example in the image above), the template code would look like this:

              PHP Code:
              <vb:if condition="$post['field17']">
               <
              dt>CPU</dt> <dd>{vb:raw post.field17}</dd>
              </
              vb:if> 
              The first line checks to see if the member has entered a value for CPU in Settings>Edit Profile.

              Click image for larger version

Name:	cpu.png
Views:	1
Size:	7.2 KB
ID:	3679706

              If they have, the second line is executed. This adds a HTML definition term <dt> tag enclosing the description of the field (in this case "CPU") and then a definition data tag <dd> containing the actual value that the member entered in My Profile. If the member has not entered anything in the CPU field, the code does nothing.

              This code now needs to be added to the postbit_legacy template. Find the location in that template where the definition list for profile field begins, and then add your new bit of code where you would like your custom field to appear.

              For example, if you would like your custom field to appear after the "Posts" field, look for this code in the template:

              PHP Code:
              {vb:raw template_hook.postbit_userinfo_right_after_posts
              And add your new code immediately above it.

              The text "CPU: Intel Core2Duo E6850 @ 3.0 GHz" will be displayed below the post count in postbit legacy.

              Note, you do not need to include the colon ":" in the <dt> tag. It is magically added for you.

              Hope this helps.
              My vBulletin: CADTutor - AutoCAD Forums

              Comment


              • #8
                Thank for all that info and for taking the time to write it all up. I will have a go and get back to you.

                Much apreciated.

                Thanks
                vBulletin - v4.0.4u1 (CMS), GoDaddy Hosting, Linux OS, MY SQL Database

                Addons:- vBH Add New Tabs 1.2, Forum Category Icons Advanced 1.2.4, Mini Photo Edit 1.0.1, VBadvanced CMPS 4.0.1, VSa Advanced New Posts 3.0.2, VSa Advanced Registration 2.0.1

                Comment


                • #9
                  Is there such a simple solution for multiple checkbox custom fields? Using vb:raw post.field5 , I do not get the name of the choice, but the value of the field. I could do a condition check, but this seems kinda to complicated and just has to be possible in a cleaner way.

                  Thanks.

                  Comment


                  • #10
                    Originally posted by Axel-Fox View Post
                    Is there such a simple solution for multiple checkbox custom fields? Using vb:raw post.field5 , I do not get the name of the choice, but the value of the field. I could do a condition check, but this seems kinda to complicated and just has to be possible in a cleaner way.

                    Thanks.
                    I have the same problem with a multiple checkbox.

                    Anybody can help us?

                    Comment


                    • #11
                      I have the same problem with a multiple checkbox!!! Anybody can help us? I'll try to be more specific:

                      I have custom profile fields added to the user profile.
                      I added the following to the postbit_legacy template to display the fields, which is working:
                      <vb:if condition="$post['field5']"><dt>Model</dt> <dd>{vb:raw post.field5}</dd></vb:if>
                      However, two of the custom profile fields are "MULTIPLE SELECTION MENU" type fields, and they are displayed as the item number from the list of choices, instead of the text of the item choice.
                      The fields display correctly in the member list as well as the "about me" section of the user profile.
                      Is there a way to get the code in the postbit_legacy to display correctly the selected names?


                      Thanks for any info!

                      Comment


                      • #12
                        It is covered in here - http://www.vbulletin.com/forum/forum...tbit-templates

                        Please don't PM or VM me for support - I only help out in the threads.
                        vBulletin Manual & vBulletin 4.0 Code Documentation (API)
                        Want help modifying your vbulletin forum? Head on over to vbulletin.org
                        If I post CSS and you don't know where it goes, throw it into the additional.css template.

                        W3Schools &lt;- awesome site for html/css help

                        Comment


                        • #13
                          Thank for the information!
                          Last edited by xt660; Thu 3rd Apr '14, 6:49pm.

                          Comment

                          Related Topics

                          Collapse

                          Working...
                          X