MyBB Community Forums

Full Version: Is it possible to add a default folder using a plugin?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm going to go out on a limb here and say that you can't. In the private.php it shows this, and it appears the only way to add a default folder would be to go into the private.php and change every occurrence of anything remotely similar to this by adding your extra default folder.

switch($fid)
				{
					case 1:
						if($val == $lang->folder_inbox || trim($val) == '')
						{
							$val = '';
						}
						break;
					case 2:
						if($val == $lang->folder_sent_items || trim($val) == '')
						{
							$val = '';
						}
						break;
					case 3:
						if($val == $lang->folder_drafts || trim($val) == '')
						{
							$val = '';
						}
						break;
					case 4:
						if($val == $lang->folder_trash || trim($val) == '')
						{
							$val = '';
						}
						break;
				}
If you can't, which I'm guessing is true, do you think there's a way to make sure a folder never gets deleted? I know I could give everyone an extra folder, but if they deleted it then it could cause some problems. Sad

I'm guessing I'm going to have to go in and edit some stuff in private.php. It shouldn't be too many lines that I have to do it on, but I'd prefer to leave default files be.
The answer to this question is no! Unless I've missed something. Fret not though, there is a way to do it! It really shouldn't be this difficult, but there's an 12 line work around.

Private.php
/*Line 794*/
		if($folderinfo[0] == "1" || $folderinfo[0] == "2" || $folderinfo[0] == "3" || $folderinfo[0] == "4" || $folderinfo[0] == "5")

/*Line 873-878*/

					case 5:
						if($val == $lang->folder_name || trim($val) == '')
						{
							$val = '';
						}
						break;

usercp.php
/*Line 36*/
	$mybb->user['pmfolders'] = "1**".$lang->folder_inbox."$%%$2**".$lang->folder_sent_items."$%%$3**".$lang->folder_drafts."$%%$4**".$lang->folder_trash."$%%$5**".$lang->folder_name;


inc/functions_user.php
/*Line 574-576*/
		case 5:
			return $lang->folder_name;
			break;

inc/languages/your language/global.lang.php
/*Doesn't matter, I put it at line 303*/
$l['folder_name'] = "Folder Name Here!";