MyBB Community Forums

Full Version: From the MyBB Development Blog: Please, help explain this...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
From the MyBB Development Blog:

Quote:This code is from MyBB 1.4 and it is of the new code in the ACP; specifically, the Users page in the ACP. I won’t go into detail about all the new code in the ACP but I’ll briefly cover what was shown in that picture.

The first thing you’ll notice is $form->output_row(…). What it does is fairly obvious but just in case, it outputs a row to your MyBB ACP page. The arguments for this function are as follows:


title - string The title of the row.
description - string The description of the row/field.
content - string The HTML content to show in the row.
label_for - string The ID of the control this row should be a label for.
options - array Array of options for the row cell.
row_options - array Array of options for the row container.


output_row(title, description="", content="", label_for="", options=array(), row_options=array())

Now you may be thinking we use pure HTML all the time in $form->output_row. As you look closer at the picture, however, you will also see $form->generate_select_box and $form->generate_check_box, the arguments of which are:


name - string The name of the select box.
option_list - array Array of options in key => val format.
selected - mixed Either a string containing the selected item or an array containing multiple selected items (options['multiple'] must be true)
options - array Array of options for the select box (multiple, class, id, size)


generate_select_box(name, option_list, selected=array(), options=array())

and


name - string The name of the check box.
value - string The value of the check box.
label - string The label of the check box if there is one.
options - array Array of options for the check box (id, class, checked)


generate_check_box(name, value="", label="", options=array())

Those are just two of several functions that allow you to generate code automatically for the new ACP.

Do the new features mean it will be easy to run custom queries on the user data base?
If we have several custom user profile fields, then we could select all users who like a certain sport (for example)

Can the results be exported to a spreadsheet?
Can we email only the group of users selected by the query??

/I'm not expecting we can, just trying to understand what this is supposed to do.

Thank you very much.
seeker Wrote:From the MyBB Development Blog:

Quote:This code is from MyBB 1.4 and it is of the new code in the ACP; specifically, the Users page in the ACP. I won’t go into detail about all the new code in the ACP but I’ll briefly cover what was shown in that picture.

The first thing you’ll notice is $form->output_row(…). What it does is fairly obvious but just in case, it outputs a row to your MyBB ACP page. The arguments for this function are as follows:


title - string The title of the row.
description - string The description of the row/field.
content - string The HTML content to show in the row.
label_for - string The ID of the control this row should be a label for.
options - array Array of options for the row cell.
row_options - array Array of options for the row container.


output_row(title, description="", content="", label_for="", options=array(), row_options=array())

Now you may be thinking we use pure HTML all the time in $form->output_row. As you look closer at the picture, however, you will also see $form->generate_select_box and $form->generate_check_box, the arguments of which are:


name - string The name of the select box.
option_list - array Array of options in key => val format.
selected - mixed Either a string containing the selected item or an array containing multiple selected items (options['multiple'] must be true)
options - array Array of options for the select box (multiple, class, id, size)


generate_select_box(name, option_list, selected=array(), options=array())

and


name - string The name of the check box.
value - string The value of the check box.
label - string The label of the check box if there is one.
options - array Array of options for the check box (id, class, checked)


generate_check_box(name, value="", label="", options=array())

Those are just two of several functions that allow you to generate code automatically for the new ACP.

Do the new features mean it will be easy to run custom queries on the user data base?
If we have several custom user profile fields, then we could select all users who like a certain sport (for example)

Can the results be exported to a spreadsheet?
Can we email only the group of users selected by the query??

/I'm not expecting we can, just trying to understand what this is supposed to do.

Thank you very much.

I don't think that section is supposed to imply any of that. From the looks of it, it's just giving people that write plugins or modifications an overview of some of the new functions they will be able to employ in 1.4 (I.E., all "under the hood" stuff, that the average user needs to know nothing about).
"The first thing you’ll notice is $form->output_row(…). What it does is fairly obvious but just in case, it outputs a row to your MyBB ACP page. The arguments for this function are as follows:


title - string The title of the row.
description - string The description of the row/field.
content - string The HTML content to show in the row.
label_for - string The ID of the control this row should be a label for.
options - array Array of options for the row cell.
row_options - array Array of options for the row container...."

`````````````

...it outputs a row to your MyBB ACP page...

Once we have the output, what is an example of an intended usage?
Yes that section of the blog post was intended for plugin/modification developers. An example of when you would want to use this is if you wanted to add options to the "edit forum" page for example, or create a new admin page for your plugin/modification.