[Guestbook] Protect with password

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: [Guestbook] Protect with password

Post by Dee »

Hi,
That shouldn't be too hard. You could also use FrontEndUsers/CustomContent to achieve this without modifying the module.

In lib/classes/module/class.GuestbookFrontend.php :

Code: Select all

		if ($params['showaddform'] == TRUE || $this->getMode() == 'form')
		{
			$this->setShowForm(TRUE);
		}
		else 
		{
			if (isset($_POST['show_addform'])) 
			{
				$this->setShowForm(TRUE);
			}
			elseif(! (isset($_POST['submitted']) && !isset($_POST['cancel'])))
			{
				$this->setShowInsertButton(TRUE);
			}
		}
I think something like this would work:

Code: Select all

		if ($params['showaddform'] == TRUE || $this->getMode() == 'form')
		{
			$this->setShowForm(TRUE);
		}
		else 
		{
			if (isset($_POST['show_addform'])) 
			{
				if ($_POST['password'] == 'the right password')
				{
					$this->setShowForm(TRUE);
				}
				else
				{
					echo 'the wrong password was entered';
					$this->setShowInsertButton(TRUE);
				}
			}
			elseif(! (isset($_POST['submitted']) && !isset($_POST['cancel'])))
			{
				$this->setShowInsertButton(TRUE);
			}
		}
Regards,
D
Post Reply

Return to “Modules/Add-Ons”