PDA

View Full Version : Adding additonal info in postbit


sherwood
01-03-2010, 06:24 PM
Would this condition still work in vb 4:
<if condition="$post[fieldx]"><div class="smallfont">Label for text: $post[fieldx]</div></if>

If not what would do the same thing as I'm wanting to display a custom profile field in the postbit.

Thanks

Vaupell
01-03-2010, 06:32 PM
nope but this would

<vb:if condition="$post['fieldX']"><div class="smallfont">Label for text: {vb:raw post.fieldX}</div></vb:if>

sherwood
01-03-2010, 06:40 PM
Thank you

claudib
01-03-2010, 11:08 PM
I am trying to use this code in a widget and it doesn't work? Any ideas?
Thanks

Charlie98902
01-04-2010, 12:43 AM
So this entry would go under the posts field I assume in the postbit? I need 2 things to show in mine and I planned on making the profile fields for it and mandatory as well.

This code is what I am referring too.

<vb:if condition="$post['fieldX']"><div class="smallfont">Label for text: {vb:raw post.fieldX}</div></vb:if>

Dygear
01-04-2010, 06:50 AM
<vb:if condition="$post['fieldX']"><dt>Level of Care:</dt> <dd>{vb:raw post.fieldX}</dd></vb:if>

But it's meant to look like this now right? They have some new markup.

Vaupell
01-04-2010, 09:34 AM
So this entry would go under the posts field I assume in the postbit? I need 2 things to show in mine and I planned on making the profile fields for it and mandatory as well.

This code is what I am referring too.

<vb:if condition="$post['fieldX']"><div class="smallfont">Label for text: {vb:raw post.fieldX}</div></vb:if>

yes you can place it anywhere really, but either
postbit or postbit_legacy

Then ofcourse REPLACE fieldX where the x is the number of the userfield you created in
adminCP, so if you go and create a field now, after done in the userfield manager i would
says "EXSAMPLE" field5 and thats what the condition should see, and also what
vbraw shows on the screen.

If condition here, ONLY shows the content IF the user have something in the field,
if the field is blank, then it wont show in the posts.


All of this can allso just be dont with a plugin, which i feel is more "clean" and i use that myself.
plugins over template edits anyday :D

Charlie98902
01-04-2010, 10:20 AM
Well I asked for the plugin to get updated but I have no issue doing a template edit as the plugin for 3.8 lacked if you were able to choose several options for one field and the text wrap was a bug but fixable.

Thanks for the info so I can start on this in my test forum.

consolegaming
01-04-2010, 10:51 AM
Well I asked for the plugin to get updated but I have no issue doing a template edit as the plugin for 3.8 lacked if you were able to choose several options for one field and the text wrap was a bug but fixable.

Thanks for the info so I can start on this in my test forum.

Well I don't know about Vaupell but I just use a custom plugin and then attach it to a hook at the end. i.e.

if($post[field9]) $html .= '<dt>Clan</dt> <dd>'.$post[field9].'</dd>';
if($post[field5]) $html .= '<dt>PS2</dt> <dd>'.$post[field5].'</dd>';
if($post[field6]) $html .= '<dt>PS3</dt> <dd>'.$post[field6].'</dd>';
if($post[field7]) $html .= '<dt>XBL</dt> <dd>'.$post[field7].'</dd>';
if($post[field8]) $html .= '<dt>Wii</dt> <dd>'.$post[field8].'</dd>';
$html .='<br /><br />';

$template_hook['postbit_userinfo_right_after_posts'] .= $html;

I just have that as a plugin attached to the postbit_display_start hook and that works great for me. And no template changes needed.

It's just an alternative way of doing the same thing.

Charlie98902
01-04-2010, 11:04 AM
Thanks I may look into that one first.

--------------- Added 1262612293 at 1262612293 ---------------

Well I don't know about Vaupell but I just use a custom plugin and then attach it to a hook at the end. i.e.

if($post[field9]) $html .= '<dt>Clan</dt> <dd>'.$post[field9].'</dd>';
if($post[field5]) $html .= '<dt>PS2</dt> <dd>'.$post[field5].'</dd>';
if($post[field6]) $html .= '<dt>PS3</dt> <dd>'.$post[field6].'</dd>';
if($post[field7]) $html .= '<dt>XBL</dt> <dd>'.$post[field7].'</dd>';
if($post[field8]) $html .= '<dt>Wii</dt> <dd>'.$post[field8].'</dd>';
$html .='<br /><br />';

$template_hook['postbit_userinfo_right_after_posts'] .= $html;

I just have that as a plugin attached to the postbit_display_start hook and that works great for me. And no template changes needed.

It's just an alternative way of doing the same thing.

How would I go about making the answer to the profile field bold/strong?

--------------- Added 1262616491 at 1262616491 ---------------

Also how would I go about making a notice to users so they know they need to edit their profile as I run a software support and making it mandatory. This way I will not be or need to mass email users. Kind of like a notice to users if condition isn't met is what I am looking for I do believe.

consolegaming
01-04-2010, 01:02 PM
Just add <strong></strong> tags around the variable i.e.

if($post[field8]) $html .= '<dt>Wii</dt> <dd><strong>'.$post[field8].'</strong></dd>';

That should do that part. For your second question firstly I'd recommend looking at the Field Required option for the profile field (assuming you've used a profile field yea?) If you set that to yes always it forces them to set it before they can use the forums (existing/new members).

Charlie98902
01-04-2010, 01:11 PM
Thanks I didn't try the <strong> but did try <b> and got a syntax error :)

--------------- Added 1262621512 at 1262621512 ---------------

Strong html didn't work either but no errors using it.

Vaupell
01-04-2010, 02:12 PM
i do something like this in plugins

Hook : postbit_display_complete


if (!empty($post["field9"]))
{
$template_hook['postbit_userinfo_right_after_posts'] .= '<dd>' . 'Test : ' . $post["field9"] . '</dd>';
}

Execution Order : is just if i want it to show before or after the other plugins at same hook.
might change this number to fit your personal preferences.

Charlie98902
01-04-2010, 02:28 PM
Nice. Is there a way to have the chosen field bold or both fieldx and choice bold?

Dygear
01-04-2010, 04:23 PM
Thanks I didn't try the <strong> but did try <b> and got a syntax error :)

--------------- Added 1262621512 at 1262621512 ---------------

Strong html didn't work either but no errors using it.

Try editing the dd tag directly inline with this:

<dd style="font-weight: bold;">

However, I would recommend using a vb style variable as it would provide a more consistent user experience and might cause you less of a headache in the future.

voglermc
01-04-2010, 08:29 PM
Anyone know the correct code for users album link in their postbit?

UTE304
01-06-2010, 09:17 PM
Guys,

I've been following the useful info in this topic. But I have a little more work I'd like to do on this area.

Could you look at the attached pic, and advise me on how to achieve that? RED text request only, I fixed the first problem using Dygear's code.

Thanks

Steve.

Dygear
01-07-2010, 04:26 AM
Could you look at the attached pic, and advise me on how to achieve that?

That is going to be a CSS edit. I've never edited the CSS file within vB so I don't know what this entails, but baiscly I would think your looking for the dd declaration within the CSS file, and just editing the width attribute to a value that is more suitable. Hopefully that's all you will need to do.

Looks like the community really could use a guide on how to customize post bits, it seems to be in demand.