Dream Portal is a portal system designed to function with Simple Machines Forum (aka SMF).

It allows you to easily manage your site and webpages in an SMF environment. Place Modules on different actions and non-actions of your SMF forum using a simple drag-and-drop approach. Users can also create and save multiple layouts by name and assign pages to any layout(s). Bundled with Dream Pages and Dream Menu helps put the power and ease of customizing your SMF forum right at your fingertips.

Dream Portal allows you the ability to easily customize your SMF forum and site with many different possibilities helping to make customization truly what dreams are made of!

DreamPortal1.0.5.zip
File size: 221KB
Download count: 1662
DreamPortal1.0.5.tar.gz
File size: 176KB
Download count: 159
Download
Hello, Guest
Please login or register.

 
 
 

Did you miss your activation email?

Re: Menübutton lassen sich nicht löschen.
Last Poster: Tony_R in German on May 14, 2012, 10:18:03 AM


hat mir auch geholfen, vielen dank !

Re: Sologhost went mad. Check this fast!
Last Poster: ThoTh in Chit Chat on May 13, 2012, 03:07:02 PM


Congrats :D

Re: Think I have Everything I need
Last Poster: SoLoGHoST in Chit Chat on May 09, 2012, 01:36:37 PM



Your Recent Image Attachments...
Last Poster: SoLoGHoST in Team Blog on May 07, 2012, 04:13:46 AM


Well, just thought I'd let you all know of the ability to see your 15 most recent image attachments

Re: Inspire Romance
Last Poster: SoLoGHoST in Website Showcase on May 03, 2012, 12:34:22 PM


Looks great!! :)

Author Topic: ALL DP Module Parameters Defined!  (Read 3054 times)

0 Members and 1 Guest are viewing this topic.

SoLoGHoST

  • Lead Developer
  • Developer
  • Constant Sleeper
  • *
  • Posts: 2081
  • Wanted... DEAD or ALIVE!
    • Dream Portal
ALL DP Module Parameters Defined!
« on: March 02, 2011, 01:33:18 AM »
Ok, so here we begin the complete package of Dream Portal Module Parameters.  I will begin this topic by listing the current parameters and than explain each one in DETAIL with posted replies to this topic.

First, let me explain what Module Parameters are in Dream Portal and what they are used for:
Dream Portal's Module Parameters are settings that expand any module to include more features and/or options.  These parameters are defined within the module's info.xml file (or in the case of default DP Modules, the loadDefaultModuleConfigs() function found in Subs-DreamPortal.php) and are used within the modules main function within the $params array.  The $params array is passed, as a parameter into the Modules Main Function.  The return values for this $params array are based on what the parameter is exactly, and what setting the Admin gave that parameter when modifying that module within the DP Admin.  Understanding the possible values that can be inputted into a parameter for a Module can help you code your modules in a more productive manner and offer more flexibility and control to the END-USER of your module.

An example input for a parameter into an info.xml file could be like so:

Code: [Select]
<param name="test_param" type="select">0:opt1;opt2;opt3</param>

Without understanding what this means, you are unable to know what this is and what it will do for the END-USER.  So, let's explain the 3 parts of this (name, type, and value)...

name - The name of a parameter MUST be unique within a module.  It can be labelled anything (characters, numbers, and underscores should be used only for the name).  You can NOT duplicate the param name within that module.  It must be unique within that module.  The name gets sent to the $params for you to be able to access within your function like so:  $params[{name}], so in this case, $params['test_param'] would return the value for the select parameter.

type - This is the type of parameter to use.  ALL parameter types will be explained in DETAIL in replies to this post.  This example uses the select parameter type.  Here are the current parameter types that are available within Dream Portal that you can use for your modules:


You can follow each link above to be taken to where they are explained at in FULL DETAIL below.

value - In this example we define the value as follows:  0:opt1;opt2;opt3, but what does any of this mean??  In order to understand what this means, you will need to go to the select parameter type Definition below and read it to get an understanding of the possible values for the select parameter type.

