We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 813 ☆ A M B ☆
    • 326 Posts
    I am looking for a way to allow web users to be able to post the equivalent of a blog entry, and attach/upload an image to that entry for others to see. Other users need to be able to comment on the post.

    I thought the best method for accomplishing this would be to use NewsPublisher/Ditto with Jot for comments (similar to the "Basic Blog" instructions on the MODx Wiki, found at http://wiki.modxcms.com/index.php/Basic_Blog), but it can’t do the file uploading out of the box. There’s a method for fixing this found here (http://modxcms.com/forums/index.php/topic,6404.0.html), but this method uses a snippet (Docmanager) that’s built for Revolution, and I’m still using .0.9.6.3.

    Is there another method (using NewsPublisher or another snippet that I’m unaware of) for doing this? And if the method above is the only viable option, can this be set up to work in Evolution and not just Revolution?

    Thanks!

      • 26931
      • 2,314 Posts
      ...just a quick thought, i use none of them & don’t know about how they handle webusers

      Front End Document Manager:
      http://modxcms.com/forums/index.php/topic,14977.0.html

      Quick Manager:
      http://modxcms.com/forums/index.php/topic,33530.0.html

      hope i could help a bit, j
        • 813 ☆ A M B ☆
        • 326 Posts
        Thanks for the ideas! Unfortunately, I’m not sure if they’re exactly what I’m looking for. I’ve experimented with FDM, but it seems to have the same issues with front-end file uploading as NewsPublisher. And correct me if I’m wrong, but Quick Manager basically gives access to back-end functionality from the front end, similar to QuickEdit. But what I really need is a simple front-end form that will upload an image along with the blog post. NewsPublisher is exactly what I need, except it doesn’t work well with uploads.

        My other thought is that I continue to use NewsPublisher and somehow integrate FileUpload or FancyUpload to handle the image upload process. This actually does work, but since this just dumps the image into a folder on the server with other images, I don’t know how to make it display the correct image with the correct blog page. Does this make sense?

        My hope is that someone out there has done something similar and can enlighten me. It seems like there should be a simple solution, but I can’t find one anywhere.
          • 813 ☆ A M B ☆
          • 326 Posts
          I should clarify that this system will be behind a password-protected area, but anyone who has this password will be able to post. This is the main reason why anything that looks or feels like the back end won’t work -- I can’t train everyone, and it needs to appear to be part of the front end of the site.
            • 7231
            • 4,205 Posts
            In the manager you can select to have the resource manager available to web users. This is in the manager under Configuration in the interface & features tab and is labeled ’Web Users?’
              [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]
              • 813 ☆ A M B ☆
              • 326 Posts
              Thanks -- I see where I can open the resource manager to web users, but I’m still a little confused. How do I tie into this from the NewsPublisher form? If I simply add a "file" input, it will add the file name, but it doesn’t actually do the uploading to the resource manager.
                • 29774
                • 386 Posts

                I am looking for a way to allow web users to be able to post the equivalent of a blog entry, and attach/upload an image to that entry for others to see. Other users need to be able to comment on the post.

                The best way to do this would be with a database table to hold the blog entries, image link and a reference to the webuser id as a foreign key. You would need to write a snippet to validate the blog post form, populate the table with the post data and upload the image. The eform2db method would be an easy way to do this, and take a look at the CreateUserImage() method in webloginpe.class.php to see how the image upload can be done safely (if that looks too tricky to you you could just store the image as blob data in the table). To retrieve the posts you can write custom snippets to query the database and list out the blog posts for all users or for a single user.

                For comments another db table could be used with the blog post id and webuser id as foreign keys. then you can do a join on the two tables to list out comments for a given post.

                  Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                  • 813 ☆ A M B ☆
                  • 326 Posts
                  That’s the most thorough answer I’ve gotten so far, and it’s exactly what I’m trying to accomplish. The problem is, I’m not sure I’m strong enough in PHP or MySQL to pull this off on my own. If anyone is feeling incredibly generous, I could really use the help. Otherwise, I’ll try to fight through it on my own, and I’ll post my results to the forums if/when I get it working.
                    • 4385
                    • 372 Posts
                    Did you ever find a solution? I am in need of something similar. If the fileupload snippets work can you force the name to be the same as the blog post? Document id 58 and image 58_photo.jpg? Then use [+id+]_photo.jpg to reference the photo.
                      DropboxUploader -- Upload files to a Dropbox account.
                      DIG -- Dynamic Image Generator
                      gus -- Google URL Shortener
                      makeQR -- Uses google chart api to make QR codes.
                      MODxTweeter -- Update your twitter status on publish.
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      That should certainly be doable; if the image is being uploaded by a form field on the blog document, then the move_uploaded_file function would just use $modx->documentIdentifier as part of the filename. Setting the $uploadfile value could also include some fancy parsing of the tmp_name to get the file type; it’s not safe to depend on the $_FILE[’type’] mime-type of the uploaded file.
                      $type = substr(strrchr($_FILES['userfile']['tmp_name'], "."), 1);
                      $uploadfile = $modx->documentIdentifier . "_photo." . $type;
                      move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)

                        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