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

    Been a while since I posted on the forums, but got a little stuck.

    At the moment, I have 3 groups Admins, Bloggers, and Blog Publishers of which Bloggers and Blog Publishers have pretty limited access.

    That being said, as an admin I am able to change who created the article. Rather than giving everyone admin access so they are able to change the poster of the article, is there a permission I can set on those users / user groups (bloggers, blog publishers) so they are able to change the created by or the published by etc? Reason being is, anyone out of the 5 bloggers could submit the article, but it could be an article from another person in the company of which we would want their name against the article. And to free up time, I was going to allow managers to approve and publish those articles but they need to be able to change who posted it.

    I hope this all makes sense.

    Thanks for your time.
    Jon
      • 3749
      • 24,544 Posts
      I could be wrong, but I don't think there's a way to grant that permission without giving them capabilities you don't want them to have (like making themselves sudo users).

      One solution might be a front-end form that requires a login and lets them set that value.

      Another (probably better) way to go would be to create a TV called "Author" with radio options or a drop-down list of possible authors, then use a plugin connected to OnDocFormSave to set the createdby field. It's easy to control access to a TV and the Author TV Input Options Value could be:

      Bob==12||Sally==21||Jim==13

      where the numbers are the user IDs of the possible authors. The user will see the names, but the numbers will be the "real" value of their selection. Then in the plugin. something like this (untested):

      <?
      /* Set created by based on Author TV */
      $value = $resource->getTVValue('Author');
      if (! empty($value)) {
          if ($value != $resource->get('createdby') {
              $resource->set('createdby', $value);
              $resource->save();
          }
      }
      
        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
        • 14677
        • 54 Posts
        Thanks Bob, I will have to try the second approach I think... Although this will no doubt mean changing a few templaes now haha.

        Thanks again,
        Jon