RemoveLink
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:
2.0.17.8
Cheers,
Chris
Before:
After:
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;
}
}
}
}
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?
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;
}
}
}
}
2.0.17.8
Cheers,
Chris
Tagged:
0
Answers
https://github.com/vanillaforums/Garden/issues