Announcement

Collapse
No announcement yet.

Custom AND standard titles

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

  • Custom AND standard titles

    I've always thought that the custom title feature was neat, but I didn't like the way the standard titles were replaced by the custom titles. I think the standard titles are important, especially for Moderators (and Admins).

    So I set out to figure out how to have both, and after a little bit of digging, I figured out how to do it...and it's very simple!

    Step 1
    Create a new User Profile Field (in your Admin CP). For myself, I created a new field with these properties, in order from top to bottom: "Custom Title"; "If you would like a custom title to appear below your username (and above your standard title), please enter it here."; 25; 25; 5; No; No; Yes. Aside from the yes/no options, the others are more or less up to you. The purpose of each if explained decently enough.

    Step 2
    You need to determine the field ID number of your new field. If you've never before added a custom profile field, this should be 5. You can check this by using phpMyAdmin (or something like it, to view your database), looking in the table userfield, and figuring out which field is the one you just made. Now look at that field's name. For me, it was field5. (If you need additional help with this step, ask.)

    Step 3
    Edit your postbit template. What you need to do is insert this code somewhere into it: $post[field5] (Note that the part inside the square brackets must be the field name that you just determined in Step 2!) I wanted the custom title to appear below the username, and above the standard title, and to have the same formatting as the standard title. Therefore, the section of my postbit template that makes the author info area (the area to the left of messages where the username, avatar, post count, etc. are all located) looks like this:
    Code:
    <td bgcolor="$post[backcolor]" width="175" valign="top" nowrap>
    <a name="post$post[postid]"></a>
    $post[firstnewinsert]
    <normalfont><b>$post[username]</b></normalfont><br>
    <smallfont>$post[field5]</smallfont><br>
    <smallfont>$post[usertitle]</smallfont><br>
    $post[avatar]<br>
    <smallfont>$dctlink<br>
    Registered: $post[joindate]<br>
    Location: $post[field2]<br>
    Posts: $post[posts]</smallfont>
    </td>
    That's all there is to it. Don't forget to let your members know of the new functionality. If you have any questions, just ask...I realize sometimes my explanation skills are a bit wiggley.
    -Justin "JJR512" Rebbert
    JJR512.com: Chat about anything!

  • #2
    This works quite well, I put it up on my site.

    I too, wish there was an option in the control panel to allow for you to see the user title AND the custom user title both.

    ...because, while your method works great, it still inserts an extra line break if someone chooses not to fill it out, and that can be ugly. Same goes for calling any custom field from within the profile, to put inside the postbit.

    I wish someone could create some sort of if/then sorta thing, but that might prove extremely difficult.

    Ah well, can't win 'em all!
    -Jason / WTF.com

    "I think I've been quite clear that the new style will be in vB4." - Allen Lin / February 16, 2012

    Comment


    • #3
      OK, I've solved that problem, only it involves hacking.

      If a Moderator would be kind enough to move this to the Hacks Releases forum for 2.x, I would appreciate it. Thanks!

      Disregard the instructions from before, and start over again. (Note that the first two are the same, though.)

      Step 1.
      Create a new User Profile Field (in your Admin CP). For myself, I created a new field with these properties, in order from top to bottom: "Custom Title"; "If you would like a custom title to appear below your username (and above your standard title), please enter it here."; 25; 25; 5; No; No; Yes. Aside from the yes/no options, the others are more or less up to you. The purpose of each if explained decently enough.

      Step 2.
      You need to determine the field name in the database of your new field. If you've never before added a custom profile field, this should be field5. You can check this by using phpMyAdmin (or something like it, to view your database), looking in the table userfield, and figuring out which field is the one you just made. Now look at that field's name. For me, it was field5. (If you need additional help with this step, ask.)

      Step 3.
      Edit the file admin/function.php. Find this:
      PHP Code:
              if ($post[aim]!="") {
                  eval(
      "\$post[aimicon] = \"".gettemplate("aim")."\";");
              } else {
                  
      $post[aim]="";
              } 
      After that, add this:
      PHP Code:
              if ($userfield[field5]!="") {
                  
      $extratitle="";
              } else {
                  
      $extratitle="<br>$post[field5]";
              } 
      (Note that in this step, anywhere it says [field5], you would use the field name that you determined in Step 2!)

      Step 4.
      Edit the postbit template. Find this:
      PHP Code:
          <normalfont><b>$post[username]</b></normalfont><br>
          <
      smallfont>$post[usertitle]</smallfont><br
      And replace it with this:
      PHP Code:
          <normalfont><b>$post[username]</b></normalfont><br>
          <
      smallfont>$extratitle</smallfont>
          <
      smallfont>$post[usertitle]</smallfont><br
      -Justin "JJR512" Rebbert
      JJR512.com: Chat about anything!

      Comment


      • #4
        No wait, that's wrong...hold on...
        -Justin "JJR512" Rebbert
        JJR512.com: Chat about anything!

        Comment


        • #5
          lol

          -Jason / WTF.com

          "I think I've been quite clear that the new style will be in vB4." - Allen Lin / February 16, 2012

          Comment


          • #6
            If I actually knew what I was doing, this would have been a piece of cake! BUT since I don't, what I do is look at the existing code and try to find something similar to what I want to do, then make the appropriate customizations. It's mainly trial-and-error. I have no skill; it's all hard work and luck.

            But ANYway, I finally got it figured out!

            Following the instructions from my previous message, this is the additional code for Step 3. DO NOT use the added code from Step 3 given earlier; instead, use this:
            PHP Code:
                    if ($post[field5]) {
                        
            $extratitle="$post[field5]<br>";
                    } else {
                        
            $extratitle="";
                    } 
            That is the only change. NOW it should work with NO SPACE for people with no custom title, and for those that do, the custom title and standard title are on separate lines.
            -Justin "JJR512" Rebbert
            JJR512.com: Chat about anything!

            Comment


            • #7
              Just in case it wasn't obvious before, you must have the built-in Custom Title feature turned OFF! If you have it turned on, nothing bad will happen; this hack will still work. Only now your members will have two custom titles, and no standard title, which defeats the entire purpose of this hack.

              I have attached to this post the full and complete set of instructions, should you find it easier to work from a text file, or if you want to save it for later, in case you upgrade vBulletin or something.
              -Justin "JJR512" Rebbert
              JJR512.com: Chat about anything!

              Comment


              • #8
                Excellent, I'll give this a try today!

                This will also help with other fields I plan on showing the info from in threads!

                Thanks again!
                -Jason / WTF.com

                "I think I've been quite clear that the new style will be in vB4." - Allen Lin / February 16, 2012

                Comment


                • #9
                  is there somewhere where i can see this?

                  Comment


                  • #10
                    There is, at the board on my site: http://www.jjr512.com/forums/

                    Only the site is down right now (damned VeoWeb web host! ), so please let me explain to you what you would see, if you could actually see it.

                    It's very simple. See to the left you have your username in bold letters, and right below that is your title, like Senior Member or whatever. What this hack does is gives members the ability to type in a custom title for themselves, by typing it into their profile just as they would type in their location or job, and it will show up over there to the left, on a new line right below the member name, and above the regular title like Senior Member.

                    The part where they type in their custom title involves no hacking at all. It's just simply creating a new custom profile field through the admin cp and defining its parameters. The space to type in the title appears by itself on the Edit Profile screen.

                    The hacked part is that part that makes the custom title show up over there to the left, but does not make a blank empty line for people that have no custom title.

                    So suppose you decided to have a custom title. After typing it in in your profile, the space to the left would look like this:

                    ozone2000
                    This is my custom title!
                    Senior Member
                    <your avatar here>

                    Registered: Jun 2001
                    Location: denmark
                    Posts: 192
                    And at the same time, if I did not use a custom title, my posts would look like this on the left:
                    JJR512
                    Senior Member
                    <my avatar here>

                    Registered: Dec 2000
                    Location: Owings Mills, MD, USA (America Rules!)
                    Posts: 368
                    I hope that explains things! If not, keep checking my site, it should be up soon (I hope)!
                    -Justin "JJR512" Rebbert
                    JJR512.com: Chat about anything!

                    Comment


                    • #11
                      very great site indeed...I plan to implement the "active topics" and "top 5 count post" also in my own forum
                      iHu6.com (BETA) - www.ihu6.com

                      Comment


                      • #12
                        Sorry bit off the topic.
                        freehtml your forum looks good, just wondered if you wanted to match the remaining buttons.
                        Anyway did you a zip because I was bored and won't be offended if you don't like them or use them.
                        BB
                        Rheena.com For Xbox360 Wii-u PS Vita 3DS iphone ipad Android Devices And More

                        Comment


                        • #13
                          Great template!

                          Thanks for making it.
                          Last edited by rez; Wed 3 Oct '01, 9:37am.

                          Comment


                          • #14
                            Nice hack... but can't you simply avoid this by forcing the title for the user via admin cp. I could understand this being hell if you had a ton of moderators or admin... but otherwise, all I do is use the option to force the title regardless of whether someone tries to use a custom or not.

                            Comment


                            • #15
                              I don't want to force titles on anyone. If I wanted to force people to use standard titles, I simply would not use this hack, and would not use the built-in custom title feature. But I want to allow people to be able to use custom titles, I just don't want the standard title to disappear.

                              It's just a matter of what you want and what's important to you. If it's not important to you that the standard title still be visible, just use the built-in custom title feature.
                              -Justin "JJR512" Rebbert
                              JJR512.com: Chat about anything!

                              Comment

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