Ok, so Module parameters expand your module into more than just a block of Information to show.  It gives the user the ability to make changes within the module using a familiarity that the end-user is already aware of... Settings and it brings out the settings that Dream Portal already uses to be recycled and used again for your specific module settings/parameters.

Ok, so now I will go ahead and explain each and every parameter type defined above within replies to this topic.

Ofcourse, feel free to ask any questions, and/or comment on anything.
« Last Edit: March 09, 2012, 07:28:05 AM by Xarcell »
#1
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
db_select - March 02, 2011, 01:36:37 AM
db_select
Refer to image attached for actual look of this parameter type.

Description:  Creates a select box filled with options from all unique, non-empty (row != '') rows from any column of any table in the database, and automatically pre-selects the value id from another column in that table that you specify.  NOTE:  You do not make strings for the options that this select box outputs, because they are coming from the database column you specified.

Syntax:
Selected value ; Column to determine a match for the Selected Value : Table to get all of the info from ; Column to be outputted in <options> : custom


Here is an example parameter value:
Code: [Select]
1;id_member:{db_prefix}members;real_name:custom
This says to pre-select within the select box, the first id_member (should be the Admin) from the {db_prefix}members table, and output all <option> tags with the real_name of those members.  Note:  {db_prefix} must be supplied in here for your table names, since that is how we know that it's a table and not a column.

You can also do this:
Code: [Select]
1;id_member:real_name;{db_prefix}members:custom
And this will do the same thing.

If custom is defined, it will allow you to add values into the real_name column or whatever column is defined here within the table.  So it would use an insert.  custom is, ofcourse, OPTIONAL for you to use for this value.  If you don't use it, than your value could look like this instead:

Code: [Select]
1;id_member:real_name;{db_prefix}members

Using custom wouldn't be appropriate for the SMF members table, though it would be appropriate for the dp_shoutboxes table where you could create different templates to use for each shoutbox.

This parameter returns a type STRING for you to use in your modules.  In this case the string returned would be '1'.

#2
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
list_bbc - March 02, 2011, 01:38:18 AM
list_bbc

Accepted values
Any BB code. Multiple BB codes must be seperated by a semicolon ( ; )

Example:

Code: [Select]
b;center;i;me;php;pre;right;sub;sup;time;tt;u;url
This will return the entire parameter value with all checked BB codes separated with semicolons.

So, you can use:  explode(';', $params['your_param_name']); on this to populate an array with all checked BBC tags for this parameter, within your modules.

#3
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
file_input - March 02, 2011, 01:39:30 AM
file_input
Refer to image attached for actual look of this parameter type.

Syntax for this parameter type is as follows:

Quantity of Files Allowed : Mime Types Allowed (each separated by a semicolon) or you can type in all to allow for all possible mime types : Thumbnail Image Dimensions (separated by semicolon).  If strict is defined (which I have decided to use a semicolon for to separate from the other definitions of width and height), than the image will be resized down and the original image will be destroyed.

If the value is empty.  The default values will be set:
Code: [Select]
1:image/gif;image/png;image/jpeg;image/bmp

So, this says only allow 1 file input and must be image and don't bother creating any thumbnail for it.  Just move the image.

Note:  You must define width and/or height, or no thumbnail image will be created.

More Examples of possible values for this parameter type:

Code: [Select]
0:image/png;image/jpeg:width=20;height=20
Will create a thumbnail image from the original no bigger than 20x20 pixels (AND will KEEP THE ORIGINAL IMAGE, since strict is not defined).  0 means that we want them to be able to upload an INFINITE amount of files for this parameter.

Code: [Select]
2:image/gif;text/css;image/tiff:width=175
Will create a thumbnail image only if the width of the image > 175 pixels and the file being uploaded is either gif and/or tiff.  If the file is CSS, it just moves the file along it's way.  Allows for only 2 of these files uploaded.  Since strict isn't defined in here, we will also keep the original image as well.

