Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
You should only be able to add a candidate to a post if you can edit that post. Previously you were able to add candidates if you could create elections. Also clarified other candidate access checks.
The 'bypass running election lock' permission used to allow update to an election post, without checking update access to the election.
This module extends Drupal's block visibility settings, for ease of configuration and deployment.
Features
Allows PHP block visibility to be defined in code.
Allows theme specific block visibility code.
Removes reliance on core php module and eval() for defining block visibility.
Usage
Edit a block.
Pick one or more of the applicable callback functions from the list provided.
Implement the functions as follows:
/**
* Block visibility callback for the search form block.
*
* @param object $block
* The block object.
*
* @return bool
* TRUE if the block should be displayed on the current page.
*/
function _search_form_block_visibility($block) {
if ($block->theme == 'my_theme') {
return !drupal_is_front_page();
}
return arg(0) == 'node' && is_numeric(arg(1));
}
Note that if multiple callbacks have been implemented for a block, the most specific match will always be used.
Possible extensions
Allow users to specify their own function names for each block.
Create a hook which can be implemented by one or more modules to determine block visibility (similar to hook_file_download()).