I am trying to get used to the new views edit page, but it seems that when I add a User-VBO field that the settings have a block user option, but no option for unblocking users.

Comments

createnouui’s picture

Subscribing

bojanz’s picture

Category: bug » support
Status: Active » Fixed

This is a drupal core omission. Core includes only the block action, for some stupid reason.
I've posted a patch at #512042: Add user action "unblock current user" to user.module, so you can try it out, and we can try to get it into Drupal 7, fast ;)

In the meantime, you can just create a rules component that changes the "status" of user to 1.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

liquidcms’s picture

Category: Support request » Feature request
Issue summary: View changes
Status: Closed (fixed) » Needs work

not sure this should be marked as "fixed" since the patch never made it into D7 core and there is no action added to VBO

maybe this is closed (won't fix)?

bojanz’s picture

I was too much of an optimist. Let's get this into VBO.

liquidcms’s picture

i did take your advice and did up the action with Rules; only took a couple minutes; but the Rules UI is certainly not for the faint of heart - a coded action would certainly be better. i'll do up a patch this weekend if you haven't already beat me to it.

aharown07’s picture

Did this ever happen?
As a user admin tool, VBO is great... much greater if there are clear and simple basic user actions.

mark_fullmer’s picture

Here's how I created an "unblock users" VBO button with Rules Link:

1) Create a Rules Link of type "user"
2) Configure a Rule within this Rules Link (this is odd workflow logic, but whatever) with the Element "Unblock a User" (you don't have to create a loop here or anything, just the action)
3) Go to your View. There should now be a new field option called "Bulk Operations: User" that is your Rules Link. Add it to the view display.

heyyo’s picture

#8 I didn't know this module Rules link, nice one.
But by using your method, I need to give the permissions "Administer users" to the user which could unblock user.
Otherway the option of "unblock user" is not displayed.

Any idea how to not give this permission ?

EDIT: But the action "block user" works as expected even without "Administer users" permission. Why it's defined like this ?

diegocasmo’s picture

alberto56’s picture

I needed this functionality fast and the patch at #2 of #512042: Add user action "unblock current user" to user.module works fine with the latest version of D7.

WorldFallz’s picture

As web pages come and go, here's the rule's component from the anthonypower.com post linked in #10:

{ "rules_unblock_selected_users" : {
    "LABEL" : "Unblock selected users",
    "PLUGIN" : "action set",
    "TAGS" : [ "user" ],
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "user" : { "label" : "User", "type" : "user" } },
    "ACTION SET" : [ { "user_unblock" : { "account" : [ "user" ] } } ]
  }
}

I can confirm it works perfectly. It's way overkill to install rules just for this, but if you use it already it's a no-brainer.

Simply navigate to admin/config/workflow/rules/components/import, paste the code above, and click import. And don't forget to go back and edit the view to check that option in the VBO field. That's it!

Kudos to diegocasmo for finding and posting that link and to the original author for his blog post.

sumit.prajapati’s picture

MatthijsG’s picture

Thanks Sumit Prajapati!

I was looking for this, you provided a good tutorial.
One little thing: in step
Select Data Selector -> unblock-user and Save
Is 'unblock-user' default by Drupal or the given name earlier? It should be mentionend then, that you've to select the value with the name you gave earlier.

===
And an additional question: the unblock-option is now in the dropdown-menu.
How to make a link in the table to unblock?

sumit.prajapati’s picture

Thanks for reply MatthijsG

first is- Given name earlier unblock-user
second is- You have to create custom field handler
take some help from given link- http://www.codesidekick.com/blog/database-independent-views-3-custom-field-handlers

petednz’s picture

@WorldFallz - thanks for taking the trouble to paste the Rule to import - made this super quick to add.

shaneod’s picture

Thanks Sumit Prajapati - very useful tutorial!