MyBB Community Forums

Full Version: Inserting data into users table.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys I have a small doubt.

I'm using a donation system on my forum and its quite easy to implement really. I have the API and all that stuff and its working well however,

There is a textfield on the donation page and user has to enter a value there and I want to store that value in the Users database under the STATUS column.

Each time user donates I would like to Update the status column of the logged in user by inserting the $custom value (This is the textfield value)

https://gyazo.com/ce3109d5dc89a13472c2445ba7e66da4 

^ Look at the CUSTOM COLUMN.

$custom = $_GET['custom'];

How would I achieve this? I have obviously created a plugin to do all this work but I cant figure out the rest.

Cheers.
you need something like this wherever your form is submitted.
if($mybb->request_method == 'post')
{
    verify_post_check();
    $custom = $db->escape_string(trim($mybb->get_input('custom')));
    $db->update_query('users', array('status' => $custom), "uid = '{$mybb->user['uid']}'");
}

you should also definitely do some basic checks to make sure a user is actually trying to input a numeric value