Code: [Select]
10:image/jpeg;image/png;image/gif:width=100;height=100;strict
If the image uploaded is bigger than 100x100 pixels, it will resize it.  The original image will be lost unless it is smaller than or equal to a width of 100px and a height of 100px, since strict is defined in here!  Only allows for up to 10 images uploaded.

AN EXAMPLE OF A WRONG VALUE:
Code: [Select]
1:image/jpeg;image/png:strict
Ok, this is an example of a WRONG parameter_value.  The reason why it is wrong here is because strict is defined, yet, no width and/or height is defined.  So, in such a case, this definition of strict will be ignored.  So this is the same as saying:  1:image/jpeg;image/png
And actually would be just better to keep it set the right way.  If you just want it to be strict on a width and/or a height value, than you MUST define the width and/or height value to be strict on.  For example, if I want uploads for images, I don't care about the height, but I need the image width to be restricted to 120 pixels.  I would do this: 
Code: [Select]
0:image/jpeg;image/png;image/gif:width=120;strict
So, you don't need to define the height in here and if it's undefined, it will only check the width.  Though, the image will still get resized proportionally ofcourse, taking into account the width and the height.

IMPORTANT NOTE:  This is an extremely UNIQUE parameter as it's the only 1 that does not have the value returned from it within the parameter_value column of the dp_module_parameters table within the database.  The values returned from this that you can use within your module will be an ARRAY of string values.  For example $params['(parameter name)'] will look like this if your parameter name is "files":

URL for accessing files will look like this (where id = the id_file)
Direct Download:  index.php?action=dreamFiles;id=1
Image Viewing:  index.php?action=dreamFiles;id=1;image
Code: [Select]
// 0 Key = First file uploaded.
$params['files'][0]['name'] = Filename.
$params['files'][0]['extension'] = The extension of the file (png, gif, jpg, etc. etc.).
$params['files'][0]['size'] = The size of the file in kB (Kilobytes)
$params['files'][0]['byte_size'] = The size of the file in bytes.
$params['files'][0]['width'] = If it's an image this will be in pixels, otherwise will be 0.
$params['files'][0]['height'] = If it's an image this will give you the number of pixels, otherwise 0.
$params['files'][0]['downloads'] = # of times the file has been downloaded.
$params['files'][0]['mime_type'] = returns the mime type for that file, in case you need it for anything.
$params['files'][0]['href'] = Returns only the URL for the original file (not the thumbnail).
$params['files'][0]['link'] = Returns a completed link for the original file (not the thumbnail).
$params['files'][0]['is_image'] = Returns true if it's an image file, otherwise false.
$params['files'][0]['has_thumb'] = Returns true if the image has a thumbnail, otherwise false.
$params['files'][0]['thumb_href'] = Returns the URL for the thumbnail (includes ;image at the end of the URL)

// There that gives us all of the information we can get for the first file.  You can do a foreach here on the $params['files'] array and you will be able to access all files for that specific parameter.

// Next file will be 1 if exists.
$params['files'][1]

// and so on...
Important:  $params['files'] = empty string where there are no files uploaded yet for that parameter name.  So you can handle that as well.


The following is an example of using it within a function for your module and just outputs all of the information that can be obtained foreach file for the 'myfiles' parameter name.

Code: [Select]
function your_module($params)
{
// file_input parameter test.
if (is_array($params))
{
if(count($params['myfiles']) <= 0)
{
echo 'No files defined yet!<br />Please upload some files by modifying this module either in your DP Admin Panel or your Profile Member Layouts area.';
return;
}
foreach($params['myfiles'] as $key => $file)
echo '
<hr>Filename: ', $file['name'], '<br />Extension: ', $file['extension'], '<br />Size in KB: ', $file['size'], '<br />Byte Size: ', $file['byte_size'], '<br />Width: ', $file['width'], '<br />Height: ', $file['height'], '<br />Downloads: ', $file['downloads'], '<br />Mime Type: ', $file['mime_type'], '<br />HREF: ', $file['href'], '<br />LINK: ', $file['link'], '<br />IS IMAGE: ', ($file['is_image'] ? 'TRUE' : 'FALSE'), '<br />THUMB HREF: ', $file['thumb_href'];

}
else
module_error();
}

