Project:User Suspend
Version:5.x-1.2
Component:Code
Category:support request
Priority:critical
Assigned:John Money
Status:active

Issue Summary

I have got a question about this modul. When this modul will appear on Drupal 6 version ?

Comments

#1

Category:feature request» support request

#2

Component:Miscellaneous» Code
Assigned to:Anonymous» John Money

Likely in next few weeks. I have 2 other modules to work on (Private Number, Timer), and then this one. :)

#3

Subscribing

#4

Any updates please? I'm in need of the User Suspend version 6 module very badly!

#5

Priority:normal» critical

Subscribing...

#6

+1

#7

Working on it next week. FT employer wants all the contrib modules we did for 5 converted to 6, so... there you go. :)

#8

Also could there be a feature which allows users to suspend their account on their own and take it back live whenever needed? Or is there any module which supports this feature for D6?

Would greatly appreciate if such a feature is implemented :)

Thanks,
Joel

#9

good news, John Money

#10

Any updates please?

#11

I'm working on a D6 port... I hope to post up something within the week.

#12

cdoyle, it would be great

#13

I'm really sorry about the slow response, I forgot about posting back here. I'm not sure what the best way to do this is so I'll try adding a tarball for my D6 code. Also, I'm going to post up some code that I threw in a site specific module that allows suspending users from a comment link or their edit user page. Some of the site admins I work with use this module to get rid of spam commenters and it's a big help being able to do it right from the comment. I think it would be a great feature to roll into the module and would be happy to help with that.

This is D6 code but I also have D5 code to accomplish the same thing. Feel free to contact me through my d.o profile if you want me to post it. Both this code and the D6 version could probably use a bunch of testing but feel free to try it out. I haven't used some of the features much (like the email on suspend) but I suspect they should still work.

/**
* Implementation of hook_menu().
*
*/
function mysite_only_menu() {
  $items = array ();

  // this part allows the user to be suspended when a link on their comment is selected
  $items['admin/user/suspend/%'] = array(
    'title' =>  'AJAX user suspend',
    'page callback' => 'mysite_only_suspend_dispatch',
    'page arguments' => array(3),
    'type' => MENU_CALLBACK,
    'access arguments' => array('administer users'),
  );

  return $items;
}

// this will remove the user if the checkbox on the user page is selected
function mysite_only_user($op, &$edit, &$account, $category = NULL) {

  switch ($op) {
    case 'update':
      if (module_exists('user_suspend') && $edit['user_suspend']) {
        // user to be suspended
        module_invoke('user_suspend', 'operations_suspend', (array($account->uid)));
      }
  }
}

function mysite_only_form_alter(&$form, &$form_state, $form_id) {

  switch ($form_id) {

  case 'user_profile_form':
    // add suspend user functionality to user edit page
    if (module_exists('user_suspend') && user_access('administer users')) {
      $form['account']['user_suspend_title'] = array(
        '#value' => '<div class="form-item"><label>' . t('Discipline') . '</label></div>',
      );
      $form['account']['user_suspend'] = array(
        '#type' => 'checkbox',
        '#title' => t('Suspend user'),
        '#default_value' => 0,
        '#description' => t('Indefinitely suspend this user.'),
      );
    }

    break;
}

/**
* Implementation of hook_link
* @return array links
*/
function mysite_only_link($type, $object = NULL, $teaser = FALSE) {
  $links = array();
  if ($object->uid == 0) { return $links; }   // unverified user/no account

  if (user_access('administer users') && $type == 'comment') {

    $links['user_suspend'] = array(
      'title' => t('Suspend user'),
      'href' => "admin/user/suspend/{$object->uid}",
      'attributes' => array(
            'class' => 'suspend suspend_'.$object->uid,
            'onclick' => 'if (confirm("Are you sure you want to suspend ' . $object->name . '?")) { $.get("/admin/user/suspend/'.$object->uid.'"); $(".suspend_'.$object->uid.'").attr("style", "display:none;"); } return false; ',
      ),
    );
  }
  return $links;
}

/**
* Suspend user with AJAX call
*/
function mysite_only_suspend_dispatch($uid) {
  module_invoke('user_suspend', 'operations_suspend', (array($uid)));
}
AttachmentSize
user_suspend-6.x-dev.tar_.gz 27.65 KB
nobody click here