How would I do this shit -- mybb & mysql make table and blah blah blah

by Hug - 26-04-2015, 08:31 AM
Closed Account
Posts:
2,770
Joined:
Jan 2015
Likes:
140
Credits:
1,306
Reputation:
28
2 Years of Service
#1
OP
Posted: 26-04-2015, 08:31 AM (This post was last modified: 26-04-2015, 08:32 AM by Hug.)
How would I make a function (MyBB) to create a table in the database, save different data per user, and then extract that data when I need to?

Hold on let me explain this better



How would I create a table in the mybb database, that would save $var1 in it but it would be different for every user

$var1 would be different for every user but default until my script changes it, it would be "blah"

and when my script changes it $var1 would change from being "blah" to "bleh" but it would only be that for that user unless someone else choice "bleh"


i need to store data in a seperate table in the mybb database

the data will be different for every user but on default til it is changed will be "blah"
and how would I get my script to change that data for that user?
Nan Ihier Gelair Mordor
Posts:
2,622
Joined:
Jan 2015
Likes:
279
Credits:
7,809
Reputation:
89
Developer
2 Years of Service
#2
Posted: 26-04-2015, 08:36 AM
You need to a plugin...

function hug_activate ()
{
global $db;
$db->query( 'ALTER TABLE '.TABLE_PREFIX.'users ADD `pomf` AFTER `uid`' );
}

function hug_pull()
{
global $mybb;
echo $mybb->user['pomf'];
}

function hug_push()
{
global $db;
//Assuming you have value of $var1 through solme form's POST/GET request
$db->update_query( 'users', array( 'pomf' => $var1 ), '`uid` = '.$GLOBALS['mybb']->user['uid'] );
}
Do not let your difficulties fill you with anxiety, after all it is only in the darkest nights that stars shine more brightly. - Ali(a.s)

Developer( PHP, Python, C++, HTML+CSS, JS I am available for Hire. Message Me for details.
dead inside
Posts:
5,062
Joined:
Jan 2015
Likes:
1,341
Credits:
19,260
Reputation:
190
Owner
2 Years of Service
#3
Posted: 26-04-2015, 02:08 PM
Someone tries to copy our color changer. :yus:
Read the help documents before sending me a message.
I'm not really online on weekends, so expect delays on replies.

Aeux
26-04-2015, 02:18 PM
Closed Account
Posts:
2,770
Joined:
Jan 2015
Likes:
140
Credits:
1,306
Reputation:
28
2 Years of Service
#4
OP
Posted: 26-04-2015, 02:14 PM
(26-04-2015, 02:08 PM)aoki ♥ Wrote: Someone tries to copy our color changer. :yus:

:rly: nope.
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)