Prevent Admins from Seeing all User Subqueue Links

ezra-g - August 13, 2008 - 05:07
Project:Smartqueue Per User
Version:6.x-6.x-dev
Component:User interface
Category:feature request
Priority:critical
Assigned:Unassigned
Status:closed
Description

Administrators see add/remove links for all subqueues to which they have access. There should be a configurable option to reduce the number of add/remove links that administrators see, as this could become overwhelming when there are thousands of user subqueues.

This was discussed in #294536: Using admin login. Multiple instances of Add to on bottom of node.

#1

ezra-g - August 13, 2008 - 17:18
Priority:normal» critical

Bumping priority: This is critical for sites with 1000's of users.

#2

ezra-g - August 13, 2008 - 17:38
Status:active» needs review

This patch adds a configurable option to hide add/remove links from administrators. If you're not familiar with appling/testing patches, please let me know. Thanks!

AttachmentSize
294656.patch 2.83 KB

#3

satcom74 - August 14, 2008 - 02:54

I applied the patch and it works as far as not showing Add to and Remove from links for every user. So far every thing seems to be working as far as users adding to and removing from the queue. I did notice that on the admin login only, when admin goes and clicks the Node Queue Icon or link he gets the following error.

* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/modules/nodequeue/nodequeue.module on line 2036.
* warning: implode() [function.implode]: Bad arguments. in /var/www/drupal/modules/nodequeue/nodequeue.module on line 2036.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND nid = 47 GROUP BY sqid' at line 1 query: SELECT sqid, MIN(position) AS position FROM nodequeue_nodes WHERE sqid IN () AND nid = 47 GROUP BY sqid in /var/www/drupal/includes/database.mysql.inc on line 172.
* warning: Invalid argument supplied for foreach() in /var/www/drupal/modules/nodequeue/nodequeue.module on line 408.

This isn't urgent for me in that in my case admin will not be administering these user smartnodes. But, if that is breaking other nodequeues like for other admin-administered content, I could see where that would be a problem.

I'm attaching the following images:
Admin logged in before patch clicking Node Queue icon that is with each teaser. (In my example it is labeled My Favorites)
Admin logged in after patch showing error.
Admin logged in looking at teasers showing that the Add to and Remove from icons are gone.

AttachmentSize
smartqueue1.jpg 29.71 KB
smartqueue2.jpg 61.85 KB
smartqueue3.jpg 171.78 KB

#4

ezra-g - August 14, 2008 - 16:42

Thanks for this review.

Do you by any chance have the dev version of smartqueue_og installed ;). That could be causing this error and in fact it's the only way I was able to reproduce it. It seems to be caused when one visits the nodequeue tab on a node that actually cannot belong to any queues, and therefore shouldn't have a tab.

If you clear the menu cache, does the nodequeue tab (and the error) disappear?

#5

satcom74 - August 15, 2008 - 02:44

I'm not using the smartqueue_og module. I cleared the cache_menu table in mysql. Is that sufficient? I'm still getting the error.

#6

ezra-g - August 15, 2008 - 04:07

OK, let's get to the bottom of this:

Could you please open up nodequeue.module and after line 2035, " function nodequeue_set_subqueue_positions(&$subqueues, $nid) { "

add the following snippet so that ithe first 3 lines of that function look like this:
[corrected for a typo]

function nodequeue_set_subqueue_positions(&$subqueues, $nid) {
  if (!$subqueues){
    drupal_set_message("<pre>". print_r(debug_backtrace(), TRUE)  ."</pre>");
  }

or if you have devel.module installed and enabled:

function nodequeue_set_subqueue_positions(&$subqueues, $nid) {
  if (!$subqueues){
    drupal_set_message(dprint_r(debug_backtrace(), TRUE));
  }

Then, visit a page that generates one instance of those errors and paste the output here. Thanks!

#7

ezra-g - August 15, 2008 - 03:56

In the meantime, or if you're unable to do that in the near future, can you clarify a few things about what yous said,

. I did notice that on the admin login only, when admin goes and clicks the Node Queue Icon or link he gets the following error.

Which permissions does that admin login have assigned to his role? Please list all nodequeue and smartqueue_users permissions.

Since I'm having trouble reproducing the error, you said "icon or link" -- Since nodequeue has no icon, do you mean either the add/remove links or the nodequeue tab?

#8

ezra-g - August 15, 2008 - 03:58

Actually, this error looks like the same one that you reported in #294167: Getting the following error when I actually add a node to queue. Could it be the same problem with your setup that you were experiencing there?

#9

ezra-g - August 15, 2008 - 04:01

Patch no longer applies. Is re-rolled here for that reason, not to address the errors reported by satcom74.

AttachmentSize
hide_admin_links.patch 2.83 KB

#10

ezra-g - August 15, 2008 - 19:34
Version:5.x-0.4» 6.x-6.x-dev
Status:needs review» patch (to be ported)

Committed to 5.x.

#11

ezra-g - August 16, 2008 - 17:34
Status:patch (to be ported)» fixed

#12

Anonymous (not verified) - August 30, 2008 - 17:52
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.