By theorichel on
The weblinks module creates a TAB in my user profile that I want to get rid of. I found some code here to be pasted in template.php, but I cannot get it to work. I get error messages ag } or an end not being expected.
This is the code I try to paste:
if($hook == 'user') {
klimathema_removetab('Web Links', $vars);
// add additional lines here to remove other tabs
}
return $vars;
}
function klimathema_removetab($label, &$vars) {
$tabs = explode("\n", $vars['tabs']);
$vars['tabs'] = '';
foreach($tabs as $tab) {
if(strpos($tab, '>' . $label . '<') === FALSE) {
$vars['tabs'] .= $tab . "\n";
}
and I paste this at location XXX in the following piece of my template.php
function _phptemplate_variables($hook, $vars) {
if ($vars['node']->relatedcontent) {
$vars['template_file'] = "newsletter-teaser";
}
return $vars;
}
XXX
?>
Of course I do something wrong, but what?
Many thanks,
Theo Richel
Comments
I of course mean that I am an amateur!
I of course mean that I am an amateur!
try this: if($hook ==
try this:
It looked like you were missing some closing curry brackets "}" at the end there. Once a curry bracket is openned you have to make sure it is closed again, or else the system thinks there is more instruction coming.
getting closer...
Are you sure you wanted to paste that code exactly where you did?
it looks to me like this:
is supposed to replace the last part of this:
...creating the final version of the code, looking like this:
...course, I don't know exactly what you're trying to do, but at least I think you'd have something that is syntactically correct.
Thanks Nokes
That did it/. There was still an error left (my error) 'user' should be 'page' but it is working now. Thanks!