Hello All,
I am working on a requested feature for one of my add-ons. This product enables the admins to set certain forums where only the first post and the user's posts of a thread is visible, except to certain exempt usergroups. A user has requested that each forum on the site be separately configurable as to whether the add-on is set to work there, which usergroups can view all posts, which usergroups will have their posts always viewable, and whether all of the OP's posts are all viewable regardless of usergroup.
I have decided that a table would be the most efficient way to configure the forums, and this is what I have so far:
View attachment 1031
This is the code in the XML file that displays the above table:
Now, what I am trying to figure out is how to take the data input into the table, the input elements (checkboxes and text), and turn it into an array of options data that can then be accessed in the plugins for conditional statements.
Does anyone know of a good reference for learning how to do this? Until now I have just been modifying the code of others with regards to settings variables who have marked their code as reusable, but the time has come for me to actually know what I'm doing, and a link to some good reference material or tutorials on this would be greatly appreciated. I haven't been able to find much online about this.
I am working on a requested feature for one of my add-ons. This product enables the admins to set certain forums where only the first post and the user's posts of a thread is visible, except to certain exempt usergroups. A user has requested that each forum on the site be separately configurable as to whether the add-on is set to work there, which usergroups can view all posts, which usergroups will have their posts always viewable, and whether all of the OP's posts are all viewable regardless of usergroup.
I have decided that a table would be the most efficient way to configure the forums, and this is what I have so far:
View attachment 1031
This is the code in the XML file that displays the above table:
HTML:
<setting varname="markfl_sfpo_configure" displayorder="25">
<datatype>free</datatype>
<optioncode><![CDATA[" . "<table style=\"font-size: 10px; border: 1px solid #000000; border-collapse: collapse; width: 100%\"><tr class=\"smallfont\"><th style=\"border: 1px solid #000000\">Forum</th><th style=\"border: 1px solid #000000\">On?</th><th style=\"border: 1px solid #000000\">View All</th><th style=\"border: 1px solid #000000\">Show All</th><th style=\"border: 1px solid #000000\">OP Show All</th></tr>"
. eval('$options = "";
foreach($vbulletin->forumcache AS $forumid => $forum)
{
if ($forum[parentid] > 0)
{
$options .= "<tr><td class=\"smallfont\" style=\\"border: 1px solid #000000\\">$forum[title]</td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"checkbox\"></td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"text\" size=\"10\"></td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"text\" size=\"10\"></td><td class=\"smallfont\" style=\\"border: 1px solid #000000\\"><input type=\"checkbox\"></td></tr>";
}
}
return "$options";') . "</table>]]></optioncode>
</setting>
Now, what I am trying to figure out is how to take the data input into the table, the input elements (checkboxes and text), and turn it into an array of options data that can then be accessed in the plugins for conditional statements.
Does anyone know of a good reference for learning how to do this? Until now I have just been modifying the code of others with regards to settings variables who have marked their code as reusable, but the time has come for me to actually know what I'm doing, and a link to some good reference material or tutorials on this would be greatly appreciated. I haven't been able to find much online about this.