Topic: Guestbook

Guestbook

Guestbook plugin for Monstra!

After installation Guestbook will be available at url http://siteurl/guestbook


Download: guestbook.zip

Monstra Loves You! Give some love back!

Re: Guestbook

Any demo please? Or screenshoot?

Re: Guestbook

The guestbook plugin how to use?

Re: Guestbook

mylife,

1) http://monstra.org/documentation/plugins-installation
2) After installation Guestbook will be available at url http://siteurl/guestbook

Monstra Loves You! Give some love back!

Re: Guestbook

Markdown and Guestbook with installation conflict arises.

Re: 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

Re: Guestbook

Здравствуйте. А возможно ввести форму гостевой книги на всех страницах сайта? Инклужу form.view.php на другие страницы сайта, форма не срабатывает. Подcкажите куда копать? Или она будет работать только в url /guestbook

Re: 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

http://monstracreative.com - themes, plugins and snippets for monstra cms

:: ATTENTION ::
Need help? Login at your account at: http://monstracreative.com/users/login. -> You have a excellent support center at our website! wink

9 (edited by Jo2003 2015-01-06 07:49:15)

Re: Guestbook

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

Re: Guestbook

Yes that's it! thank you Jorg

http://monstracreative.com - themes, plugins and snippets for monstra cms

:: ATTENTION ::
Need help? Login at your account at: http://monstracreative.com/users/login. -> You have a excellent support center at our website! wink

Re: Guestbook

Fixed few bugs and mostly design part, works fine with Monstra 3.0.1

(с) Roman Art
So far So good wink

Re: Guestbook

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

Re: Guestbook

RomanArt wrote:

Fixed few bugs and mostly design part, works fine with 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!
http://savepic.ru/8644793m.png

Re: Guestbook

ya i can see that not sure why T_T

(с) Roman Art
So far So good wink

Re: Guestbook

Took a look.  The problem goes away when I disable the markdown plugin. I'll see if I can figure out how to fix...

16 (edited by monstrahost 2016-02-10 22:11:46)

Re: Guestbook

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!