MyBB Hacks

Full Version: Add contact information on new threard
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all
I want to make a field that requires your contact information when you post a new threard. Can you help me? I tried with XThreards, but I could not make it work. Thanks
You can use textbox input field type:

Create a custom thread fields:
Admin CP -> Configuration -> Custom Thread Fields -> Add Thread Field, or see this post for screenshot:
http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=291&pid=31

Setting for the custom thread field:
  • Title: Contact Information
  • Key: contact_info
  • Description: Your Contact Information - Required
    Modify it as your needs. The description will appear bellow the Contact Information textbox.
  • Applicable Forums : 'Choose a forum where we want the Contact Information applied
  • Input Field Type : Textbox
  • Editable by / Required Field? : Everyone (required)
  • Display Format :

    HTML Code
    <div>Contact Information: {VALUE}</div>

    Modify it as our needs. This is how the Contact Information will be displayed later in our template.


Now, when a user create a new thread or edit their thread, they will see a contact information textbox:
[attachment=200]

If user didn't fill their contact information, the error message will be displayed:
[attachment=201]

Now, we need to put the contact information to our template. Depends on where we want to display it.
For example, if we want to put it in postbit template, we need to edit our postbit and postbit_classic template.
The variable we need to put to display the Contact Information is:

Code:
{$GLOBALS['threadfields']['contact_info']}


Lets say that we want to display it above the post message.
Find this code in our postbit and postbit_classic template:

Code:
{$post['message']}


Then, add the {$GLOBALS['threadfields']['contact_info']} variable above the {$post['message']} vairiable. Something like this:

Code:
{$GLOBALS['threadfields']['contact_info']}
{$post['message']}


The result will be like this (horizontal and classic):
[attachment=202] [attachment=203]

Brilliant Smile

Thank You RateU !
Reference URL's