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.
I was examining the code for cck_signup_node_view_alter, and it looks to me like the code which unsets the link will never be reached.
Currently this function appears as follows:
elseif (isset($links[$nodereference_url_link]) && cck_signup_event_is_past($node)) {
dpm($links,'links');
// Check if event is in the past, remove link if that is the case.
unset($links[$nodereference_url_link]);
}
but the variable $links is never set previously in the method, rather $build['links']['nodereference_url'] is used.
Instead shouldn't this line of code be something along the lines of isset($build['links']['nodereference_url']['#links'][$nodereference_url])?
I also went to look at an older event & saw that the unset line was never reached...
Comments
Comment #1
zabelc CreditAttribution: zabelc commentedI reworked the whole if statement so it's a little bit clearer (at least to me) in breaking up the various conditions under which the link is removed or modified. I also noticed that capacity wasn't handled, so I added logic to remove the link if the capacity has been reached.
Comment #2
jhedstromLooks like you forgot to attach the patch :)
Comment #3
zabelc CreditAttribution: zabelc commented@jhedstrom, sorry for the half-post. For some truly bizarre reason d.o was truncating my comment (likely at some unseen special character).
Comment #4
zabelc CreditAttribution: zabelc commentedI discovered a bug in the above: if there is no remaining capacity set (i.e. the field is there but empty) then the above interprets that as meaning that the event is closed. Thus the relevant line above should be replaced with:
Giving the full patch: