Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Forum Module /

Discuss the Forum Module.

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

Membernames with ampersand throw exeption


Reply


3 Posts   1039 Views

Avatar
baba-papa

Community Member, 279 Posts

15 September 2009 at 9:11pm

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?

Avatar
banal

Community Member, 901 Posts

15 September 2009 at 11:28pm

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)

Avatar
baba-papa

Community Member, 279 Posts

16 September 2009 at 3:38am

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.