MyBB Community Forums

Full Version: Adding text field to help document page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When you're creating a new help document you've got the name, description and document fields, which are used in the templates like, {$helpdoc['description']}, {$helpdoc['hid']}, {$helpdoc['name']}, {$helpdoc['sid']} etc.

I would like to add a new field to the new document page, which adds itself to the database with the other fields, and then have it let me use it in the help template using something like - {$helpdoc['mynewfield']}.

Is this possible? Well I'm sure it is, but is it possible for me to do it? Toungue Thanks!

EDIT: If I have to enter the information for each document manually in the database that's ok, I just want a want a way to grab it and use it in the template.

EDIT 2: Nevermind, I actually did it. Wow, I impressed myself Toungue
May I know what you actually did? If you don't mind of course.
(2012-09-23, 08:25 AM)Omar G. Wrote: [ -> ]May I know what you actually did? If you don't mind of course.

I had to do it by manually entering it in the database rather than via a custom text field, but this is what I did.

Created a new column in the mybb_helpdocs table, in my case the column was called "url". Then manually added the value for each document in the database.

Then in misc.php I found this seciton;

				$langnamevar = "d".$helpdoc['hid']."_name";
				$langdescvar = "d".$helpdoc['hid']."_desc";
				$langdocvar = "d".$helpdoc['hid']."_document";

And after that I added;

				$langurlvar = "d".$helpdoc['hid']."_url";

Then in the template I used "{$helpdoc['url']}" to display what I added in the database to each document Smile
What do you mean by "template", AFAIK we can't use templates for the help documents.
Sorry, I meant I used "{$helpdoc['url']}" in the theme's template where I wanted to use it. In this instance I wanted to use it in the misc_help_section_bit template.
Oh, I see now. I'm very curious, thanks!

EDIT: Also note a plugin so that you can directly edit that column in the add/edit pages would very a simple one, if you want to give it a try don't hesitate in asking for help in the plugin development forum.
Ok cool thanks that would be handy Smile For this particular one I don't really need to change it once I've entered it, but if/when I create one that does need to be added/edited regularly I'll make a thread Big Grin