Our site serves it's form pages via ssl. I didn't like the unnecessary redirects to https, while the systems knows on forehand it will be redirected (menu links for example). I made a custom module to do this, but it might be nice to put it in securepages itself:
function securepages_link_theme_registry_alter(&$theme_registry) {
if(isset($theme_registry['link'])) {
$theme_registry['link']['function'] = 'securepages_link_link';
}
}
function securepages_link_link($attributes) {
$path = $attributes['path'];
$text = $attributes['text'];
$options = $attributes['options'];
$options += array(
'fragment' => '',
'query' => array(),
'absolute' => FALSE,
'alias' => FALSE,
'prefix' => ''
);
$original_path = $path;
if ($path == '<front>') {
$path = '';
} elseif (!empty($path) && !$options['alias']) {
$language = isset($options['language']) && isset($options['language']->language) ? $options['language']->language : '';
$alias = drupal_get_path_alias($original_path, $language);
if ($alias != $original_path) {
$path = $alias;
}
}
global $is_https, $user;
if (variable_get('securepages_enable', 0)) {
$page_match = securepages_match($original_path);
$role_match = securepages_roles($user);
if ($role_match) {
if (!$is_https) {
global $base_secure_url;
$path = $base_secure_url . '/' . $path;
}
}
if ($page_match && !$is_https) {
global $base_secure_url;
$path = $base_secure_url . '/' . $path;
} elseif ($page_match === 0 && $is_https && variable_get('securepages_switch', FALSE)) {
global $base_insecure_url;
$path = $base_insecure_url . '/' . $path;
}
}
$url = url($path, $options);
return '<a href="' . check_plain($url) . '"' . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $text : check_plain($text)) . '</a>';
}
Comments
Comment #0.0
Shrikey commentedadded php tags
Comment #1
astonvictor commentedI'm closing it because the issue was created a long time ago without any further steps.
if you still need it then raise a new one.
thanks