[How to] Modify the phpBB 3.2 FAQ

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
Lady_G
Registered User
Posts: 245
Joined: Fri Jun 08, 2012 12:38 pm
Location: US

[How to] Modify the phpBB 3.2 FAQ

Post by Lady_G »

At the time of this post, there are no validated extensions to modify the phpBB 3.2 FAQ (Ref: Editing with FAQ Manager). Here's how I modified the source code to implement changes for my board's FAQ.

The FAQ is organized in (install)/phpbb/help/controller/faq.php.

The code is organized by blocks which are listed in the order to be displayed. $this->manager->add_block is the start of each block. For example:

Code: Select all

$this->language->add_lang('help/faq');

$this->manager->add_block(
			'HELP_FAQ_BLOCK_LOGIN',
			false,
			array(
				'HELP_FAQ_LOGIN_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_ANSWER',
				'HELP_FAQ_LOGIN_COPPA_QUESTION' => 'HELP_FAQ_LOGIN_COPPA_ANSWER',
				'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER',
				'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER',
				'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER',
				'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER',
				'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER',
				'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER',
				'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER',
			)
		);
Shows that the first FAQ section is labeled 'HELP_FAQ_BLOCK_LOGIN'. The next entries are the questions and answers for that section.

The text in ALL CAPS are the variables read from the language pack. In (install)/language/en/help/faq.php, first notice that all of the variables are in alphabetical order. Find HELP_FAQ_BLOCK_LOGIN to see the section title:

Code: Select all

	'HELP_FAQ_BLOCK_LOGIN'	=> 'Login and Registration Issues',
Then, find the first two questions and answers later as:

Code: Select all

	'HELP_FAQ_LOGIN_COPPA_ANSWER'	=> 'COPPA, or the Children’s Online Privacy Protection Act of 1998, is a law in the United States requiring websites which can potentially collect information from minors under the age of 13 to have written parental consent or some other method of legal guardian acknowledgment, allowing the collection of personally identifiable information from a minor under the age of 13. If you are unsure if this applies to you as someone trying to register or to the website you are trying to register on, contact legal counsel for assistance. Please note that phpBB Limited and the owners of this board cannot provide legal advice and is not a point of contact for legal concerns of any kind, except as outlined in question “Who do I contact about abusive and/or legal matters related to this board?”.',
	'HELP_FAQ_LOGIN_COPPA_QUESTION'	=> 'What is COPPA?',
...	
	'HELP_FAQ_LOGIN_REGISTER_ANSWER'	=> 'You may not have to, it is up to the administrator of the board as to whether you need to register in order to post messages. However; registration will give you access to additional features not available to guest users such as definable avatar images, private messaging, emailing of fellow users, usergroup subscription, etc. It only takes a few moments to register so it is recommended you do so.',
...
	'HELP_FAQ_LOGIN_REGISTER_QUESTION'	=> 'Why do I need to register?',
You can modify the section titles, questions, and answers of the phpBB supplied content (which is the intent of a language pack).

To add new content, insert a new $this->manager->add_block in (install)/phpbb/help/controller/faq.php. Then add the corresponding variables in the language pack FAQ.php file.

As an example, I will add a FAQ section titled "Prime Numbers" after "Login and Registration Issues".

In (install)/phpbb/help/controller/faq.php, find:

Code: Select all

		$this->manager->add_block(
			'HELP_FAQ_BLOCK_LOGIN',
			false,
			array(
				'HELP_FAQ_LOGIN_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_ANSWER',
				'HELP_FAQ_LOGIN_COPPA_QUESTION' => 'HELP_FAQ_LOGIN_COPPA_ANSWER',
				'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER',
				'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER',
				'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER',
				'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER',
				'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER',
				'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER',
				'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER',
			)
		);
Add after:

Code: Select all

		$this->manager->add_block(
			'HELP_FAQ_BLOCK_TESTING',
			false,
			array(
				'HELP_FAQ_TESTING_ONE_QUESTION' => 'HELP_FAQ_TESTING_ONE_ANSWER',
				'HELP_FAQ_TESTING_TWO_QUESTION' => 'HELP_FAQ_TESTING_TWO_ANSWER',
			)
		);
In (install)/language/en/help/faq.php, first add the section title. Find:

Code: Select all

	'HELP_FAQ_BLOCK_SEARCH'	=> 'Searching the Forums',
Add after:

Code: Select all

	'HELP_FAQ_BLOCK_TESTING' => 'Prime numbers',
Next, the questions and answers. Find:

Code: Select all

	'HELP_FAQ_SEARCH_OWN_QUESTION'	=> 'How can I find my own posts and topics?',
Add after:

Code: Select all

	'HELP_FAQ_TESTING_ONE_ANSWER' => 'A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.',	
	'HELP_FAQ_TESTING_ONE_QUESTION' => 'What is a prime number?', 
	'HELP_FAQ_TESTING_TWO_ANSWER' => 'The first five prime numbers are 2, 3, 5, 7, and 11.',	
	'HELP_FAQ_TESTING_TWO_QUESTION' => 'What are the first five prime numbers?',
You must perform the same modifications to all of the installed language packs. I have American English and have added the section title, questions and answers to (install)/language/en_us/help/faq.php. Otherwise, the FAQ controller will not recognize the modifications (found during testing).

Refresh your browser page to see the changes.

User avatar
david63
Registered User
Posts: 17779
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: [How to] Modify the phpBB 3.2 FAQ

Post by david63 »

And remember - you may need to redo those changes after an update
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
strawberrybrick
Registered User
Posts: 2
Joined: Wed Feb 14, 2018 3:22 pm
Location: Chicago, IL
Contact:

Re: [How to] Modify the phpBB 3.2 FAQ

Post by strawberrybrick »

Tried this, but doesn't seem to read the part in the language pack. Using 3.2.2 with en_us.

HELP_FAQ_BLOCK_WEBSITE
HELP_FAQ_WEBSITE_ONE_QUESTION
HELP_FAQ_WEBSITE_TWO_QUESTION
HELP_FAQ_WEBSITE_THREE_QUESTION
HELP_FAQ_WEBSITE_FOUR_QUESTION


Edit: REQUIRED A LOGOUT TO WORK!

Post Reply

Return to “[3.2.x] Support Forum”