vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Custom Field in Postbit_legacy (https://vborg.vbsupport.ru/showthread.php?t=266779)

J. Schultz 07-14-2011 01:39 AM

Custom Field in Postbit_legacy
 
Hi all,

I read through Lynne's great article on adding custom fields to the postbit, found here.

I've managed to get this set up and my test forum is displaying the field. However, I would like to move this field and I'm running into problems figuring it out.

Right now, it displays the following (assuming user is "Admin" and custom field is "TEST"):

Quote:

TEST
Admin
I would like to have it place the custom field in front of the user name, like so:

Quote:

TEST Admin

Any help, or a gentle push in the right direction, is appreciated!

Thank you,

James

LifesGreatestGift 07-14-2011 01:54 AM

show us your code for the elements and their placement in your postbit(or postbit_legacy) template. An example page would be even better.

Lynne 07-14-2011 02:04 AM

We really need to see this in use to see the actual source code and also see your plugin/template code in order to make a recommendation on what to change.

J. Schultz 07-14-2011 02:35 AM

Good news! I got it figured out. Guess I just needed to take a step away from the keyboard for a moment and look over what I had.

Here's the code taken from postbit_legacy:
Quote:

<div class="postdetails">
<div class="userinfo">
<div class="username_container">
<vb:if condition="$post['field6']"> <dd>{vb:raw post.field6}</dd></vb:if>
<vb:if condition="$post['userid']">
{vb:raw memberaction_dropdown}
{vb:raw post.onlinestatus}
<vb:else />
Where 'field6' is my custom field. Turned out this:

https://vborg.vbsupport.ru/external/2011/07/75.jpg


I changed it as follows:

Quote:

<div class="postdetails">
<div class="userinfo">
<div class="username_container">
<vb:if condition="$post['field6'] "$post['userid']">
{vb:raw post.field6}
{vb:raw memberaction_dropdown}
{vb:raw post.onlinestatus}
<vb:else />
And now I have what I was looking for:

https://vborg.vbsupport.ru/external/2011/07/76.jpg


Any critiques?

Now to get the text formatting to match :)

ForumExcellence 07-14-2011 05:20 AM

Quote:

Originally Posted by J. Schultz (Post 2220295)
Any critiques?

Now to get the text formatting to match :)

Change to:

Code:

<div class="postdetails">
<div class="userinfo">
<div class="username_container">
<vb:if condition="$post['field6']">
<span class="postbit-postfield6">{vb:raw post.field6}</span>
</vb:if>
<vb:if condition="$post['userid']">
{vb:raw memberaction_dropdown}
{vb:raw post.onlinestatus}
<vb:else />


Then, open postbit.css

Find:

Code:

.postbitlegacy .userinfo a.username, .eventbit .userinfo a.username {
        clear:{vb:stylevar right};
        font-size:{vb:stylevar font.fontSize}{vb:stylevar font.units};
        font-weight:bold;
        width: auto;
        max-width:{vb:math {vb:stylevar postbitlegacy_userinfo_width} - {vb:math {vb:stylevar padding}*2} - 20px};
        word-wrap:break-word;
}


There may be something different for your style after the emphasized line, so just look for that line and then copy everything between it and the }, then paste it right under (but leave the original!), then change where it says "a.username" on the one you pasted, to ".postbit-postfield6", and change ", .eventbit .userinfo a.username" to:

Code:

, .postbit .contact .postbit-postfield6

If you would like to use a specific colour for that text, find "font-weight:bold;", then add the following line underneath it (changing the emphasized text with the appropriate hex value, including the # sign - I've set it as white, most hex codes will be 6 characters long):

Code:

color:#fff;

You can also add this instead to use the default link colour:

Code:

color:{vb:stylevar link_color};

So the whole thing should now look something like:

Code:

.postbitlegacy .userinfo .postbit-postfield6, .postbit .contact .postbit-postfield6 {
        clear:{vb:stylevar right};
        font-size:{vb:stylevar font.fontSize}{vb:stylevar font.units};
        font-weight:bold;
        color:#fff;
        width: auto;
        max-width:{vb:math {vb:stylevar postbitlegacy_userinfo_width} - {vb:math {vb:stylevar padding}*2} - 20px};
        word-wrap:break-word;
}


This will work even if you choose to change to the horizontal postbit template later.

If you are using specific HTML markups per usergroup, and would like your text to have the same markup for your postbit field based on each member's usergroup, the easiest way would be to use the following syntax (adding as many "<vb:elseif />" conditionals as you have usergroups with their own HTML markups which you'd like to duplicate, with the last "<vb:else />" being what shows for everybody else, and ending with a "</vb:if>"), making sure to add additional CSS rules (as above) for each new class, as required. For example:

Code:

<div class="postdetails">
<div class="userinfo">
<div class="username_container">
<vb:if condition="$post['field6']">
<vb:if condition="is_member_of($bbuserinfo, 6)">
<span class="postbit-postfield6-6">
<vb:elseif condition="is_member_of($bbuserinfo, 7)" />
<span class="postbit-postfield6-7">
<vb:else />
<span class="postbit-postfield6"></vb:if>
{vb:raw post.field6}</span>
</vb:if>
<vb:if condition="$post['userid']">
{vb:raw memberaction_dropdown}
{vb:raw post.onlinestatus}
<vb:else />


In this case, I added an additional "-#" to the end of the class name to denote a particular usergroup number, however, you can change them however you like, as long as you maintain proper syntax. Remember to make the appropriate changes in both selector instances in each new rule (as emphasized):

Code:

.postbitlegacy .userinfo .postbit-postfield6-7, .postbit .contact .postbit-postfield6-7 {
        clear:{vb:stylevar right};
        font-size:{vb:stylevar font.fontSize}{vb:stylevar font.units};
        font-weight:bold;
        color:#000;
        width: auto;
        max-width:{vb:math {vb:stylevar postbitlegacy_userinfo_width} - {vb:math {vb:stylevar padding}*2} - 20px};
        word-wrap:break-word;
}


J. Schultz 07-18-2011 04:16 PM

Thank you, very much. Working exactly as I'd hoped, and looks sharp too :)


All times are GMT. The time now is 12:29 PM.

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.01204 seconds
  • Memory Usage 1,745KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete