MyBB Community Forums

Full Version: Change length of invite code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm currently using this plugin to create invite codes for my forum:

https://community.mybb.com/mods.php?acti...w&pid=1419

Does anyone know how to change the length/value of the generated code itself?
Basically I want the invite code to be longer, like this: 153Ba24ac52ad22d4a6c5a0603ed479d7bb3f64c

Thanks in advance.
You need to edit the file "./Upload/inc/plugins/invite.php" of the plugin and change the following function in line 1081:
$code = random_str(8);
Replace the digit "8" by whatever the length of your desired string.

[ETS]
Hey,

Thank you for your reply.

I changed 8 to 30 but when I click on Add Invitation it just says the invitation code is too long.

Is there anything else in invite.php I need to change?
When this plugin adds another field in any table, then also check the table schema and increase the data lenght to 30 as well.

Better do it within the PHP file (so you stay safe when de/installing this plugin):
invite.php, line 40...
$db->query("CREATE TABLE `".TABLE_PREFIX."invitecodes` (
  `id` int(10) NOT NULL auto_increment PRIMARY KEY ,
  `code` varchar(10) NOT NULL,
[...]
varchar(10) -> varchar(30)

[ExiTuS]
Thank you for your help, works as intended now! Smile