In user_roles.action.inc, if the view doesn't include group_type and gid as the first and second arg, you get a unsupported operand error. It makes more sense to rely on og_context() to get the group_type and gid.

Change includes/user_roles.action.inc line 12:

<?php
 
// Get the group type and group ID from the Views arguments.
 
list($group_type, $gid) = $context['view']->args;
?>

To:

<?php
 
// Get the group type and group ID from the group context.
 
$og_context = og_context();
 
$group_type = $og_context['group_type'];
 
$gid = $og_context['gid'];
?>
Files: 
CommentFileSizeAuthor
#11 vbo_modify_og_user_roles-1799640-11.patch1.02 KBRoySegall
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch vbo_modify_og_user_roles-1799640-11.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#8 vbo_modify_og_user_roles-1799640-8.patch1.09 KBRoySegall
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]
#5 vbo_modify_og_user_roles-1799640-5.patch1.06 KBRoySegall
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]
#4 vbo_modify_og_user_roles-1799640-2.patch1.36 KBweekbeforenext
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]
#2 vbo_modify_og_user_roles-1799640-1.patch1.34 KBweekbeforenext
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

Comments

It makes more sense to rely on og_context() to get the group_type and gid.

This can be a fallback in case $context['view']->args doesn't have what we want. Patches are welcome.

Status:Active» Needs review
StatusFileSize
new1.34 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

The attached patch identifies the gid and group_type arguments, if they exist, and uses them first. If both arguments are not found, it uses og_context. However, when I called og_context(), it didn't work so I used $_SESSION['og_context'] instead.

+++ b/includes/actions/user_roles.action.incundefined
@@ -10,7 +10,28 @@ function og_user_roles_action_info() {
+ $gid_key = array_search('gid', $arguments);
+ $group_type_key = array_search('group_type', $arguments);
+ if($gid_key !== FALSE && $group_type_key !== FALSE){
+   $gid = $context['view']->args[$gid_key]; ¶
+   $group_type = $context['view']->args[$group_type_key]; ¶

Wrong indentation and trailing space.

+++ b/includes/actions/user_roles.action.incundefined
@@ -10,7 +10,28 @@ function og_user_roles_action_info() {
+    //$og_context = og_context();// This method did not work.
+ $og_context = $_SESSION['og_context'];

Well, we need to figure out why og_context() didn't work, instead of hacking it ;)

StatusFileSize
new1.36 KB
PASSED: [[SimpleTest]]: [MySQL] 731 pass(es).
[ View ]

Okay, I think I fixed the spacing and indentation. Thanks for the tip!

I know it's a little hack, but I need to implement now so I want it to work until we can find a better fix :)

StatusFileSize
new1.06 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

I made a total fix the patch: First the we check that the og context module is exists, if so we get the og type and og ID from the context. If not, check that we have the og type and og ID from the $context['view']->args.

@weekbeforenex, you include in comment #4 the patch with the white spaces. You should check that in the future that you posted the correct patch.

Status:Needs review» Needs work

+++ b/includes/actions/user_roles.action.incundefined
@@ -9,10 +9,26 @@ function og_user_roles_action_info() {
+  if (module_exists('og_context')) {
+    $og_context = og_context();

you should if (module_exists('og_context') && $og_context = og_context()) { in one line, or you will get a notice.

+++ b/includes/actions/user_roles.action.incundefined
@@ -9,10 +9,26 @@ function og_user_roles_action_info() {
+  if (empty($gid) || empty($group_type)) {

if => elseif

+++ b/includes/actions/user_roles.action.incundefined
@@ -9,10 +9,26 @@ function og_user_roles_action_info() {
+    if (!empty($group_type) && !empty($gid)) {

if it's empty, you can return here, no need for the same check below.

btw, this change should apply to all VBO actions

StatusFileSize
new1.09 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

Status:Needs work» Needs review

Status:Needs review» Needs work

+++ b/includes/actions/user_roles.action.incundefined
@@ -9,11 +9,24 @@ function og_user_roles_action_info() {
+    if (!empty($group_type) && !empty($gid)) {
+      $gid = $gid;
+      $group_type = $group_type;
+    }
+    else {
+      return;

This looks strange...

Status:Needs work» Needs review
StatusFileSize
new1.02 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch vbo_modify_og_user_roles-1799640-11.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Status:Needs review» Fixed

Fixed else if => elseif and committed, thanks.

Status:Fixed» Closed (fixed)

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