We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9496
    • 113 Posts
    So I am throwing around news publisher, not sure if its deprecated or not but I wanted it for a simple question post & answer. A DIY forum so to speak. I got it working to a certain degree between Ditto, NP & Jot, the only problem I am having is that the NewsPublisher form doesnt seem to be adding a a created by name, although it does ad the ID, weird...

    SO when I look in the doc manager, it creates the appropriate document, but in the created by field it simply has empty parens. Like this

    Created:  	01-04-2009 17:40:02 ()


    Now if I log out of the fron end and log in through the front end as a site admin I get this

    Created: 01-04-2009 17:40:02 (siteadmin)

    I’ve set up a web user group called subscriber, created the permissions group to be able to access the document group and did the whole role set up. Which gets kind of confusing but I think I have all three set up (siteadmin is actually in the same group as the one that doesnt work)

    Its looking like its setting everything document & content wise. It may be a permissions thing but frankly that confuses me as well.

    Any ideas as to what I should be setting my roles to (I pretty much granted eveyrthing and it still doesnt work. hmmm. thanks in advance.
      • 17422
      • 225 Posts
      Hi,

      i have the same problem,

      have you succeed to resolve this problem ?

      Laurent
        • 3749
        • 24,544 Posts
        The site_content table, which contains the document’s content fields, doesn’t hold the name of the user, just the user’s ID. There’s no creator’s name field to store it in.

        It’s easy to get the username from the user table with a snippet that gets the createdby id as a parameter, however.
          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
          • 14089
          • 56 Posts
          i apologize, but could you give an example or a link to an example of how to accomplish this?
            for all things independent, check out http://www.indieophile.com
            • 4310
            • 2,310 Posts
            Here’s a snippet I think someone else posted, or I modified a while ago.
            <?php
            $output = '';
            $docnum = $modx->documentIdentifier;
            $val= $modx->db->getValue('SELECT `createdby` FROM `modx_site_content` WHERE `id` = '.$docnum.'');
            if ($val >= 0){
            $rs= $modx->db->getValue('SELECT `name` FROM `modx_user_roles` WHERE `id` = '.$val.'');
            }
            else {
            $val = abs($val);
            $rs= $modx->db->getValue('SELECT `fullname` FROM `modx_web_user_attributes` WHERE `internalKey` = '.$val.'');
            }
            $output .= ''.$rs.'';
            return $output;
            ?>

            It should output the Web Users Fullname or the Managers Role, depending on who created the document.
              • 14089
              • 56 Posts
              ok, i’m sorry. i really can’t figure this out. i have created a web user group for bloggers. i am using newspublisher to publish documents and have it set up so a manager user can look at the post before it is published. that part works great. the only problem is that the created by shows up like this

              Created:  	22-06-2009 16:19:59 ()


              is there not a way to make this show as the web user who created the document? i don’t really understand what to do with the above snippet.
                for all things independent, check out http://www.indieophile.com
                • 4310
                • 2,310 Posts
                Name the snippet CreatedBy and add [!CreatedBy!] wherever you want to output the created by name on your page. smiley
                  • 14089
                  • 56 Posts
                  oooooooooooooo. duh. forgive the stupidity. haha. thanks! grin
                    for all things independent, check out http://www.indieophile.com
                    • 7455
                    • 2,204 Posts
                    but than still you have a problem

                    newspublisher is used by WEBusers not MANAGERusers
                    in the manager the created by is always a MANAGER user
                    so if the WEBuser id is stored in the db the manager wil look for a MANAGER user that has the same ID in some cases like ID1 it wil be admin or any other MANAGERuser that has the same ID as the WEBuser.

                    what I did was putting the webusers ID in the table wit a - infrond of it to make a clear distinction so webuser with ID10 wil be enter in the content Table as -10

                    Dimmy
                      follow me on twitter: @dimmy01