We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54265
    • 10 Posts
    Greetings,

    My goal is to have users log in, and on the dashboard have a button that allows them to upload to a root folder, but I'm not sure how to accomplish this within the widget. I know how to create a widget, but its more about setting up the code in the back end. I'm not sure how to create the button, and how to tell it [[+base_url]]/assets/img/images/user-uploads/

    This was my goal I achieved
    https://i.imgur.com/DZzLTRo.jpg

    I'm going to write this out for whoever may find this in the future and need more instruction

    To add a widget:
    -Log in to modx manager
    -Click the gear icon in the top right->Dashboards
    -Create Widget
    -Assign FileUpload or Quickstart Buttons

    To get Quickstart Buttons, go to the link below and follow those instructions. Don't forget to install!
    https://www.modmore.com/extras/quickstartbuttons/download/

    FileUpload can be installed from your Extras->Installer->Download Extras

    I became stuck at one point, so I checked the error log to see what the exact issue was. To view your error log, go to
    - Manage->Reports->Error Log
    Be sure to scroll all the way down to see the most recent error.

    Quickstart Buttons had an error where if a user was not given a role, it would give a 500 error. If you receive the same error, make sure your users all have roles assigned to them.

    Edit your quickstart settings by going to Extras->Quickstart Buttons
    -Add new set
    -Enter information
    -assign user groups
    -assign image to your new button if you like
    -add new button
    -underneath link, make sure 'Systems Action:' is media/browser
    -make sure namespace is core

    If everything went ok, you'll have a new button on your dashboard. It opens to the root file, which is not ideal for users to upload to. We need to change this.

    In the menu at the top, click the media button, then click 'Media Sources'
    -create new Media Source
    -make sure source type is File System
    -update basePath and baseUrl to the folder you want it to upload to (create the folder first or this may cause an error)
    -baseUrl and basePath should look something like 'assets/img/images/uploads/

    Check to make sure your button is still working. If so, we are moving on the last step which is where we make our new Media Source the default for our browser. There's probably a better way to assign Quickstart Buttons default media source, but this is a quick and dirty way to accomplish the task.

    In the menu in the top, go to the gear icon and select->System Settings
    -In the search bar, look up 'default_media_source'
    -Right click Default Media Source
    -At the bottom, change the value to your desired media source

    Go test your button on the dashboard. Users should now only see your designated upload folder.

    Major thanks to Mark Hamstra of Quickstart Buttons, Bob Ray of FileUpload, and LK for the direction when I was lost.

    This question has been answered by multiple community members. See the first response.

    [ed. note: brittislove last edited this post 8 years, 5 months ago.]
    • discuss.answer
      • 17301
      • 932 Posts
      A quick way to do it would be to use quickstarbuttons extra from modmore. Create a dashboard button that then takes them to the media browser.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
      • discuss.answer
        • 3749
        • 24,544 Posts
        You might try installing the FileUpload extra and creating an HTML widget with this content:

        [[!FileUpload?
            &filefields=`5`
            &uploadgroups=`Administrator,Editors,Subadmins`
            &path=`assets/uploads`
            &createPath=`1`
        
        ]]
        


        That would upload the files to the asset/uploads directory. I don't think it will work if the &path property is empty.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 54265
          • 10 Posts
          This solution is becoming somewhat troublesome in itself. I created an account with modmore, got the api, installed it in my modx, and placed it in the widget, but now it's giving the popular 500 error. Not sure why, I'm guessing maybe its the PHP version but I'm not sure.

          And Bob Ray, thank you for chiming in as well, FileUpload was my first choice but I was unsure what code to use. Thank you, I'll test this out tomorrow and update the thread
            • 54265
            • 10 Posts
            Good morning all, I've continued to experiment with both solutions and have reached two different problems. I am not trying to run both at the same time.

            I'm using ModX Revo 2.6.3-pl

            Edit 1: I checked the error log and I believe that my pathing is the issue here. I'll have to investigate and code-ilate some more tomorrow. To see the error log in to the back end, in the top menu go to Manage->Reports->Error Log Report. Be sure to scroll to the bottom to see the most recent errors.

            Here is the error that gave me an idea where my goof-up is at, "/core/model/modx/modparser.class.php : 540) Could not find snippet with name UltimateParent"

            When I run the Quickstart buttons and assign it to a widget to be displayed, it comes up as a error 500. Here is how I have it set up



            And with FileUpload, I keep getting a blank section, pictured below. Since taking a screen shot, I've played with the pathing slightly to make sure there wasn't a slash where one wasn't needed, made sure that the path does actually exist (its an empty folder, but still).



            I'm going to tinker around with it a bit more, but thank you everyone who has chirped in [ed. note: brittislove last edited this post 8 years, 5 months ago.]
              • 3749
              • 24,544 Posts
              For FileUpload, try removing the leading slash in the path.

              You did install both FileUpload (and for the QuickStart solution, the UltimateParent extra), right?
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 17301
                • 932 Posts
                Not entirely sure that you're using the quickstart extra correctly.

                You just need to install it and then go to extras -> quick start buttons and then add a new button set and then choose what buttons you want and where they should go or what they should do. ie: take you to the media browser. You can then also assign it to a usergroup so each user group has a different set of buttons personalised to them.
                  ■ email: [email protected] | ■ website: https://alienbuild.uk

                  The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                • discuss.answer
                  • 18373 ☆ A M B ☆
                  • 3,141 Posts
                  Regarding the quickstart buttons error - there is an edge case that can cause it to throw a 500 if your user is not assigned to a user group. That's possible for sudo users without associated user groups. https://github.com/modmore/QuickstartButtons/issues/40

                  Should probably fix that, didn't realise how old that issue is...
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • 54265
                    • 10 Posts
                    Quote from: markh at May 18, 2018, 05:44 AM
                    that's possible for sudo users without associated user groups

                    I checked, and the error was indeed being caused by this issue. I was a sudo user without a role. Once I changed that, this loaded up just fine and I had to play with the widget to get it to work. I'm a jr dev without a lead, so I'm still learning a lot here.

                    I finally have QuickStart Buttons working as intended. Changing the default media source for my new upload button was a little wonky, but I made it work by changing the default media source within the system settings. Thank you Mark, I'm going to update my post
                      • 54265
                      • 10 Posts
                      There was an old error with Quickstart Buttons that I was running into - the account I was using wasn't assigned a role so it caused the 500 error. I got this working in part to you and the other posters on here. Thank you so much