Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem:
The subscriptions ui block is being rendered with an empty form:
<div id="block-subscriptions-ui-0" class="block-subscriptions-ui-0 block block-subscriptions-ui">
<div class="block-content">
<form action="/" method="post" id="subscriptions-ui-node-form" accept-charset="UTF-8"><div><input type="hidden" name="form_build_id" value="form-z7YZtuGZKUpOJiTjqyyqGoYNZua0nq2h75Yszm19hfk">
<input type="hidden" name="form_token" value="91_URLNh5_bLHAbx9z2DBpvAzKbw9C59pY9WdLKAByE">
<input type="hidden" name="form_id" value="subscriptions_ui_node_form">
</div></form> </div>
</div>
Because we use margins and border the block is rendered with a border but empty.
Context:
The problem for example occurs on the frontpage
The user is logged in and has permission to subscribe to some node types and their content
He's not allowed to subscribe to the static node which the frontpage node is type of
Expected behaviour
The block should not render at all.
Comments
Comment #1
AnybodyI please need help for further investigation.
The form bulding function in subscruotions_ui.module correctly returns NULL or array() (depending on the case) but the drupal_get_form() functions always render the form so that the block finally receives the empty form HTML and renders it.
I'm now using the following quickfix to hide the block content if the form array has no "account" key (which would always be present for a proper form) and set the block value to NULL to hide the block entirely:
In custom module:
What we'll need is a solution to tell drupal_get_form() not to render the form if the form function returns an empty array or NULL. Alternatively we could pre-check the result of the form building function not to be NULL to pass the form array to the block. But that would require us to execute subscriptions_ui_node_form() twice?
The problem is between subscriptions_ui_node_form(), drupal_get_form() and subscriptions_ui_block_view() in subscriptions_ui.module.
Comment #2
salvisHave your tried the options under STATIC CONTENT on admin/config/system/subscriptions?
Have you tried not showing the block on those pages where you don't want to see it?
Comment #3
AnybodyYes the affected content type IS marked as static content!
Comment #4
salvisCan you not just not show the block on those pages?
Comment #5
AnybodyWell that is possible but does not change anything about the bug behind.
Comment #6
salvisI'm not sure this really is a Subscriptions bug...
Comment #7
AnybodyWhat ever this is, we should fix it. Where would you suggest to put the issue?
I had no other module with this issue yet.
Comment #8
salvisIt's in the right queue for now.
Help me to understand a bit better: why are you seeing the Subscriptions block at all on the front page? I think it should appear only on node pages. You write that your front page is a node page (which is somewhat unusual), but you've marked the front page content type as static?
So, the bug would be that we get a Subscribe block, even though the list of Subscribe options is empty, for whatever reason? Do we also get a Subscribe form, if we're not using the block?
What exactly is in
$data['content']
that you're NULLing? Was it put there by Subscriptions?Please investigate and post a patch if it can be fixed in the context of Subscriptions.