Please Note:  If you want to allow for PHP files to be uploaded, the mime type for this is:

application/x-httpd-php

Ofcourse, if you want all files to be able to be uploaded, you can also set the mime type to:  all

Remember, setting the mime type to all will allow "ALL" types of files to be uploaded, but even still it checks that the file is of the correct mime type and file extension.  So if the mime type isn't defined within the AllowedFileExtensions() function for that extension, than it can not be uploaded even if "ALL" is defined, since the mime-type identifies the correct file extension.  This is done for security reasons, though I believe I got every mime type, with the exception of the .htaccess file extension ofcourse.

Refer to the AllowedFileExtensions function, found in Subs-DreamPortal.php, for a Complete List of all allowed mime-types for the file_input parameter type.

#4
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
rich_edit - March 02, 2011, 01:40:47 AM
rich_edit
Refer to image attached for actual look of this parameter type.

This just gives us a way to make the text area bigger by using the same method for this that SMF uses for when you are creating posts.  This is adapted into the Custom Module, instead of using the large_text parameter type, it uses the rich_edit parameter type.  Value holds the string of information that was inputted into this textarea.  Can be anything really.  The Customizer determines what to do with this text.  If the parameter value is empty, will return an empty string, otherwise returns the entire text inputted into this text area within the $params['(parameter name)'] variable.  This does not support BBC and/or Smilies by default.  If you want bbc and smilies to be allowed for this than you will have to use the parse_bbc() SMF function on this within the module function itself.

#5
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
checklist - March 02, 2011, 01:41:40 AM
checklist
Refer to image attached for actual look of this parameter type.  You can also take a look at the Statistics and Who's Online Module to see this parameter type in action.

Description:  Creates a checklist for your module, ability to allow for default checked options, and whether to allow them to be ordered or not, as well as supplying a default ordering of the checklist also. 

Note:  This parameter type is very similar to the list_groups parameter type, except you can define your own strings for the check box options.  But unlike the list_groups parameter type, defining -3 for the first value definition will not select all checkboxes.  Since you have to define the checkboxes manually in here, to select them all, you will need to place the offsets of each possible checkbox (starting at 0) within the first definition separated by commas in order to have all selected by default.

Syntax:
Selected Check box options (each separated by a comma) : Checkbox Options and $txt index string definitions (each separated by a semicolon) : [optional] (whether to allow them to be ordered or not and separate with a semicolon the default order of all check options, which will than be separated by a comma).

Possible Parameter Type Value Example:
0,1,2:members;posts;topics;categories;boards;online:order

This says, make check options that have array index of 0 (members),1 (posts), and 2 (topics) selected by default for this parameter.  Allow them to order it.  Since no order has been given, the default order will be 0,1,2,3,4,5 (the Admin will have the option to change this order with Up and Down links next to each Check Options $txt[] definition when modifying the module).

This will return an array of 2 string values accessible from the $params array:
  • $params['(Parameter name)']['checked'] = string of all checked values separated by commas.  In the example above will return '0,1,2'.  Note:  If all check boxes/options have been unchecked, this will return a string of '-2' instead.
  • $params['(Parameter name)']['order'] = string of all checked and unchecked values separated by commas and ordered in the order the Admin has defined for this.  In the example above, will return '0,1,2,3,4,5'.

