&preHooks=`math`
$quip->preHooks->loadMultiple($this->getProperty('preHooks',''),$this->getProperties(),array(
$quip->preHooks->loadMultiple($this->getProperty('preHooks',''),$fields,array(
Alright, I got the math hook working. Had to alter a core file though. This is what I've done:
1) in core/components/articles/model/articles/article.class.php I added the hook to the QuipReply snippet call. Don't know if I should be doing it this way but for now it works.
Find the getCommentsReplyCall function around line 137 and add:
&preHooks=`math`
to the snippet call (I added it below all the other parameters).
2) make sure your quipAddComment chunk (I made a custom chunk for this) has fields with the names
- op1 (first nr), op2 (second nr), operator (+, - or *) and math (user has to fill in the answer to the question here).
3) Now it should be working but didn't so I googled around and found this Czech forum post:
http://www.modxcms.cz/forums/tema-v-novem-quip-nefunguji-prehooks
Using Google Translate I figured there was a small bug in a Quip file.
So I opened core/components/quip/processors/web/comment/create.php
and changed
$quip->preHooks->loadMultiple($this->getProperty('preHooks',''),$this->getProperties(),array(
into
$quip->preHooks->loadMultiple($this->getProperty('preHooks',''),$fields,array(
(around line 90).
And it works!
Hi I have tried and changed files exactly same as per your instructions but it is not working for me
[[+preview:notempty=`<h2>Een voorbeeld van uw bericht:</h2>[[+preview]]` ]] [[+successMsg:notempty=`<span class="quip-success" id="quip-success-[[+idprefix]]">[[+successMsg]]</span>`]] [[+error:notempty=` <div class="errorSummary"> <h3>Er zijn fouten gevonden in het formulier</h3> <ul> [[+error.name:notempty=`<li>Het veld <a href="[[~[[*id]]]]#quip-comment-name-[[!+idprefix]]">'naam'</a> is niet ingevuld</li>`]] [[+error.email:notempty=`<li>Het veld <a href="[[~[[*id]]]]#quip-comment-email-[[!+idprefix]]">'e-mail'</a> is niet ingevuld</li>`]] [[+error.comment:notempty=`<li>Het veld <a href="[[~[[*id]]]]#quip-comment-box-[[!+idprefix]]">'reactie'</a> is niet ingevuld</li>`]] [[+error.math:notempty=`<li>De <a href="[[~[[*id]]]]#quip-comment-math-[[!+idprefix]]">anti-spamvraag</a> is niet goed ingevuld</li>`]] </ul> </div> `]] <form class="formulier commentform" id="quip-add-comment-[[+idprefix]]" action="[[+url]]#quip-comment-preview-box-[[+idprefix]]" method="post"> <div class="quip-comment quip-add-comment" id="quip-comment-preview-box-qcom"> <input type="hidden" name="nospam" value="" /> <input type="hidden" name="thread" value="[[+thread]]" /> <input type="hidden" name="parent" value="[[+parent]]" /> <input type="hidden" name="auth_nonce" value="[[+auth_nonce]]" /> <input type="hidden" name="preview_mode" value="[[+preview_mode]]" /> <div class="quip-fld"> <label for="quip-comment-name-[[+idprefix]]" [[+error.name:notempty=`class="errorFirstLabel"`]]>[[%quip.name? &namespace=`quip` &topic=`default`]]*</label> <input type="text" class="required [[+error.name:notempty=`error`]]" name="name" id="quip-comment-name-[[+idprefix]]" value="[[+name]]" /> [[+error.name:notempty=`<span class="quip-error">[[+error.name]]</span>`]] </div> <div class="quip-fld"> <label [[+error.email:notempty=`class="errorFirstLabel"`]] for="quip-comment-email-[[+idprefix]]">[[%quip.email]]*<span class="note">Je e-mailadres wordt niet gepubliceerd.</span></label> <input type="text" class="required email [[+error.email:notempty=`error`]]" name="email" id="quip-comment-email-[[+idprefix]]" value="[[+email]]" />[[+error.email:notempty=`<span class="quip-error">[[+error.email]]</span>`]] </div> <div class="quip-fld"> <label for="quip-comment-website-[[+idprefix]]">[[%quip.website]]<span class="quip-error">[[+error.website]]</span></label> <input type="text" name="website" class="url" id="quip-comment-website-[[+idprefix]]" value="[[+website]]" /> </div> <label [[+error.comment:notempty=`class="errorFirstLabel"`]] class="labelTextarea" for="quip-comment-box-[[+idprefix]]">Je bericht</label> <textarea class="required [[+error.comment:notempty=`error`]]" name="comment" id="quip-comment-box-[[+idprefix]]" rows="5" cols="70">[[+comment]]</textarea> <p> [[+error.comment:notempty=`<span class="quip-error">[[+error.comment]]</span>`]] </p> <div class="quip-fld antispam"> <label [[+error.math:notempty=`class="errorFirstLabel"`]] for="quip-comment-math-[[+idprefix]]">Hoeveel is 3 + 2?</label> <input type="hidden" id="op1" name="op1" value="3" /> <input type="hidden" id="operator" name="operator" value="+" /> <input type="hidden" id="op2" name="op2" value="2" /> <input type="text" class="[[+error.math:notempty=`error`]] math" name="math" id="quip-comment-math-[[+idprefix]]" value="[[+math]]" /> [[+error.math:notempty=`<span class="quip-error">Vul hier '5' in.</span>`]] </div> <div class="quip-fld checkbox"> [[+unsubscribe:default=` <input class="inputCheckbox" type="checkbox" value="1" name="notify" id="quip-comment-notify-[[+idprefix]]" [[+notifyChecked]] /> `]] <label class="labelCheckbox" for="quip-comment-notify-[[+idprefix]]">[[%quip.notify_me]]<span class="quip-error">[[+error.notify]]</span></label> </div> [[+can_post:is=`1`:then=`<button type="submit" class="actieButton" name="[[+post_action]]" value="1">[[%quip.post]]</button>`]] </div> </form>