We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39519 ☆ A M B ☆
    • 79 Posts
    I'm working on a CMP to manage all the extended fields of a user, but am stuck on a couple simple functionalities.

    Rather than having the end user manage information in two places, I want to have the ability to right click on a user and have the "Update User" button link to their Manage Users page (action id 34). I already have the Manage Users page set up to modify the extended user table, so I think this option will create a simple interface.

    Basically I just want to create a button that links to index.php?a=34&id='thisID'

    I'm working in Revo 2.2.6. Thanks in advance, and any help is appreciated!
      Mat Dave Jones
      • 39519 ☆ A M B ☆
      • 79 Posts
      Bump*

      This has got to be easy! I am thinking I need to define the action in the getlist.class.php and pass it as a function to grid.js ...

      Anyone think I'm on to something, or is it way easier?
        Mat Dave Jones
        • 8386 ☆ A M B ☆
        • 160 Posts
        There is this little magic method which allows you to use namespace:actionname

        MODx.action['core:security/user/update']


        That will return action id 34. This code is to be used in grid.js. I hope I understand your question correctly.
          • 39519 ☆ A M B ☆
          • 79 Posts
          Thanks for the heads up, how do should I call this action to pass the current User Id right now I'm at
          {
             text: _('ext.update')
             ,handler: MODx.action['core:security/user/update']
          }
          


          Which does nothing... D'oh
            Mat Dave Jones
            • 39519 ☆ A M B ☆
            • 79 Posts
            ....
            getMenu: function() {
                        return [{
                            text: _('ext.update')
                            ,handler: this.updateUser
                        }];
            },
            updateUser: function(btn,e) {
                            location.href = 'index.php?a='+MODx.action['security/user/update']+'&id='+this.menu.record.id;
            },
            ....
            


            Updated it to a function, and still getting an output of manager/index.php?id=249&action=
              Mat Dave Jones
              • 8386 ☆ A M B ☆
              • 160 Posts
              Quote from: matdave at Feb 26, 2013, 11:10 AM
              ....
              getMenu: function() {
                          return [{
                              text: _('ext.update')
                              ,handler: this.updateUser
                          }];
              },
              updateUser: function(btn,e) {
                              location.href = 'index.php?a='+MODx.action['security/user/update']+'&id='+this.menu.record.id;
              },
              ....
              


              Updated it to a function, and still getting an output of manager/index.php?id=249&action=

              I don't see why your url has action= in it when you have a= in your code example and you seem to be missing core: before security/user/update also.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Could it be a browser cache issue? If the browser has cached the javascript, then the edited javascript might not be getting run by the browsers?
                  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
                  • 39519 ☆ A M B ☆
                  • 79 Posts
                  After a long afternoon of meetings, I forgot to get back to it. Now, it is working like a charm (ish)... I just need to figure out how to pass the correct ID, since it is basing on the Primary ID of the ext field, which is unrelated to the internalKey
                    Mat Dave Jones
                    • 39519 ☆ A M B ☆
                    • 79 Posts
                     
                    updateUser: function(btn, e) {
                                    var userrec = this.menu.record.data;
                                    var userid = userrec['internalKey'];
                                    location.href = 'index.php?a='+MODx.action['security/user/update']+'&id='+userid;
                    }
                    


                    Please don't laugh at how wrong that code is... I am getting a JS error that "Cannot read property 'record' of undefined"

                    What do i need to do to get a variable out of the record other than this.menu.record.id?
                      Mat Dave Jones
                      • 39519 ☆ A M B ☆
                      • 79 Posts
                      OMG... so dumb.

                      I took out the ".data" from the last code and everything works.
                        Mat Dave Jones