Using the latest dev from this morning, I created a new group and add a post from the brief node form as the same user. The post is created, but the group is not associated.
Next, went to Engineering Group where I had become a member. Tried to create brief node form post. The post is created, but the group is not associated.
Next, went to my newly created group from above. Clicked go to full form. The request parameter was there and the group was prepopulated. Tried to submit but got the error:
The referenced entity (node: 7) is invalid.
(7 is the id of the new group)
Next, went to engineering group, clicked to go to full node form. Everything was populated correctly and the node submitted as expected.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 2019309-check_group_fields-15.patch | 946 bytes | ezra-g |
| #13 | 2019309-check_group_fields-13.patch | 613 bytes | japerry |
| #9 | Screen Shot 2013-06-14 at 8.47.54 AM.png | 184.98 KB | RobKoberg |
| #9 | Screen Shot 2013-06-14 at 8.48.15 AM.png | 110.48 KB | RobKoberg |
| #6 | add_debug_functions.patch | 1017 bytes | RobKoberg |
Comments
Comment #1
ezra-g commentedCan you clarify where you're getting the latest dev package of Commons from?
Please note that per the nightly dev snapshot tarball release notes:
Comment #2
RobKoberg commentedYes, I am using the dev make file:
$ drush make --no-cache --working-copy build-commons-dev.make ../commons-7.x-3.x-dev
Are you not seeing this?
Comment #3
ezra-g commentedI hadn't seen it before but wanted to confirm we're looking at the same versions before attempting to reproduce.
Thanks for the clarification - Tagging for review before 3.3.
Comment #4
RobKoberg commentedLooking into this more, the $group_id is being passed to commons_bw_partial_node_form(). The $form_state['group_id'] = $group_id; is being set. It is set to 7
Debugging in the commons_bw_partial_node_form_submit():
The result of the debug is:
$wrapper->{OG_AUDIENCE_FIELD}->value() == 1It should not be 1, it should be 7.
There are other notices and warnings, but don't look like they would affect this? They do come before my debug in the log so they were hit before the $wrapper->save():
Notice: Undefined variable: gids in commons_radioactivity_incident_groups() (line 148 of /Users/rkoberg/Sites/commons-dev/commons-7.x-3.x-dev/profiles/commons/modules/contrib/commons_radioactivity/commons_radioactivity.module).Warning: Invalid argument supplied for foreach() in commons_trusted_contacts_node_presave() (line 850 of /Users/rkoberg/Sites/commons-dev/commons-7.x-3.x-dev/profiles/commons/modules/contrib/commons_trusted_contacts/commons_trusted_contacts.module).2 of the following:
Notice: Undefined property: stdClass::$form_state in commons_trusted_contacts_node_presave() (line 850 of /Users/rkoberg/Sites/commons-dev/commons-7.x-3.x-dev/profiles/commons/modules/contrib/commons_trusted_contacts/commons_trusted_contacts.module).Then comes my debug from above.
Comment #5
ezra-g commentedThanks for that debugging!
Restoring the issue status and tag.
Any chance you're able to file a patch?
Comment #6
RobKoberg commentedIn #4, I should have wrote:
$wrapper->{OG_AUDIENCE_FIELD}->value() == array(1)
It should not be array(1), it should be array(7).
Not sure what you mean about a patch. Is it just for the debug messages? I have not fixed anything. (anyway one is attached)
I also added:
which produced:
$form_state['group_id']: 7Comment #7
ezra-g commentedI was encouraging you to file a patch to fix the problem per your debugging, rather than print the debugging information :).
Comment #8
RobKoberg commentedAh, OK. Where you able to reproduce? This seems like a showstopper. I am kind of at a loss. Any more help trying to debug would be appreciated. See more info below.
Actually, my previous debugging was not working correctly. I think watchdog was choking on the amount of info I was trying to print out. I changed it to store the result in a variable to display on form view. So in the form_submit, I have:
And I found a hook_node_insert in commons_groups and added:
Then I dpm() those variables in commons_bw_partial_node_form(). The result:
debug_commons_bw_partial_node_form_submit_group_ref_before = the correct group object
debug_commons_groups_node_insert_node = the new node, but the og_group_ref property is an empty array
debug_commons_bw_partial_node_form_submit_group_ref_after = the correct group object
debug_commons_bw_partial_node_form_submit_new_node_after = the new node, but the og_group_ref property is an empty array
Comment #9
RobKoberg commentedAttached are a couple of screen grabs showing the output of the last two variables.
Comment #10
japerryI can reproduce with or without additional content.
Steps:
1) install with or without sample content
2) enable og user access module
3) rebuild permissions
4) try to create a post within a group.
You get this:
Comment #11
ezra-g commentedThe problem may be that https://drupal.org/node/1975198#comment-7418988 was never committed.
Comment #12
RobKoberg commentedOK, that is not in the code. I am working on something else now and can't test. If you put that in does it fix the issue? If so can you commit it :)
Comment #13
japerryThis should fix the errors surrounding public posting with og_access enabled.
Comment #14
ezra-g commentedLooks like japerry committed the patch referenced in #11 a few minutes ago: http://drupalcode.org/project/commons_bw.git/commit/89ec4a3.
Comment #15
ezra-g commentedI re-rolled #13 to combine the additional conditions into the existing check for og_access module and added a descriptive code comment.
This patch allows me to target a post into groups from the short form with and without og_access module enabled.
Comment #16
japerryre-roll looks good to me
Comment #17
ezra-g commentedCommitted. Thanks, japerry!
http://drupalcode.org/project/commons_trusted_contacts.git/commit/81a9847
Comment #18
RobKoberg commentedConfirming fixed.
Comment #19
ezra-g commentedThanks for the confirmation!
Comment #20.0
(not verified) commentedchanged type/incorrect wording