We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33992 ☆ A M B ☆
    • 455 Posts
    Jot + Events

    I’ve added some events to Jot snippet. So developers can add their custom codes to Jot core easily.
    The events are:
    [table]
    [tr]
    [td]onBeforeConfiguration[/td]
    [td]Before processing parameters[/td]
    [/tr]
    [tr]
    [td]onBeforeRunActions[/td]
    [td]Before executing Jot active actions such as "publish", "edit", etc[/td]
    [/tr]
    [tr]
    [td]onRunActions[/td]
    [td]After executing Jot active actions such as "publish", "edit", etc[/td]
    [/tr]
    [tr]
    [td]onConfiguration[/td]
    [td]After processing and validating parameters[/td]
    [/tr]
    [tr]
    [td]onFirstRun[/td]
    [td]On creating tables and default data[/td]
    [/tr]
    [tr]
    [td]onSubscriptionCheck[/td]
    [td]On checking for subscriptions[/td]
    [/tr]
    [tr]
    [td]onDeleteComment[/td]
    [td]On deleting a comment[/td]
    [/tr]
    [tr]
    [td]onGetCommentFields[/td]
    [td]On getting all data for a comment[/td]
    [/tr]
    [tr]
    [td]onSaveComment[/td]
    [td]On inserting or update comment[/td]
    [/tr]
    [tr]
    [td]onGetSubscriptions[/td]
    [td]On getting subscribers[/td]
    [/tr]
    [tr]
    [td]onGetUserInfo[/td]
    [td]On getting user data[/td]
    [/tr]
    [tr]
    [td]onBeforeNotify[/td]
    [td]Right before runnig mail() to notify users[/td]
    [/tr]
    [tr]
    [td]onBeforeSubscribe[/td]
    [td]Before inserting data into `jot_subscriptions` table[/td]
    [/tr]
    [tr]
    [td]onBeforeUnsubscribe[/td]
    [td]Before deleting data from `jot_subscriptions` table[/td]
    [/tr]
    [tr]
    [td]onValidateFormFieldFail[/td]
    [td]Jot uses Regex to validate form fields and returns error message when there is no match.
    This function runs there in a loop of validation inputs.
    [/td]
    [/tr]
    [tr]
    [td]onBeforePOSTProcess[/td]
    [td]While processing form values from $_POST array[/td]
    [/tr]
    [tr]
    [td]onProcessForm[/td]
    [td]Right before returning processed form data[/td]
    [/tr]
    [tr]
    [td]onBeforeProcessPassiveActions[/td]
    [td]Before executing Jot passive actions such as "count-comments"[/td]
    [/tr]
    [tr]
    [td]onProcessPassiveActions[/td]
    [td]After executing Jot passive actions[/td]
    [/tr]
    [tr]
    [td]onBeforeGetCommentCount[/td]
    [td]Right before calculating comment count[/td]
    [/tr]
    [tr]
    [td]onBeforeGetComments[/td]
    [td]After creating SQL query and before execute SQL command[/td]
    [/tr]
    [tr]
    [td]onGetComments[/td]
    [td]After executing SQL command to get comments[/td]
    [/tr]
    [tr]
    [td]onReturnOutput[/td]
    [td]After Processing all comment data to display[/td]
    [/tr]
    [tr]
    [td]onSetDefaultOutput[/td]
    [td]On setting dafult output[/td]
    [/tr]
    [/table]


    I’ve also created 4 sample custom codes using these events:

    • Accept `*` value for &docid parameter that gets last comments of site.
    • Kakapo protection.
    • Author Moderator that sets document author as moderator of comments of current document.
    • Subscribe Guests that allows site to subscribe guests who are not member of site. Guests will be notified via their emails for new comments.


    In the zip file there is another file named clearComments.plugin.php.
    When Trash can is empties and some documents are deleted, this plugin removes comments of those documents.


    In recent pack, i’ve added Kakapo plugin to it. Kakapo filters comments from known spammers. You can uncomment some lines to enable it.


    This version is in development because i havn’t tested that grin


    Have a good Jotting!
    AHHP

      God loves me. 【ツ】


      MODX.ir (Persian Support)

      Boplo.ir/modx/ (Persian)
      • 17499 ☆ A M B ☆
      • 872 Posts
      Thanks for sharing
        • 20413
        • 2,877 Posts
        Coool! cool
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 9496
          • 113 Posts
          Does this replace the dafault install of Jot? Im trying to come up with a way to post recent comments from the site and Im having a hell of a time. Since Im thinking it does, once I have the new snippet code, is it a matter of simply uncommenting (or adding to) the events.php file right?

          thanks-
          P
            • 33992 ☆ A M B ☆
            • 455 Posts
            Yes, Read the event functions and uncomment codes you need. For it uncomment onBeforeConfiguration and onBeforeGetComments codes but i didn’t test it!
              God loves me. 【ツ】


              MODX.ir (Persian Support)

              Boplo.ir/modx/ (Persian)
              • 7231
              • 4,205 Posts
              This is great... how did I miss this release??? Thanks AHHP for another great addition to Jot grin grin
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 9496
                • 113 Posts
                I was trying to get this to work with no avail. I am essentially developing a photo contest site, with comments enabled. I can comment on photos just fine but my jot call on a separate page doesn’t return any results.

                My jot call on my mg template is like this:
                [+jot.html.form.[+maxigallery.picture.id+]+]
                		<h2>Comments</h2>[+jot.html.comments.[+maxigallery.picture.id+]+]
                	[[Jot? &placeholders=`1` &output=`0` &tagid=`[+maxigallery.picture.id+]` &canpost=`Registered` &canmoderate=`WebAdmin` &canedit=`Registered`]]
                


                I can write and manage comments no problem.

                Now I have a call in another chunk that looks like this:

                <h2>Recent Comments</h2>
                [[Jot?  &placeholders=`1` &output=`0` &docid=`*` &debug=`0`]]
                [+jot.html.comments+]


                Where it gets squirrely is that there is no real docID other than the one for the parent. Looking at the db table for jot_content all of the comments are obviously there, but the tagID’s are different and the UPARENT is "2" which is the id of the gallery view page but the parent reads 0. I dont even see where a docID field comes into play.

                I thought it maybe an SQL thing (Im using 4.x) or I am just missing the point of how jot returns comments and how the parameters fit together.

                Ideally it would simply return the last 5 comments from the jot content table. If anyones got any ideas that would be greatly appreciated.
                thanks-
                P


                  • 32337
                  • 28 Posts
                  Forgive me if I’m being a little slow, but how do you use this? I was trying to save some fields to a custom table and adding &onSaveComment=`snippitName` to the jot call doesn’t do the trick. I tried inserting the php from snippitName into the onSaveComment function in jot.events.php and that doesn’t work either. Clearly, I haven’t a clue what I should be doing. Can someone enlighten me, please?
                    • 33992 ☆ A M B ☆
                    • 455 Posts
                    @Fatknuckle: Sorry, It didn’t work because it typed "paramaters" instead "parameters"! Please download updated zip file.

                    @whitless: Each function has it’s own I/O data. Please read function description to get effects.


                    I updated the pack and added Kakapo plugin. Kakapo checks comment data for known spammers and hacker. Some lines in events must be uncommented to enable it.
                      God loves me. 【ツ】


                      MODX.ir (Persian Support)

                      Boplo.ir/modx/ (Persian)
                      • 9496
                      • 113 Posts
                      Ill give it a go...thanks.

                      UPDATE I tried and still no joy. I also tried it on a different version MySql and that didnt roll either. In fact now I cant post comments (which works under the default jot install. (It usually updates automatically to show the comment). Ill see if theres something Im missing.
                      P

                      FYI Im using v 1 (evo)...hmm