If using Organic Groups with Freelinking Prepopulate the URL structure isn't quite correct: an extra GID value erroneously creeps in between the square brackets. For example, in 6.x-3.0-alpha3 clicking on a new node to be created currently has /node/add/wiki?edit[title]=porta%20aliquam&parent=1234&gids[123]=123 when it should be /node/add/wiki?edit[title]=porta%20aliquam&parent=1234&gids[]=123

Have attached the briefest of patches that removes the $key variable at line 73.

Comments

snorkers’s picture

Although patch will not deal with posting to multiple groups. Think that may be a function of OG - only allowed to pre-populate to a single group? Any thoughts?

Grayside’s picture

Does that URL structure not work? I believe I may have purposefully done it to trick multi-group posting into working.

snorkers’s picture

Can't find a way to get a 'prepopulate' equivalent for multiple OGs. If a structure of /node/add/wiki?gids[]=123&gids[]=456 is used, only the first GID is used (ie GID=123 in this example). I may be wrong... or there's another workaround, but this is the result of my limited testing today.

Grayside’s picture

I understand.

I am asking if the unpatched code works as is. At the time I wrote it, I added the extra GID value specifically to address multiple groups. It's possible OG or Prepopulate changed and that stopped working.

If prepopulating multiple groups does not work at that point, I suggest opening a ticket in the Prepopulate queue.

snorkers’s picture

The OG 'prepopulation' functionality is actually part of Organic Groups module itself (ie, the &gids[]=123 URL argument when creating a new node); it does not utilise the Prepopulate module.

In 6.x-3.0alpha3 the unpatched code in freelinking_prepopulate doesn't work at all regarding creating a new OG node (the 'Groups' are left empty). The multiple OG functionality won't work even if the URL structure was correct [because OG doesn't offer it in its core functionality].

I had a quick look at 3.0 dev and noticed that the the whole OG piece had vanished too from freelinking_prepopulate.

Do you want me to look at a patch against 3.0 DEV or 3.0alpha3? The assumption I'll make is that only the first OG argument will be the OG of a new node

Grayside’s picture

New work should be against 6.x-3.x-dev. I am happy for the help.

snorkers’s picture

I had a re-look at the code and realised that a lot of functionality (including OG) had moved to freelinking_prepopulate.api.php (in 6.x-3.0-dev)... however, I get WSOD on viewing 'Freelinked' nodes with the DEV module:

[23-Mar-2010 13:49:50] PHP Fatal error:  Cannot redeclare freelinking_nid_callback() (previously declared in /sites/all/modules/freelinking/plugins/freelinking_nid.inc:20) in /sites/all/modules/freelinking/plugins/freelinking_nid.inc on line 48

Feel as though I'm currently hitting a brick wall, so going to revisit FL 6.x-1.x-dev for the moment (sorry for lack of 'help' for the moment... deadlines et al)

Grayside’s picture

Clearly I have some ironing to do this weekend. Thank you for uncovering this.

Grayside’s picture

I'm not seeing this WSOD, nor am I grep'ing the function redeclaration. Returning attention to the OG.

Grayside’s picture

Version: 6.x-3.0-alpha3 » 6.x-3.x-dev
Status: Active » Fixed

I have fixed the single-group prepopulation problem. As you say, multi-group is not possible at this time. (Database-driven magic aside)

Status: Fixed » Closed (fixed)

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