Page 1 of 1

Re: [Guestbook] Protect with password

Posted: Sun Mar 04, 2007 1:10 pm
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