Download & Extend

Allow switch user block to show only autocomplete field

Project:Devel
Version:7.x-1.x-dev
Component:devel
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

On the "Switch user" block, I want the option to hide the list of users, and only show the autocomplete form. However, if "number of users to display in the list" is configured at 0, then the block doesn't appear at all.

I'm submitting a patch which displays the block when "number of users" is 0, so that the autocomplete form remains. If someone wants the block to disappear, disabling it is better and faster, since it avoids the unnecessary processing and database queries.

Additionally, I couldn't find any obvious reason to for the logic in devel_switch_user_list() to have its own function, so I merged it with the devel_block_switch_user() function. If that is a problem, I can roll another patch to maintain the two separate functions.

AttachmentSizeStatusTest resultOperations
devel.module.patch4.64 KBIdleFAILED: [[SimpleTest]]: [MySQL] Invalid patch format in devel.module_24.patch.View details

Comments

#1

Version:6.x-1.9» 6.x-1.18
Status:active» needs review

Sorry, I realized that I tagged this with the wrong version. Also, I added a field description on the block configuration form to explain this new behavior.

AttachmentSizeStatusTest resultOperations
devel.module.patch5.01 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#2

Status:needs review» needs work

The separate devel_switch_user_list() function might be useful to a module like admin_menu. I don't see eliminating this function as an improvement.

Your patch should be against the -dev version, otherwise we can't apply it.

The patch is surprisingly big. I agree with you that the current behavior is not useful, but I'd expect your change to be only a few lines...

Remember that our focus is at least as much on D7 as on D6. We won't commit a patch to D6 and not to D7. If your patch were really short and sweet, you might find someone willing to port it to D7, but this is not likely for a big one like yours. Your best bet for getting this in is to provide two slim patches against both -dev versions.

#3

Well, it looks big because I merged the two functions. But it's really quite simple. I'll resubmit a slimmer patch against dev. Thanks for the feedback.

#4

Version:6.x-1.18» 6.x-1.x-dev
Status:needs work» needs review

Here's two slimmed-down patches.

AttachmentSizeStatusTest resultOperations
devel.module-d6.patch739 bytesIgnored: Check issue status.NoneNone
devel.module-d7.patch867 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch devel.module-d7.patch.View details

#5

It still seems overly complex.

<?php
 
if (!empty($links) || user_access('switch users')) {
?>

should do the same thing, no?

I have some doubts whether theme('links', array()); is safe though... Anyone?

#6

Okay, here are the two patches, both just one line long. Sending theme_links() a blank array is safe (have a look at http://api.drupal.org/api/function/theme_links -- if the array is empty, it returns a blank string). Is this satisfactory to get committed?

AttachmentSizeStatusTest resultOperations
devel.module-d6.patch206 bytesIgnored: Check issue status.NoneNone
devel.module-d7.patch403 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#7

Hmm, somehow the d6 patch was messed up.

AttachmentSizeStatusTest resultOperations
devel.module-d6.patch375 bytesIgnored: Check issue status.NoneNone

#8

Status:needs review» reviewed & tested by the community

Yes, this looks good to me.

#9

It's been a few months, but the solution hasn't changed. Here's the patch for D6 again, against dev. Should pass the tests. I'll try to get a D7 version soon, but it's just one line.

AttachmentSizeStatusTest resultOperations
devel-6.patch719 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#10

Version:6.x-1.x-dev» 7.x-1.x-dev

Here's the D7 patch.

AttachmentSizeStatusTest resultOperations
devel-7.patch719 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#11

@moshe: Do you see a problem with this?

#12

fine with me

#13

Status:reviewed & tested by the community» fixed

Committed to D7 and D6.

@moshe: Ok, thanks. I took #12 as permission to commit. You asked me not to commit things outside of DNA, so I've waited for you to do it. Was there a misunderstanding?

@joelstein: Thanks for your patience. You uploaded the D7 patch (against revision 1.411) twice, but it applied to D6 with some fuzz.

#14

@salvis. thanks for committing ... you are welcome to commit bug fixes to any part of devel package. significant new features should go through issue queue review.

#15

@moshe: great, thanks!

#16

Status:fixed» closed (fixed)

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

nobody click here