By nigels on
I'm trying to control a blocks visability based on a field in a custom profile.
There is an example in the hand book http://drupal.org/node/64330
But it doesn't seem to work.
Has anyone else managed to get this working in v5.1 ?
Here is my code..
<?php
global $user;
if ($user->profile_membertype == Gallery){
return TRUE;
} else {
return FALSE;
}
?>
Comments
I think you're missing some
I think you're missing some quotes around "Gallery"
Display block according to Profile Category Field on Drupal v5.1
Thanks for the help,
But still doesn't work.
Do you think there is some difference with drupal v5.1 ?
Cheers
Has the global $user variable changed in Drupal v5.1 ???
Im having real trouble trying to control block visability according to the content of a Profile Category Field on Drupal v5.1
Anyone any ideas?
or maybe there is another way to do this?
Load profile first
Ok, I don't know how is this was working on 4.7, but testing in 5.1 you have to load profile first so you have:
Of course you should add a check for the availability of profile module like
if (module_exists('profile')) { ... }Display block according to Profile Category Field on Drupal v5.1
It works perfectly with that extra bit!
Thanks a million for your help Tostinni!