Tip:  With these 2 values returned you can extrapolate the unchecked values using array_diff() after exploding both strings into arrays.  This is why I added the order array index to the $params, since you may want to provide a checklist of display options and choices, and if something is unchecked, you still need to know what is actually unchecked and the order of the unchecked checkboxes may still be important.  So this is the whole purpose of the order array index.  Note:  The checked array index will automatically be returned in the order in which the check options are in.
The $txt[] definitions of the labels for each check box are defined within the parameter value, in our example above they are and would be defined within your language file(s) as follows:
  • members = $txt['dpmod_(Module Name)_(Parameter name)_members']
  • posts = $txt['dpmod_(Module Name)_(Parameter name)_posts']
  • topics = $txt['dpmod_(Module Name)_(Parameter name)_topics']
  • categories = $txt['dpmod_(Module Name)_(Parameter name)_categories']
  • boards = $txt['dpmod_(Module Name)_(Parameter name)_boards']
  • online = $txt['dpmod_(Module Name)_(Parameter name)_online']

Note:  This string never changes it's position when declared.  So this is important for how you define each option within the module itself.  Array indexes for the following will always remain and never change, since this is how you should check whether these are checked or not within your modules:

members = 0
posts = 1
topics = 2
categories = 3
boards = 4
online = 5

all values unchecked = checked returns -2

Here are more Examples of Possible values for this parameter type based on the example above:
1,2,5:members;posts;topics;categories;boards;online

This says make check options 1 (posts), 2 (topics), and 5 (online) checked by default.  And since order is not defined in this value, the user will not be able to order the check options and the order that will always be returned, for this parameter, will be '0,1,2,3,4,5'.


-2:members;posts;topics;categories;boards;online:order;5,4,3,2,1

This says, uncheck all check options.  Allow them to order it, and set the order to be reversed (so will be shown as:  online;boards;categories;topics;posts;members)


5,4,3,2,1,0:members;posts;topics;categories;boards;online:order;5,4,3,2,1,0

This says, check all check options, and allow ordering.  Note:  You'll notice that 5,4,3,2,1,0 was defined twice in here.  This is important, since if you don't define it at the end after order; it will simply redefine it as 0,1,2,3,4,5 and will return as checked, this string '0,1,2,3,4,5', instead of '5,4,3,2,1,0'.  So please remember that the order must always have all possible array indexes from 0 to count(array(members, posts, topics, categories, boards, online)) - 1, or leave the order definition blank to load from lowest array index to highest array index of the check options.

Another Example:
5,3,1:members;posts;topics;categories;boards;online:order;5,4,3,2,1,0

This says, check the following array indexes from the check options:
5 (online)
3 (categories)
1 (posts)
checked returns:  '5,3,1' and order returns:  '5,4,3,2,1,0'.  This will work since the order is still the same.  This will also allow the Admin to order it.

Here's an EXAMPLE of a WRONG parameter value for this type:
0,2,4:members;posts;topics;categories;boards;online:order;5,4,3,2,1,0

The reason this is wrong is because checked options must be returned relative to the order in which they are in.  So the order is set to:  5,4,3,2,1,0, but the checked values are set at:  0,2,4.  The order does not match here and is exactly the opposite.  So, this can be fixed by either setting order to this:  Example:  order;0,1,2,3,4,5 OR leaving it blank:  Example:  order.  Or we can change the checked string value to this instead:  4,2,0

Questions, comments, suggestions, etc. are welcome.
Last Edit: March 02, 2011, 02:47:38 AM by SoLoGHoST

#6
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
text - March 02, 2011, 01:45:31 AM
text or small_text
Or can be anything really, just as long as it's not any of the other module parameters, since if it doesn't have a name of any of the other parameters than it gets treated as text.

Refer to image attached for actual look of this parameter type.

This is a simple string input field.  This will be used if none of the other parameter types are defined.  So if the parameter type is blank, text, etc., blah, anything really that isn't one of the other parameter types, this parameter type will take over and be used for this parameter by default.  The value is a string value and returns as a string.  The value does not support BBC and/or Smiley's by default, if you want bbc and smileys you can do a parse_bbc() on the return value and output this into the module whereever.
Last Edit: March 08, 2012, 06:18:57 PM by Xarcell

#7
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
int - March 02, 2011, 01:46:09 AM
int
Refer to image attached for actual look of this parameter type.

The parameter value for this holds an integer value.  Exactly like SMF's settings for int, it can not have a negative value, and can not hold a string.  If these are inputted into this field and saved, the value will return 0 as the integer.

The maximum value depends on the system. 32 bit systems have a maximum signed integer range of up to 2147483647. So for example on such a system, 1000000000000 will return 2147483647. The maximum signed integer value for 64 bit systems goes up to 9223372036854775807.

Returns an integer value.

#8
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
html - March 02, 2011, 01:47:20 AM
html
Refer to images attached for actual look of this parameter type.

*This parameter type is deprecated in DP 1.1, you should use the rich_edit parameter type for this instead!

This parameter type is very much like the large_text parameter type, cept that the textarea for typing into is much bigger and it actually does an html_entity_decode to this parameter's value to allow for possible html output.

Value holds the string of information that was inputted into this textarea.  Can be anything really.  The Customizer determines what to do with this text.  If the parameter value is empty, will return an empty string, otherwise returns the entire text inputted into this text area within the $params['(parameter name')] variable.  This text can hold HTML and will automatically output any html as html.  Also supports javascript (but must all be on 1 line as shown in the picture and can not use single quotes, only double quotes).  This parameter type, much like the large_text parameter type, does not naturally support BBC and/or Smilies.  If you want bbc and smilies to be allowed for this than you will have to use the parse_bbc() SMF function on this.
Last Edit: December 22, 2011, 07:37:46 PM by SoLoGHoST

#9
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
select - March 02, 2011, 01:48:09 AM
select
Refer to image attached for actual look of this parameter type.

Description:  Creates a select box with options to choose from for your module when modifying it.  Could look like the image attached.  Note:  The image attached is an example of one of the parameters in the Download System module that I created which takes advantage of this parameter type.

Syntax:
Selected Array Value from the next list : List of possible values (separated by semicolons)

Here is the example for the image attached:
Code: [Select]
0:ID_FILE;rating;views;commenttotal;totaldownloads;filesize

0 means to have ID_FILE selected by default since it's the first possible value separated by a semicolon.  If I placed 1 in here, than rating would be the value that gets returned for this parameter.

It is EXTREMELY important to note that the text strings for each option in the select box MUST be within your language file(s) using this syntax for the $txt[] variables' index:
Code: [Select]
$txt['dpmod_(module name)_(parameter name)_(option value)']
So in this example, you would need a language string for each option value.  The option values in this example are: ID_FILE, rating, views, commenttotal, totaldownloads, and filesize.  I happened to use the columns of the database table that it will query as option values, but you can use anything as an option value.  Just remember that it must be an index of the $txt[] array, so you can't use spaces and any crazy characters, if you know what I mean.  Numbers and letter are fine to use for option values and are recommended to only use these and/or underscores is fine also.

The return value from this parameter is the option value that is selected within the first definition.  So, if the 1st definition is 3, than the value for this parameter returned to the module would be:  commenttotal.  The customizer decides what to do with that return value.

IMPORTANT NOTE:  The highest possible value for the 1st number within this parameter value, just before the colon, is 5.  You should not set this any higher than 5, since there are 6 option values after the colon.

Any questions, comments, suggestions?  All welcome!

#10
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
list_boards - March 02, 2011, 01:49:13 AM
list_boards
Refer to image attached for actual look of this parameter type.

Possible Values:  Board Id #, or empty string.

If value is empty, won't associate with any boards until specified by the Admin when modifying the module.  If empty will return an empty string value ('') within the $params array for that specific parameter name (For example, if the parameter name is: show_boards, and the parameter value is empty, than $params['show_boards'] will equal an empty string (example = '') or empty($params['show_boards']) would evaluate to true!

Lists all boards on the Forum within a <select> tag.  Uses <optgroup label="category name"> and all boards within each category are organized within each Category <optgroup> that they belong in.  If there is a parameter value associated with this parameter, than the value is expected to be of type int and will load up that board id as the default selected board.  If the board id doesn't exist, will not load up any board ids.

This parameter type returns the board id associated with it as a string value.  If no parameter value is set, than this will return an empty string.

