I am trying to hide a module supplied block (User Relationships action block) from appearing on nodes posted by the logged in user. The block shows as empty on those pages.

I have tried php in the block visibility rule, I have tried the Context module, I have tried a template, to no avail except that with a template the block no longer shows anywhere regardless of the template having code inside it or not.

Otherwise, the visibility rules work if I limit visibility to specific paths.

It also looks like I am having problems hiding other module supplied blocks like the search block.

Interestingly enough, when I enable the Devel Themer module, the action block no longer shows on posts by the logged in user as it should but appears on others (this is the result I am trying to achieve.) Unfortunately, this module has other serious issues and I cannot leave it enabled permanently.

Combined with the fact that I haven't found any other complaint about this situation, this leads me to believe that the UR action block, by design, should not appear on the logged in user's posts and that I should not be facing this problem.

Does this mean I have a broken database somewhere?

Can anyone guide me on the diagnosis and possible repair of this situation --like, maybe, going into the database for a manual fix?

P.S.: In the database, the action block shows a size of NULL and a sort of NULL. Is this normal?

1 Answer 1


Rules block visibility

Have a look at the Rules block visibility module. Here is a quote from its project page:

The Rules block visibility module allows Rules components to be used to control block visibility. This provides Drupal administrators and developers extreme flexibility in controlling when blocks should be displayed on their websites, in addition to the default visibility options provided by Drupal.

The general idea is that if you can do it with Rules, you can use it to control block visibility, so the possibilities are limitless:

  • Need to show a block only for users registered more than a month ago?

  • Perhaps you have a block that must be shown only between 8am-5pm on weekdays?

  • What about displaying or hiding a block based on current weather conditions?

All of this can be done by using Rules block visibility.

With that, and as per the "if you can do it with Rules, you can use it to control block visibility" above, you've reduced your question to making Rules check situations such as "is this a node posted by the logged in user" (so that the block is not to be shown).

For an illustration of how to use this module, refer to my answer to "How to stop a Views block from displaying to admins, such as user/1?".

Advanced debugging options

To futher investigate the "The website encountered an unexpected error, please try again later" (as in your comment to this answer), keep in mind that such errors originate from some PHP exception that occured somewhere. To get more details about such error, check your 'Recent log messages' (within "Reports", located at /admin/reports/dblog), which is available if the Database logging module is enabled.

  • Thank you. Yes, although I did not mention it, I did try the Rules Block Visibility module. As soon as I connect the block to the rule component, I get a "The website encountered an unexpected error, please try again later" message (or something like that.) The only way for me to load a page after that is to upload a database backup. I haven't been able to use the module to hide any block. I guess all of this is interconnected somehow and I wish I knew where to go to fix this (uploading fresh copies of the modules does not help.)
    – user14666
    Apr 24, 2016 at 18:59
  • @user14666 : please review the 2nd part of my answer I added (debugging options). Let me know if that helps ... Apr 25, 2016 at 8:27
  • Yes, thank you. I am looking at the custom block table of the data base and I see an old custom block that has php in it. It displays an Adsense add. I also see that I can no longer move and save blocks into other regions. Deleting this block seems to solve some of the problems experienced with blocks. But there's more. Still working on the issue.
    – user14666
    Apr 30, 2016 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.