View Full Version : custom field in postbit
webmastershome
04-12-2006, 05:57 AM
Dear Sir,
Yes i am looking for new field.
I create a new field in member profile area single text box..
And define the value in showthread.php like belwo
$post['fieldx']
Now
I want this field value in PostBit template but there is no value here
Regards
Jitender
Jordan17
04-12-2006, 06:18 AM
<if condition $post['fieldx'];>$post['fieldx'];</if>
I think that should work.
Freesteyelz
04-12-2006, 06:18 AM
Use instead:
<if condition="$post['fieldx']">
$post[fieldx]
</if>
Where "x" is you will need to change it to the Field ID. The ID is found in the custom field you've created in Admin CP.
webmastershome
04-12-2006, 08:32 AM
thanks for your reply...
but i change the $post['fieldx'] in showthread.php as below
$post['my_variable']='text'.$post['fieldx'];
now when i call the $post['my_variable'] in postbit there is no value
Regards
Jitender
Borgs8472
04-12-2006, 11:42 AM
You only need to add this to postbit, nothing else
webmastershome
04-12-2006, 11:52 AM
but in postbit i have no value
i am using below
<if condition="!$post['my_variable']">
$post[my_variable]
</if>
peterska2
04-12-2006, 02:16 PM
but in postbit i have no value
i am using below
<if condition="!$post['my_variable']">
$post[my_variable]
</if>
Ok, there are a couple of things wrong with this which is why it isn't working.
A '!' means 'not' so what you are actually doing here is telling it that if it is not to post my_variable then you want it to post my_variable. So it is reading the if condition and ignoring it as it doesn't want to not to post it. Sounds confusing? Think how your poor site feels :p
If you are using a profile field that you have created as per your first post, then you do not need to use a different variable to call it. You simply use [fieldx] where x is the number assigned to the profile field in the profile field manager.So you should use
<if condition="$post[fieldx]">
$post[fieldx]
</if>
Make sure you replace both instances of x with the field number, found as detailed in point #2 above.
If you wish to add a label before the contents of the field, simply add this text before the middle line of code and ensure you leave a space, otherwise it will all run into one.
Freesteyelz
04-12-2006, 10:43 PM
Wow. Where did I go wrong? LOL. :D
peterska2
04-12-2006, 10:44 PM
Wow. Where did I go wrong? LOL. :D
Don't worry about it. Your code is good, it just got itself changed.
Freesteyelz
04-12-2006, 10:53 PM
No worries at all. I'm just having fun with it. :)
webmastershome
04-13-2006, 04:35 AM
hi there,
Thanks for view on this.
i want to add some variable in showthread.php or just define a varibale like below
$post['myvariable']='sometext';
and want to print in postbit
$post['myvariable']
when i use the above code , there is no value in the variable
How can i get this value in postbit template ?
Regards
jitender
Freesteyelz
04-13-2006, 06:01 AM
Hmm...Can you please give us an idea what variable you want to add in postbit? The reason I ask is that if it's simple text, image or template you do not need to mess with the core vB PHP files; you can simply use the plugin system.
webmastershome
04-13-2006, 06:15 AM
Thanks sir,
it's a number+text content,
if there is an simple way to add plugin with vb, i will try,
Because i am very new with VB programming
Regards
Jitender
Freesteyelz
04-13-2006, 07:37 AM
Well, a number and text can be done using the $vbphrase. Something more complex I'd create a custom template, add the plugin for it and call the content within the template.
I'm heading to bed now, however, so I'll check back tomorrow. :)
user02934123123
04-13-2006, 07:55 AM
<if condition $post['fieldx'];>$post['fieldx'];</if>
I think that should work.
If editing in posbit, it should be the case that you need to remove the inverted-commas around 'fieldx' outside the conditional, so the code looks like this:
<if condition="$post['fieldx']">$post[fieldx]</if>
webmastershome
04-13-2006, 08:15 AM
Well, a number and text can be done using the $vbphrase. Something more complex I'd create a custom template, add the plugin for it and call the content within the template.
I'm heading to bed now, however, so I'll check back tomorrow. :)
it's very good for me. please help me to make it, i am collecting some data from datastore with a template after 'hidprofilecache',
mytemplate
and add some condition on it for postbit.
it's a hack for 3.0.7 and i want to convert it to 3.5.4 and i want to add more option on it,
please help me to make it plugin system
Regards
Jitender
webmastershome
04-13-2006, 12:50 PM
hi there i have done it,
Thanks for you reply
Freesteyelz
04-13-2006, 11:09 PM
Cool! I definitely like self-serve service. LOL.
Quarterbore
04-26-2006, 04:51 PM
May I ask for some help to expand this a little more?
What I want to build is a Trouble ticket system and I could do this by simply creating a forum were all members can see the forum with permsssions to create a new thread, see their own posts, and reply to their own posts... They should not see other threads. So, if I was to set up a forum with pemissions like that and then give my Mods full permission to see and do all... this might make an easy site support system, right.
I believe what I need to do is include the info above with some forumid conditional such as assuming my forum #1 was trouble tickets...
<if condition="$foruminfo[forumid] == 1">
$post['subject']
$post['name']
$post['username']
$post['e-mail']
$post['phone']
</if>
where:
subject = Site Feedback, Registration issues, Log-In Problem, Other
name = Real Name
username = obvious but defined by system in logged in or entered if user can not log in
e-mail = obvious
phone = obvious
Is the best way to do this to add fields to the POST table? Next, I assume that the inputs need to get into the newthread template as well as the postbit as described in here for this to work... I assume a preview template and edit templates would need to be changed too?
Sorry to run off with this thread but the darned Contact Us e-mails are starting to kill me and I have a full staff that could handle 90% of the issues if only the issue would go on the forums.
For more info I did have my own thread on this posted here but this is the first chance to see if I could figure out how to do this on my own...
https://vborg.vbsupport.ru/showthread.php?t=113900
Most of the code already exists in the contactus template plus the minor upgrade I posted here:
https://vborg.vbsupport.ru/showthread.php?t=111728
I just need something like this and I don't claim any ownership to the idea... I just need to get out from under the 50 or more e-mails I seem to get every day from the four vBulletin forums I am trying to run!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.