MyBB Community Forums
[Solved] Select checked - first main forum, after subforum. - 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: [Solved] Select checked - first main forum, after subforum. (/thread-170578.html)



[Solved] Select checked - first main forum, after subforum. - Snake_ - 2015-05-12

Hi,

I'm trying to do select checked.
First select: Main forum.
Second select: Sub Forum.

It can be somehow download from the column 'parentlist' in *_forums?

Forums are taken, only now to use it properly.
http://community.mybb.com/thread-169977.html
Then use eg. http://www.appelsiini.net/projects/chainedhttp://www.blueicestudios.com/chained-select-boxes-using-php-mysql-ajax/

Or I should operate on other columns? PID / FID?


RE: Select checked - first main forum, after subforum. - Destroy666 - 2015-05-12

Not sure what your requirement is. If you want to generate a select box with forums, why not simply use build_forum_jump() with $showextras = 0? https://github.com/mybb/mybb/blob/feature/inc/functions.php#L2838


RE: Select checked - first main forum, after subforum. - Snake_ - 2015-05-13

Well it...
I'd like get the effect http://www.appelsiini.net/projects/chained , ok, I added this script, however afred selected category (main forum) does not display subforum assigned to it.
if(in_array($forum['pid'], $exp)) 
			{	
				$forumsOptionChild .= '<option value="' . $subforums[$forum['fid']] . '" selected="selected">--' . $forum['name'] . '</option>';
				eval('$subforums[$forum["pid"]] .= "'.$templates->get('dld_add_subforums').'";'); //niekoniecznie szablon
			}
			else
			{			   			   
				if(isset($subforums[$forum['fid']])) 		
				{
					$forumsOptionParent .= '<option value="' . $subforums[$forum['pid']] . '" selected="selected">' . $forum['name'] . '</option>';
				}				
			}
			$formularz = '<select id="mark" name="mark">
							<option value="0">wybierz kategorię</option>
							' . $forumsOptionParent . '
							</select>	
							<select id="series" name="series">
							<option value="-">wybierz dział</option>
							' . $forumsOptionChild . '
						</select>';	

Demo: http://snake.xaa.pl/mybb/download.php?screen=dodaj


RE: Select checked - first main forum, after subforum. - dragonexpert - 2015-05-18

So if I understand your request correctly you want the second select box to update with the list of subforums of select box 1.

Use build_forum_jump You need $pid to be the input of the user.