***MyBB does not endorse or approve anything done below. Proceed at your own risk.***
This guide elaborates on information given in this thread:
https://community.mybb.com/thread-134852.html
Read that before attempting anything done below.
Say you want to change the ICQ field on your "Additional Contact Information" page to a Discord field, for instance. You've changed the other contact fields to newfangled social media platforms like Facebook and Twitter, so of course this one should work the same way, right?
Alright, so you change the language files like normal, but this time you get an error. You're perplexed! Well, the reason that happens is because MyBB has a nice little integer check in a few places for the ICQ value. Here's how to disable that check.
Notes:
- This tutorial involves editing the MySQL database through phpMyAdmin. If this daunts you, maybe don't do the things listed here or ask a friend for help.
- This is only tested in MyBB 1.8.13.
- I don't take responsibility for any damage you cause with this code to your files or forum.
Files modified:
- usercp.php
- /inc/datahandlers/user.php
1. BACKUP BOTH THE FILES LISTED ABOVE, AND YOUR DATABASE.
2. Open usercp.php and make these changes:
- Replace this:
with this:
- Replace this:
with this:
3. Open inc/datahandlers/user.php and make these changes:
- Find and delete this:
- Replace this:
with:
- Replace this:
with this:
3. Save and quit, re-upload the files back to your server.
4. Open your MySQL database and go to the table titled "yourtableprefix_users".
5. Click the Structure tab and find the ICQ row (it should be #21).
6. Click the change button found in the ICQ row.
7. Change the value of "Length/Values" to your desired maximum character limit for the new type of field and click "Save."
8. OPTIONAL: MyBB saves a default value of 0 for the icq column. Click the SQL tab and enter this to clear all of the zeros:
That's it! Any questions can be put below.
@Staff: I'm not sure if anything here was against the rules. If it was, feel free to edit it out or delete the thread entirely.
This guide elaborates on information given in this thread:
https://community.mybb.com/thread-134852.html
Read that before attempting anything done below.
Say you want to change the ICQ field on your "Additional Contact Information" page to a Discord field, for instance. You've changed the other contact fields to newfangled social media platforms like Facebook and Twitter, so of course this one should work the same way, right?
Alright, so you change the language files like normal, but this time you get an error. You're perplexed! Well, the reason that happens is because MyBB has a nice little integer check in a few places for the ICQ value. Here's how to disable that check.
Notes:
- This tutorial involves editing the MySQL database through phpMyAdmin. If this daunts you, maybe don't do the things listed here or ask a friend for help.
- This is only tested in MyBB 1.8.13.
- I don't take responsibility for any damage you cause with this code to your files or forum.
Files modified:
- usercp.php
- /inc/datahandlers/user.php
1. BACKUP BOTH THE FILES LISTED ABOVE, AND YOUR DATABASE.
2. Open usercp.php and make these changes:
- Replace this:
PHP Code:
foreach(array('icq', 'aim', 'yahoo', 'skype', 'google') as $cfield)
{
$csetting = 'allow'.$cfield.'field';
if($mybb->settings[$csetting] == '')
{
continue;
}
if(!is_member($mybb->settings[$csetting]))
{
continue;
}
if($cfield == 'icq')
{
$user[$cfield] = $mybb->get_input($cfield, 1);
}
else
{
$user[$cfield] = $mybb->get_input($cfield);
}
}
PHP Code:
foreach(array('icq', 'aim', 'yahoo', 'skype', 'google') as $cfield)
{
$csetting = 'allow'.$cfield.'field';
if($mybb->settings[$csetting] == '')
{
continue;
}
if(!is_member($mybb->settings[$csetting]))
{
continue;
}
$user[$cfield] = $mybb->get_input($cfield);
}
- Replace this:
PHP Code:
if($user['icq'] != "0")
{
$user['icq'] = (int)$user['icq'];
}
if($user['icq'] == 0)
{
$user['icq'] = '';
}
if($errors)
{
$user['skype'] = htmlspecialchars_uni($user['skype']);
$user['google'] = htmlspecialchars_uni($user['google']);
$user['aim'] = htmlspecialchars_uni($user['aim']);
$user['yahoo'] = htmlspecialchars_uni($user['yahoo']);
}
PHP Code:
if($errors)
{
$user['icq'] = htmlspecialchars_uni($user['icq']);
$user['skype'] = htmlspecialchars_uni($user['skype']);
$user['google'] = htmlspecialchars_uni($user['google']);
$user['aim'] = htmlspecialchars_uni($user['aim']);
$user['yahoo'] = htmlspecialchars_uni($user['yahoo']);
}
3. Open inc/datahandlers/user.php and make these changes:
- Find and delete this:
PHP Code:
if($this->method == "insert" || array_key_exists('icq', $user))
{
$this->verify_icq();
}
- Replace this:
PHP Code:
"website" => $db->escape_string($user['website']),
"icq" => (int)$user['icq'],
"aim" => $db->escape_string($user['aim']),
"yahoo" => $db->escape_string($user['yahoo']),
"skype" => $db->escape_string($user['skype']),
"google" => $db->escape_string($user['google']),
PHP Code:
"website" => $db->escape_string($user['website']),
"icq" => $db->escape_string($user['icq']),
"aim" => $db->escape_string($user['aim']),
"yahoo" => $db->escape_string($user['yahoo']),
"skype" => $db->escape_string($user['skype']),
"google" => $db->escape_string($user['google']),
- Replace this:
PHP Code:
if(isset($user['icq']))
{
$this->user_update_data['icq'] = (int)$user['icq'];
}
PHP Code:
if(isset($user['icq']))
{
$this->user_update_data['icq'] = $db->escape_string($user['icq']);
}
3. Save and quit, re-upload the files back to your server.
4. Open your MySQL database and go to the table titled "yourtableprefix_users".
5. Click the Structure tab and find the ICQ row (it should be #21).
6. Click the change button found in the ICQ row.
7. Change the value of "Length/Values" to your desired maximum character limit for the new type of field and click "Save."
8. OPTIONAL: MyBB saves a default value of 0 for the icq column. Click the SQL tab and enter this to clear all of the zeros:
Code:
UPDATE `yourtableprefix_users`
SET `icq` = ''
WHERE `icq` = '0';
That's it! Any questions can be put below.
@Staff: I'm not sure if anything here was against the rules. If it was, feel free to edit it out or delete the thread entirely.