Hi,
There seems to be a major bug with the OG - Regcode - Rules setup. I have tried all combinations with the stable and dev branches where applicable on a vanilla 7.28.
When I hit the "Add Rule' link via Regcode Admin, I get a WSOD. On the log, I get the following
[Tue Jun 03 00:40:32 2014] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function og_label() in /var/www/xxxxxx/sites/all/modules/regcode/regcode_og/regcode_og.module on line 164, referer: http://127.0.0.1/xxxxxx/admin/config/people/regcode/og
I built a Rule via Rules and tried testing it out. The error code I got was
Warning: Missing argument 3 for regcode_og_regcode_used(), called in /var/www/xxxxxx/sites/all/modules/regcode/regcode.module on line 442 and defined in regcode_og_regcode_used() (line 289 of /var/www/xxxxxx/sites/all/modules/regcode/regcode_og/regcode_og.module).
Notice: Undefined variable: regcode in regcode_og_regcode_used() (line 291 of /var/www/xxxxxx/sites/all/modules/regcode/regcode_og/regcode_og.module).
Recoverable fatal error: Argument 2 passed to og_rules_add_entity_to_group() must be an instance of EntityDrupalWrapper, instance of EntityListWrapper given in og_rules_add_entity_to_group() (line 353 of /var/www/xxxxxx/sites/all/modules/og/og.rules.inc).
I'm guessing something is critically broken, not sure where. Anyone help?
Thanks
K
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | intergration_with_og-2278707-22.patch | 3.24 KB | ayesh |
| #17 | regcode-d7_integration_with_OG-2278707-17.patch | 1.34 KB | cbrasfield |
Comments
Comment #1
jmatuska commentedI am having the same problem.
- Drupal core 7.28
- Organic groups version 7.x-2.7
- am currently using this dev version of Registration codes (7.x-1.1+9-dev), but first tried the stable release (7.x-1.1) and got this same error.
When i go into Configuration > People > Registration codes and go to the 7th/last tab (Organic Groups) and click on "Add rule", I get this error:
Fatal error: Call to undefined function og_label() in /home/content/94/7074694/html/dr/sites/all/modules/regcode/regcode_og/regcode_og.module on line 164
Comment #2
Lauren Kelly commentedBased on the patch provided here https://www.drupal.org/node/1491140 I made a patch for regcode_og that is working for me on my site running D7.28 with OG 7.x-2.7
Comment #3
Lauren Kelly commentedBased on the patch provided here https://www.drupal.org/node/1491140 I made a patch for regcode_og that is working for me on my site running D7.28 with OG 7.x-2.7
Comment #4
jmatuska commentedthanks Lauren. i applied your patch.
I can create a new rule, but now i'm getting these errors at the top of the registration codes > OG tab page:
Notice: Undefined variable: gid in regcode_og_rules_page() (line 255 of /home/content/94/7074694/html/dr/sites/all/modules/regcode/regcode_og/regcode_og.module).
Notice: Trying to get property of non-object in regcode_og_rules_page() (line 256 of /home/content/94/7074694/html/dr/sites/all/modules/regcode/regcode_og/regcode_og.module).
Notice: Trying to get property of non-object in regcode_og_rules_page() (line 263 of /home/content/94/7074694/html/dr/sites/all/modules/regcode/regcode_og/regcode_og.module).
Comment #5
Lauren Kelly commentedI was just testing further and came across more issues....
This is an updated patch that got me through to creating users as a member of the appropriate group - but it will only work if the group is a node.
I had to add a group_type argument at line 305 - and ours in a node...so....
If someone knows a better way to grab the group_type, that should probably be implemented here.
Comment #6
Offlein commentedHi, this works. The patch should be "-p1 style", however, and made from the root of the project directory (as opposed to your docroot). Also you had an extra space. Reuploaded.
Comment #7
Offlein commentedI guess I could attach the file too. ...I guess.
Comment #8
Offlein commentedAlso this is critical. We should get this in ASAP.
Comment #9
scottalan commentedAs of og-7.x-2.x the
og_labelmethod is deprecated in favor of just usingentity_label(). This patch should handle both og-7.x-1.x and og-7.x-2.x consideringentity_label()is available in core.This also handles a warning when a "tag" hasn't been defined for a rule.
As far as the
drupal_alter()is concerned, I ran into this issue using Open Atrium as it allows you to create multiple groups with sub-groups. This of course can apply to OG outside of OA depending on your setup.Example use of the alter:
Comment #10
niallmurphy-ie commentedThanks everyone! #7 works for me.. Fixes the Add Rule WSOD and allows registration. #9 fixes the Add Rule WSOD but gives a WSOD (if memory serves me right) when a voucher is used for OG.
7.x-1.1 + OG 7.x-2.7
Comment #11
held69 commentedApplied patch under #9
Getting:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 437189 bytes) in C:\wamp\www\dev\includes\database\database.inc on line 2168
@ayesh Thanks! have raised my php limit.
Upon clicking the link 'add rule' the page doesn't lead to another page.
Instead it keeps searching...
Comment #12
ayesh commentedGuys I became the maintainer of the module just a few weeks ago, and I'm working on a 2.0 version to make the module more object oriented and inherit a lot of features from Entity API.
From what I can see, this module depends on OG 1.0 version (in both 6.x and 7.x), which has the ob_label function. As of now, we need a rewrite or at least a serious work. #9 seems to fix the missing function issue.
Re #9: try increasing your site's memory limit. This patch adds an extra function to load og group labels, which I believe takes some more memory. But it's not a problem with the new function itself.
I will work on this.
Comment #13
held69 commentedI have tons of groups so it took a while to load them all.
However i havent been able to get the organic group part working.
I have set up a rule by selecting a group.
Then created a code and logged in with a new user using the code.
The logged in user didn't get to his group.
Maybe i am missing something.
I used the simpler module:https://www.drupal.org/node/2023099
which worked straight of the box
After the login of the new user the user is taken to his group selected in the rule.
Comment #14
niallmurphy-ie commentedIf you only want set codes per group (instead of many vouchers), you can get most of the functionality of this using rules and entity forms..
I allow users to create a group and set the code / codes fields using entity forms rules.
Then, have another entity form or user field that uses a rule to "fetch by property" when a code is entered. This finds the group in the rule and allows you to subscribe, set roles, redirect etc.
Comment #15
held69 commentedThanks for your reply.
I am not that familiar with entity forms.
As my use case is pretty straightforward i was hoping to get
my solution out of the box.
Usecase:
Administrator (user 1) picks a group where users should be subscribed to after login.
Administrator creates about 50-100 codes.
Users receive codes by post.
Users use registercode to login.
After login user is taken to his group.
As mentioned i have only got this to work with the simple version of this module.
The bulk function however when enabled prevents the function from working correct.
Could rules be an option in my case?
Comment #16
vinmassaro commentedThe patch in #9 does not currently apply cleanly to 7.x-1.x or 7.x-1.3 so I'm setting this to 'Needs work':
Comment #17
cbrasfield commentedUpdated patch based on comment #7. Tested against dev.
Comment #18
ayesh commentedThanks for the patch in #9.
Attaching a rerolled patch, which applies correctly to the current 7.x-1.x head (also the 7.x-1.3 release). This is essentially the same patch, but I modified it to sanitize the label name (this module had many such security issues which set this module to abandon, which then I took it fixing them).
Can we get more hands on this please? If others can confirm this is working well, we can commit this and go for a 7.x-1.4 with this one and a few more bugs hunted!
Comment #19
ayesh commentedOops... Two comments with different patches with 1 min difference. Sorry I didn't see #17 when submitting mine.
Comment #20
ayesh commentedReviewing the patch in #17, it uses the node title as the OG label, where the rerolled one of #9 use entity_label to get the label, which will use the title property from node object anyway.
Comment #21
cbrasfield commentedHi!
Thanks for the new patch!
I'm attempting to register using a code, but am getting the following warning and notice:
Warning: Missing argument 3 for regcode_og_regcode_used(), called in /modules/contrib/regcode/regcode.module on line 484 and defined in regcode_og_regcode_used() (line 334 of /modules/contrib/regcode/regcode_og/regcode_og.module).
Notice: Undefined variable: regcode in regcode_og_regcode_used() (line 336 of /modules/contrib/regcode/regcode_og/regcode_og.module).
Line 484 of regcode.module we're invoking the hook for the og_regcode_used function but not passing in the third $regcode parameter.
Comment #22
cbrasfield commentedShouldn't this line in regcode_og.module
og_group($ogid, array('entity' => $account));be
og_group('node', $ogid, array('entity' => $account));?Based on
og_group($group_type, $gid, $values = array(), $save_created = TRUE).Comment #23
ayesh commentedHow about this one?
The hook implementation was wrong in the previous version.
Comment #24
cbrasfield commentedMarvelous! It patches cleanly and works just splendidly. Commit! :)
Thank you!
Comment #26
ayesh commentedThanks @cbrasfield.
Since no other objections were posted in two weeks, I will go ahead and commit this to the DEV, and will be included in a release soon.
Comment #27
held69 commentedSorry for my late reply.
However i am still having trouble getting this to work with OG.
I have installed the latest 7.x-1.x branche
-Created a rule by picking one of my groups.
-Created a code.
-Used the code on registration.
-Used the one time link and filled in the account fields.
-Then after saving the new useraccount, the is not a member of the group i picked in my rule
nor any other group.
What am i missing?
Comment #29
steinmb commented