In _asset_page_match(), it is assumed that when the textbox in "Show on only the listed pages" is empty, user wants to show 'Insert asset' in every textarea, however, when I want to show asset on only listed pages with empty list, that means I DON'T want to show it anywhere (for example when I just want to use CCK asset field).
function _asset_page_match() {
$page_match = FALSE;
if (!user_access('create assets') && !user_access('administer assets')) return $page_match;
$access_option = variable_get('asset_access_option', 1);
$access_pages = variable_get('asset_access_pages', "node/add/*\nnode/*/edit");
if ($access_pages) {
// If the PHP option wasn't selected
if ($access_option < 2) {
$path = drupal_get_path_alias($_GET['q']);
$regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($access_pages, '/')) .')$/';
$page_match = !($access_option xor preg_match($regexp, $path));
}
else {
$page_match = drupal_eval($access_pages);
}
}
// No pages were specified to block so show on all
else {
$page_match = TRUE; //HERE, WE ALWAYS SHOW LINKS EVERYWHERE
}
return $page_match;
}
should change to
function _asset_page_match() {
$page_match = FALSE;
if (!user_access('create assets') && !user_access('administer assets')) return $page_match;
$access_option = variable_get('asset_access_option', 1);
$access_pages = variable_get('asset_access_pages', "node/add/*\nnode/*/edit");
if ($access_pages) {
// If the PHP option wasn't selected
if ($access_option < 2) {
$path = drupal_get_path_alias($_GET['q']);
$regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($access_pages, '/')) .')$/';
$page_match = !($access_option xor preg_match($regexp, $path));
}
else {
$page_match = drupal_eval($access_pages);
}
}
// No pages were specified to block so show on all
else {
if ($access_option == 0) { //FIX: ONE EXTRA IF
$page_match = TRUE;
} elseif ($access_option == 1) {
$page_match = FALSE;
}
}
return $page_match;
}
Comments
Comment #1
wmostrey commentedThis has been fixed in http://drupal.org/cvs?commit=145875, thanks!
Comment #2
keff commentedThank you!
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.