We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6180
    • 31 Posts
    My apology for editing the original post, however as there have yet been no responses I’m not too worried.

    I have begun to look into blogging at my personal website (my sandbox for learning how to do things that I need to do at work). For the purposes of this exercise, I am trying to implement a system whereby multiple users can post to their individual Blog directory through a single form. Over the course of setting this up I have come to struggle with two different things. The first is how to have one form which will post to the individuals specified directory, and the second is the error I get when I do post.

    My solution for the first has been to create a small snippet that reads out the persons "login_home" page, or failing that posts to the root of the blog directory. I’ve got it reading the user settings, but for some reason it fails to fail over to the root. Instead of posting to the root of the blog directory, the entry is placed at the top level of the site! Structurally I have kept the blog directory as created with the sample data. As such, the directory structure is as follows:
    mod
    Blog dir
    Entry form
    User 1 dir
    post
    User 2 dir
    post

    The Entry form calls NewsPublisher uncached thus:
    [!NewsPublisher?
      &folder=`[!MyBlogHome!]`
      &canpost=`Blog Admins`
      &formtpl=`blogForm`
      &footertpl=`FormBlogComments`
      &makefolder=`1`
      &rtcontent=`tvblogContent`!]
    


    Here is the text of the ’MyBlogHome’ snippet I use to feed the folder variable in the NewsPublisher call:
    $id = $modx->documentIdentifier;
    $pid = $modx->getParent($id,1,'id');
    return isset($modx->config['login_home'])? ($modx->config['login_home']):$pid;
    


    As best as I can tell, the $pid variable is not being set. Any help on this would be very appreciated.

    On the second issue... I get an error every time I post with the form - even if I hardcode the folder. The document is created, but it cannot be viewed from the front end. Strangely, the document does render when previewed with the Manager! Once I open and save the document in the Manager (no editing involved) the page becomes available for viewing in the front end. Here is the error that is returned:
    Fatal error: Call to undefined function: mergeadded() in 
    /mod/manager/includes/document.parser.class.inc.php(724) : eval()'d code on line 31
    


    What the heck do I do with this?

    Web Server:
    * PHP version 4.3.11
    * MySQL version 4.0.27
    * Apache/1.3.33
    * Shared Linux host server (godaddy)

    Browser/Client:
    * Browser: Firefox2
    * OS: WinXP

    MODx:
    * Version 0.9.5
    * Additional snippets used on the page:
    MaxiGallery Solo, WayFinder (twice), BreadCrumbs

    Website:
    * http://mod.ravenwolf.org
      • 21841
      • 36 Posts
      Hi,

      Sorry, not a reply just a re-inforcement ....

      I have a similar but possibly unrelated problem.

      As a rank nooob, I am still playing with the default content as supplied in the download of 0.9.5.

      When creating a blog post using NewsPublisher (as provided) I get no error message but I get the same symptoms as described above. The post will not show in the front end until any post has been edited and saved in the manager in the Blog container huh . Que !

      It is the same with IE7 and FireFox 1.5.0.9

      je ne comprends pas !

      Modx 0.9.5 running on SMEserver 7.1

      Any help gratefully accepted.

      I would be happy for you to access my test server to look at the problem should you wish, just PM.

      I know that on the whole you moderators only hear when things are not right - but this is a GREAT product grin, and I thank you one and all - anything that I can do, just let me know bearing in mind that I am not a rabid techie.

      best regards,

      NWJ
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: CwnAnnwn at Jan 29, 2007, 11:32 PM

        As best as I can tell, the $pid variable is not being set. Any help on this would be very appreciated.
        You can’t nest tags of the same type in MODx... i.e. [!Snippet? &param=`[!AnotherSnippet!]`!] will not work. You can call the outer snippet non-cached and the inner one cached though to work around this issue until true nested tag support is available in the next major MODx release (0.9.7); e.g. [!Snippet? &param=`[[AnotherSnippet]]`!]

        Quote from: CwnAnnwn at Jan 29, 2007, 11:32 PM

        On the second issue... I get an error every time I post with the form - even if I hardcode the folder. The document is created, but it cannot be viewed from the front end. Strangely, the document does render when previewed with the Manager! Once I open and save the document in the Manager (no editing involved) the page becomes available for viewing in the front end. Here is the error that is returned:
        Fatal error: Call to undefined function: mergeadded() in 
        /mod/manager/includes/document.parser.class.inc.php(724) : eval()'d code on line 31
        

        What snippet or plugin are you running that includes a function called mergeadded() or a call to it?
          • 22303 MODX Staff
          • 10,725 Posts
          Now, to see why posts don’t show up until you edit them in the manager, please see the last parameter described here: http://modxcms.com/blog-publish.html
            • 6180
            • 31 Posts
            You have hit on the question I have no answer for! I have been searching through the code trying to find that function. As of yet I have been unsuccessful in locating this particular function... to my tremendous chagrin!

            With the clearcache parameter set I do successfully post, and the entry can be browsed, but I have a similar issue to nowhinjing - that is the page returned is the in the form:
            (siteURL)/(pageid).html

            I am using the FURL feature with the alias paths. As such, the page returns "cannot be found".
            Bad Path:
            http://mod.ravenwolf.org/126.html
            Good Path:
            http://mod.ravenwolf.org/blog/Matt/article-1170549949.html or
            http://mod.ravenwolf.org/blog/Matt/126.html

            It is in the improper path to the post that the "mergeadded()" error is resulting.

            I have found that I can force the page to render back up to my default home page, using my snippet in the &postid parameter. Unfortunately that means the page will not be returned to the user immediately on post.
            [!NewsPublisher?
             &folder=`[!MyBlogHome!]`
             &postid=`[!MyBlogHome!]`
             &canpost=`Blog Admins`
             &formtpl=`blogForm`
             &footertpl=`FormBlogComments`
             &makefolder=`1`
             &rtcontent=`tvblogContent`
             &clearcache=`1`!]
            


            I know the snippet call flies in the face of what you indicated, but I have to say that the embedded uncached snippet in an uncached snippet simply is working! Well, at least it returns my default page... I haven’t sorted out the $pid call yet.
              • 6180
              • 31 Posts
              Deduction, the mergeadded error has something to do with the 404 error page not being generated. Not sure what is causing the failure, as the page exists (the site does have some of the sample pages left as is), and the site is configured to use the page for errors.
                • 21841
                • 36 Posts
                Thank-you OpenGeek, including &clearcache seems to have fixed my problem kiss.

                And so on to the next stage .....

                best regards to all


                NWJ
                  • 6180
                  • 31 Posts
                  Well, having determined that the problem with the error message is the submission form returning the page in a manner that doesn’t resolve properly at my site, I think I can settle for the moment on returning to the posting directory. That said, I have found what was wrong with my snippet (the embedded snippet for picking up the users default page, or the id of the containing page of the post form). Examining the UltimateParent snippet for some guidance (thank you’s to sottwell!) I found my reference to the $pid array in the id return was the problem. I have corrected my little guy as follows:
                  $id = $modx->documentIdentifier;
                  $pid = $modx->getParent($id,1,'id');
                  return isset($modx->config['login_home'])? ($modx->config['login_home']):$pid['id'];


                  In my call to NewsPublisher, as indicated in an earlier post, the containing folder and return page are set to the users "login home page", or if that is not set the parent directory in which the "add-a-blog-entry" form is stored.

                  I think I’ll work this up a bit more to allow the id to be set during the call to the snippet, and see if it is possible to add a field to the user properties which could contain the value so it can be different from the users home page.

                  Thank you OpenGeek for your direction. You got me going on the right path with the clearcache parameter... even if the embedded snippet isn’t supposed to be functioning at this time. smiley

                  Now on to the issue of the dead 404 error page!
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: CwnAnnwn at Feb 04, 2007, 04:30 PM

                    Thank you OpenGeek for your direction. You got me going on the right path with the clearcache parameter... even if the embedded snippet isn’t supposed to be functioning at this time. smiley

                    Now on to the issue of the dead 404 error page!
                    No problem...btw, if I recall correctly, mergeadded was a function from the built-in stats that were part of MODx, pre-0.9.5. Make sure you delete the snippet called GetStats and any references to it in your content/templates if you have upgraded from a pre-0.9.5 release.
                      • 6180
                      • 31 Posts
                      Found it. The mergeadded() call was contained in an old plugin for Tiny But Small (TBS4Modx). Found the code and removed the plugin. Now no more odd error code instead of the 404 page!

                      I got tired of browsing through each resource, so I ran a little query directly against the tables in the database. Finally found it in the plugin table.
                      SELECT * FROM `<Table Name>` WHERE INSTR(`<Content Field>`,’mergeadded’)>0;

                      Guess I took a look at the plugin, then decided against it. The file system directories for it never made it into the installation of 0.9.5. Oh well, details details!

                      Thanks for the clue in to snortin’ through the resources. I do appreciate your help.