We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    Is there any way to limit the users who show up in the "Created By" dropdown when creating or editing a blog post? The default seems to be to show every single user in the user table - even inactive ones. It would be nice to be able to limit this to a specific user group.

      • 23018
      • 353 Posts
      This should work:

      Hide the field,
      set the value to the content of a new tv using form customization
      create a custom select list tv including the names of the users you want to be available.

      The list can be automatically created by a sql statement inside the tvs value field or manually edited.

      Regards,

      pepebe


        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
        • 14883 ☆ A M B ☆
        • 450 Posts
        Quote from: pepebe at Feb 24, 2014, 06:25 PM
        This should work:

        Hide the field,
        set the value to the content of a new tv using form customization
        create a custom select list tv including the names of the users you want to be available.

        The list can be automatically created by a sql statement inside the tvs value field or manually edited.

        Regards,

        pepebe



        This was my first thought too. I looked in form customization (I've used it before many times), but there isn't a TV or a resource field that corresponds with "Created By". I'm guessing that Custom Resource Types and Form Customization don't play nice together?
          • 8274 ☆ A M B ☆
          • 222 Posts
          I had tried some form customizations, even adding javascript to attempt to move some things on the custom resource type, and it just seems that the custom resource goodies run after all the mgr default, plugins and form customizations run.
            • 14883 ☆ A M B ☆
            • 450 Posts
            I think the easiest short-term solution for me personally is to refactor my other custom app - which currently uses the Users table, and move those records to a custom table (there's no reason they need to be MODX users, I just used that table because it was quick and had the fields I needed). That will de-clutter the Created By dropdown on this install.

            The proper long-term, robust solution seems to be to enhance Articles to allow a particular user group to be specified for use in the Created By dropdown.

            Thoughts anyone?
              • 14883 ☆ A M B ☆
              • 450 Posts
              I think the easiest short-term solution for me personally is to refactor my other custom app - which currently uses the Users table, and move those records to a custom table (there's no reason they need to be MODX users, I just used that table because it was quick and had the fields I needed). That will de-clutter the Created By dropdown on this install.

              The proper long-term, robust solution seems to be to enhance Articles to allow a particular user group to be specified for use in the Created By dropdown.

              Thoughts anyone?
                • 23018
                • 353 Posts
                Sorry, I didn't check this.

                I have to admit that I can't even find a "Created By" dropdown in my resources. I know its in the table and I believe I have seen it in the past, but I'm not sure about any more.

                Why don't you go for a custom Tv and later used the value to accomplish things?

                Populating a select TV with users that meet certain requirements is easy:

                @SELECT `username` AS `name`,`id` FROM `[[+PREFIX]]users` WHERE `active` = 1

                Code copied from: http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/template-variables/bindings/select-binding

                This will return the name of the choosen user and limit the list to active ones.

                Regards,

                pepebe
                  Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe