MyBB Community Forums

Full Version: Manually but properly inserting a new forum user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello! I am new here on this Forum so I have no idea if this is the right place to post this, but this is the only board where it's talked about development, and my problem and solution contains SQL code so I hope it's good enough (even though I'm not actually making a forum plugin, but uhh.. i'll explain further in topic)

I am running a VPS which hosts my game server and I am trying to link in-game registrations with MyBB Forum. Meaning that when a user registers in my server, my server needs to contact my MyBB Forum in order to create a new user. However, I am not sure which method to use to achieve this, and partially not sure how to execute it due to little knowledge of internal code (other than looking at some GitHub source code).

Method 1:
Insert into Forum MySQL database user info (table mybb_users, are there any other that I need to as well?)
I'm not sure how this method would work because I feel it's not "natural" for MyBB to have it added just like this...

Method 2:
Call a vanilla or custom php script and 'fake' a registration by filling out the necessary data (as if it was a real user who registered, and to force it to pass all checks)
I'm not sure if I'd need to call vanilla or custom php script, and if I'd need to make a forum plugin, also I'm not sure which data to fill and what to fill it with (is there any documentation for that? I only found some outdated 1.6 doc about mybb_users, but it doesn't show examples of filled data nor how to generate it)

My apologies if this is not explained well, I tried my best to shorten it.

Thanks for reading!
(2020-04-04, 01:43 PM)Devilshakerz Wrote: [ -> ]See https://community.mybb.com/thread-215535...pid1295747 and an example from the ACP: https://github.com/mybb/mybb/blob/mybb_1...#L327-L357

Thanks!

However I am getting this error:

Quote:Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.


Folder in which my php is located is outside of my forum folder, is there a way to fix this? (i was trying to load global.php)
If I can't load it at all this way, from where do I need to load it from? As in; from which directory?
IN_MyBB can be defined at the beginning of your file
<?php
define("IN_MYBB", 1);
require_once "path/to/global.php";
Thank you both!
I took some time to respond due to testing how everything works, and now I can add users to my Forum from within my game server!
Heart