v6 code into v5
amelfe - September 28, 2009 - 16:50
| Project: | Troll |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
While testing the drupal 5 version of this module, I found some problems (forgotten while backporting I think). Here are some corrections (sorry, for not submitting a patch) :
Line 124
<?php
$roles = user_roles();
array_unshift($roles, t(' -Select Role- '));
?>should be (the indexes are messed up if not) :
<?php
$roles = array(t(' -Select Role- ')) + user_roles();
?>Line 240
<?php
'access' => array('administer troll'),
?>should be :
<?php
'access' => user_access('administer troll'),
?>Line 545
<?php
function troll_blacklist_import_url($edit) {
$url_parts = parse_url($edit['custom_list']);
$file_parts = pathinfo($url_parts['path']);
troll_blacklist_parse_save($edit['custom_list'], $file_parts['extension']);
}
?>should be :
<?php
function troll_blacklist_import_url($edit) {
$url_parts = parse_url($edit);
$file_parts = pathinfo($url_parts['path']);
troll_blacklist_parse_save($edit, $file_parts['extension']);
}
?>To be added (the block user form isn't defined at all):
<?php
/**
* Menu callback: block a user and redirect to search page.
*
* @param $uid
*/
function troll_confirm_block_user_form($uid) {
$account = user_load(array('uid' => $uid));
if (!$account) {
drupal_goto('admin/user/troll');
}
$form['uid'] = array(
'#type' => 'value',
'#value' => $uid,
);
$form['#redirect'] = 'admin/user/troll';
return confirm_form($form, t('Block user %username?', array('%username' => $account->name)), 'admin/user/troll', t('Are you sure you want to block this user?'));
}
function troll_confirm_block_user_form_submit($form_id, $form_values /*$form, &$form_state*/) {
troll_block_user($form_values['uid']);
}
?>
#1
committed
#2
Automatically closed -- issue fixed for 2 weeks with no activity.