I dont know where the bug is, but something is broken between OG User roles and pre-populate.
A link to an add page, using pre-populate, once user roles is enabled fails to respect the prepopulate "commands" :-(

I suspect similarly with the forums module which picks up &guid=[] and uses it for the forum to address, if non other can be found - again, it seems this is removed from the arg list, meaning you can't play this trick either :-(

Cheers

Mark.

Comments

somebodysysop’s picture

Do not have prepopulate or use it, so you'll need to describe what *should* happen and what *does* happen. Please include URL examples. Might be easily fixable.

markfoodyburton’s picture

Hi,
Thanks for the fast reply
I dont mind doing a little fixing - seems from your pages that editablefields needs fixing too - so I can do that one (It's one of mine)... but - I might need some guidance.

It _may_ be easier to have an IRC or IM session for me to show you the problem - For a start, I'm happy to enable the module on the live site, but it breaks some things, so I have not left it enabled....

basically I have a link on a page that sends the user to
/node/add/&...prepopulate commands.
e.g.
/node/add/forum&gids%5B%5D=1884&edit%5Bfield_category%5D%5Bkey%5D=bug%20report&edit%5Bfield_status%5D%5Bkey%5D=active

When you go there, what happens is that all the prepopulate commands seem to have been "eaten", you end up at a URL without them in place - so presumably the prepopulate module doesn't operate on them...

Here's my guess -
1) need to make prepopulate execute after og user roles (My GUESS is that it's operating before ogur and it's eating the commands itself... possibly pre-filling in a form that is then abandoned as ogur redirects the input to another page???)
2) need to make prepopulate work on /ognodeadd not just /node/add

I think (2) is the case for the forum's module too - so it picks up it's gid[]=....
Right now, the gid[] is still on the URL when you "arrive", but the forum module (which normally uses this to work out which forum this post is in) doesn't seem to respond to it, maybe because we're not on an /node/add page any more?

I haven't had time to test all this out yet - and I suspect that I'll be very wrong about most things :-)

Cheers

Mark.

somebodysysop’s picture

If you have skype, let me know and I can send you my address.

My guess is a patch to prepopulate to use node/ 'add' OR 'ognodeadd' might fix it quickly.

The other thing is to see if it's fixable on the OGR side. Have done it with other modules such as modr8 and book:

        // Modification for book module - http://drupal.org/node/180243
  	    // this: http://www.scbbs.com/node/add/book/parent/225&gids[]=29
	    // becomes this: http://www.scbbs.com/node/ognodeadd/0/parent/225?type=book&gids[]=29
        if (module_exists('book') && $type == 'book' && arg(3) == 'parent' && is_numeric(arg(4))) {
          $path .= '/book/parent/'. arg(4);
        }

        drupal_goto($path, $query);

In either case, need to know what prepopulate is looking for.

I don't have the module. But, will look at the code.

markfoodyburton’s picture

Thanks for your reply...

I'll get in touch, and try out what you suggest :-)

Cheers

Mark.

somebodysysop’s picture

Status: Active » Needs review
StatusFileSize
new5.67 KB

Try this patch. What it does is include whatever is in the original query string as it's passed to ognodeadd. This theoretically should resolve the issue, but needs to be tested.

Apply this patch to clean download of 3.1 release.

Let me know how it works.

markfoodyburton’s picture

THANKS !!

I'll give it a go right away!

markfoodyburton’s picture

So - it fixes one bug, but I think it create another

I still need to work out why the /node/add/forum?gids[]=XYZ isn't working... but one thing at once :-)

This patch made it so that prepopulate commands work...
top banana :-)

However, if you have a "simple" add link (like those on the group "block")
/node/add/book?gids[]=1016

you end up generating a URL that looks like....
/en/node/ognodeadd?type=release&gids[]=1016&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/ognodeadd&type=release&q=en/node/add/release

this grows and grows until the browser gives up.

I will try and debug this further...

somebodysysop’s picture

StatusFileSize
new5.71 KB

The code was actually written to deal with this:

q=node/add

But not this:

q=en/node/add

So, try the attached patch to see if it solves the new issue. Again, to be patched against clean 3.1 download.

markfoodyburton’s picture

Status: Needs review » Active

This is really close now

THANKYOU so much for the hard work (at both ends of the day!)

I think there are two minor problems left.

In a group page, for some reason, I have a "create content" link - if you hit that, you get the recursive redirect.
I dont mind getting rid of that link, but it seems to be a "feature" I can't remove?

Then I need to work on the forums module to sort our looking for the guid[]=... thing...

THANKS AGAIN!

Cheers

Mark.

somebodysysop’s picture

StatusFileSize
new7.65 KB

OK, then, try this. It's going to print the query at the top of the page, but that's just for debugging.

markfoodyburton’s picture

Yes, that works :-)

Thanks!

one down, a small one to go :-)

Cheers

Mark.

somebodysysop’s picture

Status: Active » Needs review
somebodysysop’s picture

StatusFileSize
new11.27 KB

Yet another patch. Hopefully this takes care of:

/node/add/forum/38

markfoodyburton’s picture

This works
THANKS!

On the other issue: of passing the forum gid to the /node/add/forum.
A link like this is "legal' with the og_forums module:
/node/add/forum?gids[]=1234
However, this wont work (for some reason) with og_user_roles.
However, with this patch, you can now use
/node/add/forum/TID

(Converting the GID to the TID is left to the interested reader)

THANKS SomebodySysop

somebodysysop’s picture

A link like this is "legal' with the og_forums module:
/node/add/forum?gids[]=1234
However, this wont work (for some reason) with og_user_roles.

Perhaps we're not talking about the same thing. From the OG Create Forum topic link:

node/add/forum?gids[]=3647

This is what OGR has always used to create forum topics. It translates it to:

node/ognodeadd?type=forum&gids[]=3647

then processes. The og_forum module was modified some time ago to accept this URL format.

How, exactly, is it NOT working for you?

markfoodyburton’s picture

this is exactly what I was trying.
Strangely - for me - it didn't work. However, if I use

node/add/forum/1234

(Where 1234 is the taxonomy ID of the forum that I want to add to, rather than the group ID of the group containing the forum I want to post to (to the default forum in that group))
Then it works....

I have the links embedded in, for instance, the footer of a view, so it isn't so hard to change the php code to accommodate (which is what I have done), so for me, this is no longer a big problem, though it would be nice to get to the bottom of it...

somebodysysop’s picture

Status: Needs review » Fixed

Believe this is fixed. Will be included in 3.2 release.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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