We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3046
    • 48 Posts
    Hi all!
    It seems, my example isn’t too hard, but i still can’t figure it out, so when it will be cleaned it will be useful.

    The challenge is that users can leave posts without any registration, but leaving their name, post title, and post body.

    for exp, chunk tpl:
    <form name="NewsPublisher" method="post" action="[~[*id*]~]">
        <fieldset>
            <h3>Header</h3>
            <input name="NewsPublisherForm" type="hidden" value="on" />
        	
            <label for="pagetitle">Post title <abbr title="Post title">?</abbr>: <input name="pagetitle" id="pagetitle" type="text" size="40" value="[+pagetitle+]" /></label><br />
            <label for="nick">Your name <abbr title="Your name">?</abbr>: <input name="nick" id="nick" type="text" size="40" value="[+nick+]" /></label><br />
        	
    	</fieldset>
    	
    	<fieldset>
        		<label for="content">[*blogContent*]</label>
    	</fieldset>
    	
    	<fieldset>    	
        	<input name="Send" type="submit" value="Send!" class="button" />
    	</fieldset>	
    </form>
    


    I create an extender for "nick" param, but i am not skilled in php, so i don’t know how to make it work ))

    <?php
    
    $placeholders['nick'] = array("*","displayNick");
    if(!function_exists('displayNick')){
    function displayDetail($resource){
    return($resource['nick']);
    }
    }
    ?>


    it doesn’t work for now, modx writes:
    « Execution of a query to the database failed - Unknown column ’sc.nick’ in ’field list’ »
    SQL: SELECT DISTINCT sc.id,sc.nick,sc.introtext,sc.content,sc.createdby,sc.published,sc.pagetitle,sc.createdon FROM `belkau12_baza1`.`modx_site_content` sc LEFT JOIN `belkau12_baza1`.`modx_document_groups` dg on dg.document = sc.id WHERE (sc.id IN (71,73,74,75,76,77,78,79,80,81,82) AND sc.published=1 AND sc.deleted=0 ) AND (sc.privateweb=0) GROUP BY sc.id ORDER BY sc.createdon DESC


    Thank you for help
      • 18397
      • 3,250 Posts
      Is the nickname saved as a TV?
        • 3046
        • 48 Posts
        it was not saved, but i saved it now as TV
        Just TV named "nick" and nothing inside right?
        but it still doesn’t work

        that is what i want to be displayed:

         <div class="ditto_info" > <strong>[+nick+][+author+]</strong>left his comment on [+date+]. <Br>
          • 3046
          • 48 Posts
          May be somebody just know the place and can share a link, where is guide HOwto add a custom placeholders to Ditto? ))
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            By "nick" do you mean the "username" field from the database? If that is the case you might want to consider the extenders options to get that field. Your extender code would be a variation on the getAuthor() function in the ditto.class.inc.php file. Or if you’re really into OOP, extend the ditto class, call it something like ditto_nick, and override the parent class’s getAuthor() function, then in the snippet use your ditto_nick class.

            It would be much easier to create a TV and put the nickname you want; or use @SELECT binding to get the document author’s username.
              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
              • 3046
              • 48 Posts
              Quote from: sottwell at Jul 31, 2008, 12:11 PM

              By "nick" do you mean the "username" field from the database? If that is the case you might want to consider the extenders options to get that field. Your extender code would be a variation on the getAuthor() function in the ditto.class.inc.php file. Or if you’re really into OOP, extend the ditto class, call it something like ditto_nick, and override the parent class’s getAuthor() function, then in the snippet use your ditto_nick class.

              It would be much easier to create a TV and put the nickname you want; or use @SELECT binding to get the document author’s username.

              by "nick" i mean new field for ditto, so user can put his name under his post without registration. (i’m newbie in constructing under Modx, so don’t know a lot)

              Thanks for @select advice, i’ll try this way
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                How can a user create a post without registering/logging in? Are you talking about Ditto, or Jot?
                  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
                  • 3046
                  • 48 Posts
                  I’m talking about Ditto!
                  There is no problem that any visitor of page can make a post with Ditto without registering, just make "Add a post" page available for all...

                  So i’m just looking for information how to add a Custom Placeholder to Ditto. No matter, if this is "nick" or "something" else.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Ditto does not make posts, it only aggregates and displays lists of summaries and links of existing documents.
                      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
                      • 36592
                      • 970 Posts
                      I think belkaU is going to use NewsPublisher snippet to let visitors post new document.
                      But NewsPublisher can not save TV (=nickname of anonymous poster).