We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36493
    • 64 Posts
    I’m using the [[!profile]] snippet to display user profiles.

    Part of the information is a bio which typically would contain a few paragraphs.

    Using the :nl2br filter would be sufficient. But adding this filter on the placeholder outputs nothing ""

    example call:
    [[!Profile?
    &user=`[[getReqParam? name=`editorid`]]`
    &useExtended=`1`
    &prefix=`up.`
    ]]
      <h2>[[+up.fullname]]</h2>
      	<dl>
      		<dt>Organisation</dt>
      		<dd>[[+up.organisation]]</dd>
      		<dt>Bio</dt>
      		<dd>[[+up.bio:nl2br]]</dd>
      	</dl>
      </div>
    



    I have also tried :ellipsis and :replace which both result in nothing but :limit works??

    The other approach is to store html in the extended field but tags get striped out?

    Any suggestions?

    Revolution 2.0.4-pl2
    Login 1.3.2-rc1 (I think, package managent only seems to show the version downloaded - even when it’s not installed - so it should be the version previous to 1.3.2-rc2 )

    Many Thanks,
      |
      • 3749
      • 24,544 Posts
      How about using HTML and passing it through htmlentities() before storing it in the extended field?
        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
        • 36493
        • 64 Posts
        ok been playing around - I was wrong that extended field can’t take html - if you use the manager to enter html it will preserve the tags.

        but if you use the Login.UpdateProfile snippet and form to update the fields it will strip the html tags.

        I’m going to have a look at the updateProfile snippet to see if i can get it to play nice.

        I also suspect that the profile snippet won’t handle a html_entity_decode() filter so I wouldn’t be able to display the html properly if I was to go with htmlentities().
          |
          • 28215
          • 4,149 Posts
          Try [[!+up.bio:nl2br]] and see if that works.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 36493
            • 64 Posts
            Yes grin grin haha

            That non-cacheable flag did the trick!


            Many thanks - splittingred

            Also thank you for adding the caching parse order section to the docs - definitely good to know why something like this happens smiley
            http://rtfm.modx.com/display/revolution20/Tag+Syntax
              |
              • 42146
              • 73 Posts
              &user=`[[getReqParam? name=`editorid`]]` are you passing the user profile id via url? i'm trying to get that working... but when trying it didn't work for me. always displayed profile for userid 5....

              can you share your updateprofile form section for the bio tag? i need to do the same thing... would like to know exactly how you got it working.

              Thanks [ed. note: jstump last edited this post 13 years, 9 months ago.]