We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38226
    • 18 Posts
    I am adding a blog to a site I created in v1.0.0
    I would like to set be able to add authors names, image and bio to each blog post. I figured I could set up an "Author" parent container within the "Bog" container.

    I'm struggling trying to figure out what the best snippet is to call in this related resource. Both the snippets below look promising. Does anyone have any experience setting this type of thing up?


    getRelated http://modx.com/extras/package/getrelated

    Related http://modx.com/extras/package/related


    Appreciate any insights!
    Jules

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You should be able to do this using existing Users fields. How to go about it depends on how you're creating the blog posts. Are these posts made by a lot of different users? Are these Manager users, or Web users?
        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
        • 38226
        • 18 Posts
        My plan wasn't to bring in the author from the member base, but rather set up a new... not sure what MODx terminology to use here.... If the blog was a channel of entries then the Authors would also be a channel of it's own entries.

        The Title would be Author Name
        Content would be Author Bio
        Add custom TV for Image to be Author profile img

        For the Blog Post Template:
        A template variable would be created that associated with the "blog post template" as a drop down menu that would automatically be populated with the "Title" from the Authors Channel. An author would then be selected from the list for each post

        Within the the template code you would then be able to call both the content from the blog post and also the associated author and their related content.

        Does that make sense?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Sort of, I suppose, but the author information is already automatically available from the creation of the blog post. When a resource (in this case a blog post) is created, the ID of the creator is automatically stored as part of the database record for that resource. A resource can only be created by a logged-in user, so you have to have a database full of authors to begin with. User fields include a "comments" field which would be fine for your Bio, and it also has a feature for uploading/selecting a photo for the user. Why re-create the wheel when it's already there for you to use?

            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
            • 38226
            • 18 Posts
            RE: A resource can only be created by a logged-in user, so you have to have a database full of authors to begin with.

            Guest writers won't be logging in to write posts themselves. They will submit article and it will be input by the business owner.

            RE: User fields include a "comments" field which would be fine for your Bio
            The members of the site are his clients and the comment field is already being used for another purpose.

            Have you worked with the related addon before? There explanation is similar to what I'm thinking of.



              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Ah, I see. Indeed, you do have a different scenario. You should be able to use something like "related" then, with a dropdown or radio button TV populated from the available authors to choose from when inserting the blog article.
                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
                • 38226
                • 18 Posts
                Hi Susan

                Can you help me out?

                I was installing Related 1.0.3-rc and the instructions state:

                Copy related.php to your Snippets directory. Create a new snippet in the manager called 'Related' and enter this code:


                But there is no code to copy and paste.

                Thanks!
                Jules