We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20413
    • 2,877 Posts
    @Kongondo: TACK!!  smiley
    @AHHP:  Ah! Yes I had to add .zip, to the file inside the first zip, then it worked - AWESOME DOCUMENTATION!!

    It seems as this could enable add/remove friends function for webusers!!! //Nice tut -> http://blog.themeforest.net/screencasts/diving-into-php-day-15/
      @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
      • 24935
      • 160 Posts
      Thanks! This has potential...
        • 29774
        • 386 Posts
        This is great  smiley

        Any chance we could get a few more user management related methods, eg:

        * loginUser
        * logoutUser
        * autoLoginUser
        * setUserAttribute (...using a webloginpe style custom user attributes table linked by a foreign key to the user id)
        * getUserAttribute
        * activateUser
        * resetPassword
        * emailPassword
        * emailWebgroup
        * emailUser
        * pruneUsers
          Snippets: GoogleMap | FileDetails | Related Plugin: SSL
          • 33992 ☆ A M B ☆
          • 455 Posts
          There was some bugs in escape methods. If you have used it, please downlaod new version.

          Thanks
            God loves me. 【ツ】


            MODX.ir (Persian Support)

            Boplo.ir/modx/ (Persian)
            • 20912
            • 21 Posts
            BUG FOUND in joinDocgroup method:
            /**
            * Join document(s) to a Docgroup.
            *
            * @param string $groupname Name for Document Group.
            * @param integer _unlimited_ ID of documents to join as member.
            * @return boolean TRUE on success and FALSE on failure.
            */
            function joinDocgroup($groupname)

            After executing that method I’ve got TWO(instead of one) documents - first Right one
            , Secont - Wrong one. Empty documents in Root
            folder with no content and category (absolutely empty doc).

            CakemMODx version: 1.1beta dated: 12.05.2009.
            MODx version: 0.9.6.3

            Example of bug in that snipnet:

            function CreateNewArticle(&$fields){
            include ’assets/libs/CakeModx/CakeModx.class.php’;
            $Article = new CakeModx;
            $params = array(
            "parent" => "26",
            "template" => "6",
            "hidemenu" => "1",
            "searchable" => "0",
            "createdon" => time(),
            "pagetitle" => $fields[’pagetitle’],
            "content" => $fields[’content’],
            "published" => 1
            );
            $id = $Article->newDocument($params);
            if($id)
            {
            $Article->joinDocgroup(’DocsForRegistered’,$id);
            $Article->updateCache();
            }
            }
              • 20912
              • 21 Posts
              Addition BUG:
              As I told early there where some bug, but as well I forgot to tell that there is one more bug; As you could see
              in my preview reply I’ve got array of params:
              $params = array(
              "parent" => "26",
              "template" => "6",
              ...
              Template in number instead of word. If I type "template" => "mainTheme" - that parametr will no matter for newDocument method; And after execute that code ("template" => "mainTheme") - template of doc will be - "blank", on ther side "template" => "6" - will place mainTheme template for new document.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                It’s not unusual to require the ID for a document or template or other element, since the parser will use the ID. Most snippets such as Wayfinder and Ditto, for example, use the document ID. You can have duplicate element/resource names, as well as document titles. That would be a problem, so using the ID makes a lot of sense. Also, names can be changed, but the ID cannot.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 33992 ☆ A M B ☆
                  • 455 Posts
                  Thank you for reporting,

                  There was a mistake in line 1435
                  if(! $this->db->insert(array("privateweb" => 1) , $sc, "id=$memId") )

                  Must be
                  if(! $this->db->update(array("privateweb" => 1) , $sc, "id=$memId") )


                  I updated the download link too.

                  ----------------
                  About template problem, Susan is right, it is possible to have elements in same name in MODx, names can be changed in anytime but ID is unique, unchangable (in backend) and safer.
                  but if your input is template name, you can easily get template ID by template name like below:
                  <?php
                  $params['template'] = $modx->db->getVlaue($modx->db->select("id", $modx->getFullTableName("site_templates"), "templatename='$input_name'"));
                  


                  Good luck
                    God loves me. 【ツ】


                    MODX.ir (Persian Support)

                    Boplo.ir/modx/ (Persian)
                    • 33992 ☆ A M B ☆
                    • 455 Posts
                    hello,
                    I’ve upgraded the class with adding a few methods:

                    • getDocumentOutput: Print output of a document.
                    • comment_new: Create a new comment.
                    • comment_move: Move comments to another document.
                    • stripModxTags: Strip MODx and/or HTML tags.
                    • getIP: Get IP.


                    Thanks
                    AHHP
                      God loves me. 【ツ】


                      MODX.ir (Persian Support)

                      Boplo.ir/modx/ (Persian)
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      getDocumentOutput: Print output of a document.
                      I have often thought it was a pity that the document parser ends with an echo statement; it would be very useful sometimes if it just returned the documentOutput, and the index.php did the echo, so that one could use the parser to get the document’s output for other purposes (besides in a plugin).
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org