By Truff on
I'm trying to set the visibility of a block depending on a profile field (I'm using using the core Profiles module). I found http://drupal.org/node/64330 but I can't work out how to show the block when a particular profile field is empty (it's not a mandatory field so it will be deliberately blank in some cases). It's probably very simple, thanks for any help.
Comments
Possibility
Let me start by saying that i'm not sure that this is a great solution, but here is something you can try. The code you were looking at in the link to your post was for drupal 4.7 and apparently that doesn't work in Drupal 6. I couldn't find any equivalent method so I did a direct DB query to get the profile fields. Mine looked like the following but you will need to edit these based on the name of your profile fields and which field you want to test for.
So you might have to make some small changes to this to get it to work. First of all you need to change the if statement checking the name of the profile field to whichever field in your profile that you want to test. Put this code in the "Page specific visibility settings" section with the "Show if the following PHP code returns TRUE" option selected. Good luck!
Working solution
Hi and thanks for your suggested code. Unfortunately couldn't get this to work, but after further searching I managed to change the first part and got the following to work nicely: