Jump to:

1016 Posts in 567 Topics by 309 members

Forum Module

SilverStripe Forums » Forum Module » Membernames with ampersand throw exeption

Discuss the Forum Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 932 Views
  • baba-papa
    Avatar
    Community Member
    279 Posts

    Membernames with ampersand throw exeption Link to this post

    Hi,

    I have one member in my Forum that has an "&" in his membername (Riley & Tood). If I try to view his profile in the frontend I get an errormessage:

    <a href="/foren/">Foren</a> &raquo; Riley & Tood's Benutzerprofil
    -------------------------------------------^

    Is this a known bug?

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Membernames with ampersand throw exeption Link to this post

    It's not a bug. It's just incorrectly escaped characters. In XML (and therefore also XHTML), & must be escaped to &amp;
    What you could try is to ouput $Fieldname.XML in your template (instead of just $Fieldname)

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: Membernames with ampersand throw exeption Link to this post

    Hello Banal,

    thanks for your help. After adding nickname.XML I found out that the problem came from the breadcrumbs. The breadcrumbs show the username when you view the user´s profile. I added an htmlentities() to ForumMemberProfile.php:

       public function Breadcrumbs() {
          $nonPageParts = array();
          $parts = array();

          $forumHolder = $this->ForumHolder();
          $member = $this->Member();
          
          $parts[] = "<a href=\"{$forumHolder->Link()}\">{$forumHolder->Title}</a>";
          $nonPageParts[] = htmlentities($this->Title);
    ...

    I did some frontend testing and didn´t find any bug caused by that change.

    932 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.