MyBB Community Forums
Creating a page with a fillable sheet [SOLVED] - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Creating a page with a fillable sheet [SOLVED] (/thread-221322.html)

Pages: 1 2


RE: Creating a page with a fillable sheet - Omar G. - 2019-01-03

Trying to guess your DB table structure, probably something of the sorts of the following should work:
$mybb->user['uid'] = (int)$mybb->user['uid'];//(probably not necessary) (current user)
$query = $db->simple_select('YOUR_TABLE_NAME', '*', "uid='{$mybb->user['uid']}'");

if($db->num_rows($query))
{
	error("There is a row for you already in the database, regardless of its content you can't create a new one.");
}

I would assume you are using $db->insert_query() to insert your data into the DB, and you can use $db->update_query() if you want to update data as well.

You can check the documentation regarding DB methods in the following link:
https://docs.mybb.com/1.8/development/plugins/database-methods/


RE: Creating a page with a fillable sheet - enrolmudas - 2019-01-03

(2019-01-03, 09:50 PM)OmarĀ G. Wrote: Trying to guess your DB table structure, probably something of the sorts of the following should work:
$mybb->user['uid'] = (int)$mybb->user['uid'];//(probably not necessary) (current user)
$query = $db->simple_select('YOUR_TABLE_NAME', '*', "uid='{$mybb->user['uid']}'");

if($db->num_rows($query))
{
	error("There is a row for you already in the database, regardless of its content you can't create a new one.");
}

I would assume you are using $db->insert_query() to insert your data into the DB, and you can use $db->update_query() if you want to update data as well.

You can check the documentation regarding DB methods in the following link:
https://docs.mybb.com/1.8/development/plugins/database-methods/

That's it! I just did it. It works perfectly, thank you so much for your help!


RE: Creating a page with a fillable sheet [SOLVED] - Zaqre - 2019-01-05

Can anyone publish this as a plugin?


RE: Creating a page with a fillable sheet [SOLVED] - enrolmudas - 2019-01-05

(2019-01-05, 02:03 AM)Zaqre Wrote: Can anyone publish this as a plugin?

Well, it is my goal to make this a functionality of a bigger plugin. It will a series of RP (Roleplay) functions like character sheets, leveling system, random encounter (items or mobs) and many more. Right now this "character sheet" thing works fine, but I want it to make it editable and but that I mean: Allowing the admin to add/remove fields from it so it won't be a static sheet.


RE: Creating a page with a fillable sheet [SOLVED] - Zaqre - 2019-01-05

(2019-01-05, 07:09 PM)enrolmudas Wrote:
(2019-01-05, 02:03 AM)Zaqre Wrote: Can anyone publish this as a plugin?

Well, it is my goal to make this a functionality of a bigger plugin. It will a series of RP (Roleplay) functions like character sheets, leveling system, random encounter (items or mobs) and many more. Right now this "character sheet" thing works fine, but I want it to make it editable and but that I mean: Allowing the admin to add/remove fields from it so it won't be a static sheet.

If you need help testing, let me know, I am currently trying to start an RP system with my friend. I am currently based on Google Docs with custom formulas I made, but it's really tacky and just static to the specific RP that it was made for.


RE: Creating a page with a fillable sheet [SOLVED] - enrolmudas - 2019-01-05

Sure! I'll let you know as soon as possible!