The parameter value for this should consist of only 1 board id #.  For example, setting the value to 1 will load up board id #1 by default.  The admin will have the opportunity to change this as well.

For an example of this parameter type, take a look at the Select Boards parameter within the Site News Module when modifying it.

EoM.

#11
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
large_text - March 02, 2011, 01:50:07 AM
large_text
Refer to image attached for actual look of this parameter type.

Value holds the string of information that was inputted into this textarea.  Can be anything really.  The Customizer determines what to do with this text.  If the parameter value is empty, will return an empty string, otherwise returns the entire text inputted into this text area within the $params['(parameter name)'] variable.  This does not support BBC and/or Smilies by default.  If you want bbc and smilies to be allowed for this than you will have to use the parse_bbc() SMF function on this.

#12
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
check - March 02, 2011, 01:50:48 AM
check
Image attached of what it looks like, in case you need it :D

Possible values:  0, 1, or empty string.

Returns the parameter value in here for you to use within a module.  Either an empty string or 0 for unchecked, or a 1 indicating that that parameter has been checked.

Just a simple checkbox.

#13
*
SoLoGHoST
  • Constant Sleeper
  • Posts: 2081
list_groups - March 02, 2011, 01:51:57 AM
list_groups
Refer to image attached for actual look of this parameter type.

Description:  Lists all groups available within the forum, ability to allow for default checked groups, unallowed groups, and whether to allow them to be ordered or not, as well as supplying a default ordering of groups also.

Syntax:
Selected Group Id Values (each separated by a comma) : Unallowed Group Ids Values (each separated by a comma) : (whether to allow them to be ordered or not and separate with a semicolon the default order of all groups).

Possible Value Example:
Code: [Select]
1,2:-1,0:order;2,1
This says, make groups 1 (Administrator) and 2 (Global Moderator) selected by default for this parameter.  Do not allow the Admin to select groups -1 (Guests) and 0 (Regular Members) for this parameter.  Allow them to order it, and make the default order 2,1 (which will place Global Moderator above the Administrator when viewing it by default, the Admin will have the option to change this order with Up and Down links next to each Groups name).

This will return a STRING value of all selected groups in the order in which they are selected and separated by comma's.  For Example:  the String "2,1,3" is a possible return value with the order of Global Moderator, Admin, and Moderator.  If no group is checked, it will return a string value of -2 (which is no groups).  To use this within your modules, you can do an explode on it and use the comma (,) as the delimiter.  You should also check if the value equals -2 also to make sure a group was selected.

Here are more Examples of Possible values for this parameter type:
Code: [Select]
1,2:-1,0:order
This says make groups 1 and 2 enabled by default.  Groups -1 (Guests) and 0 (Regular Members) will not be shown as an option to check within the Admin, and also, if these values somehow appear within the first definition, they will not be added unless they are gone from the second definition.  And lastly, order, which says to create Up and Down links when modifying it to allow for a more flexible display of groups within modules.

Code: [Select]
1,2:order
This says, check groups 1 and 2 by default.  Show all possible groups to the Admin and let them order it however they want.

Code: [Select]
-1,0
This says, check group ids -1, and 0 (Guests and Regular Members) for this module by default.  Allow them to use all group ids available for this module and DO NOT allow them to order it!

IMPORTANT NOTE:  To have all groups checked by default, after installation of the module, set the first value definition (just before the first colon) of the parameter value, to -3.  Parameter Value Example:  -3:-1,0:order

This says make all groups checked by default and do not allow them to select Guest and Regular Members, and allow them to order it.  Please be aware that you will need to check for a value of -3 within the module and perform the proper task if the return value for the $params array equals the string value of -3.  Ofcourse this is only used to check all groups by default.  That is directly after the module is installed.  If the user makes a change to this when modifying the module, this will change from -3, to the actual group id value of all checked Groups.

Questions, comments, suggestions, etc. are welcome.


 

SHOUTBOX NOT FOR SUPPORT!

 Forum Staff