Topic: Guestbook
Guestbook
Guestbook plugin for Monstra!
After installation Guestbook will be available at url http://siteurl/guestbook
Download: guestbook.zip
You are not logged in. Please login or register.
Guestbook
Guestbook plugin for Monstra!
After installation Guestbook will be available at url http://siteurl/guestbook
Download: guestbook.zip
mylife,
1) http://monstra.org/documentation/plugins-installation
2) After installation Guestbook will be available at url http://siteurl/guestbook
Error
Aw, snap! An error has occurred while processing your request.
[31-Mar-2013 02:45:58] ErrorException: Warning: Invalid argument supplied for foreach() in /html/plugins/guestbook/views/frontend/index.view.php at line 3
Здравствуйте. А возможно ввести форму гостевой книги на всех страницах сайта? Инклужу form.view.php на другие страницы сайта, форма не срабатывает. Подcкажите куда копать? Или она будет работать только в url /guestbook
Hi there, thanks for the plugin, but did you notice that when we submit the guestbook details we are redirected to domain.comguestbook and its a 404 not found error, should be like domain.com/guestbook! Do you have that update done yet?
Thanks in advance
In guestbook.plugin.php change function main() to following code:
/**
* Guestbook main functions
*/
public static function main() {
// Get guestbook table
Guestbook::$guestbook = new Table('guestbook');
// Select all records
$records = Guestbook::$guestbook->select(null, 'all');
// Get post data
$username = Request::post('guestbook_username');
$email = Request::post('guestbook_email');
$message = Request::post('guestbook_message');
$actionlink = Option::get('siteurl').'/guestbook';
$errors = array();
// Add new record
if (Request::post('guestbook_submit')) {
if (Security::check(Request::post('csrf'))) {
if (Request::post('guestbook_username') == '' || Request::post('guestbook_email') == '' || Request::post('guestbook_message') == '') {
$errors['guestbook_empty_fields'] = __('Empty required fields!', 'guestbook');
}
if ( ! Valid::email(Request::post('guestbook_email'))) {
$errors['guestbook_email_not_valid'] = __('Email address is not valid!', 'guestbook');
}
if (Option::get('captcha_installed') == 'true' && ! CryptCaptcha::check(Request::post('answer'))) {
$errors['users_captcha_wrong'] = __('Captcha code is wrong', 'users');
}
if (count($errors) == 0) {
Guestbook::$guestbook->insert(array('username' => $username, 'email' => $email, 'message' => $message, 'date' => time()));
Request::redirect($actionlink);
}
} else { die('csrf detected!'); }
}
// Get index view
Guestbook::$guestbook_records = View::factory('guestbook/views/frontend/index')
->assign('records', $records)
->render();
// Get form view
Guestbook::$guestbook_form = View::factory('guestbook/views/frontend/form')
->assign('token', Security::token())
->assign('actionlink', $actionlink)
->assign('username', $username)
->assign('email', $email)
->assign('message', $message)
->assign('errors', $errors)
->render();
}The problem is the redirect link which in original misses a slash.
Best regards,
Jörg
Yes that's it! thank you Jorg
Fixed few bugs and mostly design part, works fine with Monstra 3.0.1
DEMO: http://free.demo-mp.monstrapro.com/guestbook
DOWNLOAD: guestbook.zip Monstra 3.0.1
If you mean locally rather than online you will need a development environment such as https://www.apachefriends.org
extract the latest Monstra build into the root folder (probably htdocs) and run the install from you browser.
http://localhost/
For plugins extract the files from the relevant archives to the plugins folder in Monstra. Then install them via Monstra control panel
More details and online installation: http://monstra.org/documentation/installation
Fixed few bugs and mostly design part, works fine with Monstra 3.0.1
DEMO: http://free.demo-mp.monstrapro.com/guestbook
DOWNLOAD: guestbook.zip Monstra 3.0.1
I found a bug in the guestbook, when you write a link, then after this message is displayed is not correct... Please fix this bug!
Took a look. The problem goes away when I disable the markdown plugin. I'll see if I can figure out how to fix...
Not sure exactly what the problem is, but it seems you can fix it by editing the view file at
/plugins/guestbook/views/frontend/index.view.php
<h2><?php echo __('Guestbook', 'guestbook'); ?></h2>
<br />
<?php foreach($records as $record) { ?>
<h4><?php echo Html::toText($record['username']); ?> <small> - <?php echo Date::format($record['date']); ?></small></h4>
<p><?php echo Html::toText($record['message']); ?></p>
<hr />
<?php } ?>This works with markdown plugin active.
Cheers!