RemoveLink

edited July 2011 in Feedback
After some frustration attempting to remove certain sidebar menu items from the profile page, I believe I may have discovered a bug in the RemoveLink function of the SideMenuModule.

Before:

public function RemoveLink($Group, $Text) {
if (array_key_exists($Group, $this->Items) && is_array($this->Items[$Group])) {
foreach ($this->Items[$Group] as $Index => $GroupArray) {
if ($this->Items[$Group][$Index]['Text'] == $Text) {
unset($this->Items[$Group][$Index]);
array_merge($this->Items[$Group]);
break;
}
}
}
}
After:

public function RemoveLink($Group, $Text) {
if (array_key_exists($Group, $this->Items) && is_array($this->Items[$Group])) {
foreach ($this->Items[$Group]['Links'] as $Index => $GroupArray) {
if ($this->Items[$Group]['Links'][$Index]['Text'] == $Text) {
unset($this->Items[$Group]['Links'][$Index]);
array_merge($this->Items[$Group]['Links']);
break;
}
}
}
}
I added ['Links'] after each occurrence of $this->Items[$Group]. Perhaps the structure of the SideMenu object was changed at some point and not updated here?

2.0.17.8

Cheers,
Chris
Tagged:

Comments

Sign In or Register to comment.