Currently, one cannot create advertisements via the ad module inside a group. I'm pretty sure it just has to do with the ognodeadd thingy.
I tried to figure out a patch for your module, but didn't figure anything out in the time that I had.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | og_user_roles.module.5.x-2.6_1.patch | 3.38 KB | somebodysysop |
| #3 | og_user_roles.module.5.x-2.6.patch | 3.52 KB | somebodysysop |
Comments
Comment #1
somebodysysop commentedYou'll need to give me a tad bit more information than that. I don't have the ad module.
Comment #2
rconstantine commentedYou mean you didn't rush out and install it right away? I can't believe it ;)
Anyway, the module provides a single registered content type 'ad' so far as the node (or was it just menu?) module knows. However, there is actually no 'ad' type. Instead, it is a link to a page where you can select from the actual various ad types. In other words, node/add/ad takes you to a selection page and does not serve up a content type creation page of any kind. The default two ad types are (1) image and (2) text. In the main menu's 'create content' sub-menu, 'Advertisement' appears as a parent menu item, and clicking it brings up the selection page as well as exposes the two available types as menu children, which you can select at that time (a la node/add/ad/image and node/add/ad/text links).
The problem with the og_user_roles module installed is that inside groups, the 'Create advertisement' link doesn't take one to the ad type choice page. Instead, there is a strange (can't seem to get there any other way) content creation form where a radio button allows one to select the ad type, but never shows the form sections specific to the type you select. Also, the 'Create advertisement' link in the group context menu is not a parent to any children.
Naturally, I first thought this was an issue with the ad module itself. However, an odd sequence of function calls is only called when og_user_roles is enabled and the ognodeadd is in the URL. In other words, creation of ads within groups works as expected (by displaying the selection page) when og_user_roles is disabled. I thought I wrote down that sequence, but I can't find it.
I did post an issue over at the ad module here: http://drupal.org/node/183064. Although his method of content type selection via choice page instead of menu item directly is odd, he mentions at least one other popular(?) module that does it as well. And there may be more. So a solution to this here might solve any similar issues that would come up.
Comment #3
somebodysysop commentedA couple of issues I noticed:
1. Even if you turn off OG User Roles, when you click on Create Advertisement within a group, then on "image" or "text", you lose group context.
2. Not sure where you go after you actually create an ad image or text.
This patch should at least allow you to get to ad type selection screen and maintain group context in selection.
Comment #4
rconstantine commentedExemption, now that's a good idea. I'll test ASAP. Thanks for your trouble.
Comment #5
rconstantine commentedI didn't apply the patch yet. I have a concern with the version lines at the top and the dates. The new one has a smaller version number and older date. They don't seem right, and I want to make sure this patch is made against the correct version.
Comment #6
somebodysysop commentedThe patch is for OG User Roles release 5.x-2.5.
Comment #7
rconstantine commentedApplied patch. Got an error for line 916. Something didn't like you using a variable named $this, so I changed mine to read $this_thingy on that line and the next.
The page with the choices is properly shown, and the links seem okay. However, clicking a link results in a malformed URL, like http://www.sitename.com//node/add/ad/text?gids[]=1. Notice the double slash before node. The form is generated correctly, but submission tries to go to http://node/add/ad/text?gids[]=1 which fails.
Comment #8
somebodysysop commentedOK. Try this patch. Again, against clean 5.x-2.5 download.
I get this error on image creation:
But, I don't know if it's simply because I don't have the module configured in any way.
Comment #9
rconstantine commentedI was just about to suggest the ltrim. I'll try the new patch now.
BTW, would there be an advantage to getting the ognodeadd feature to work with ad's sub-types? If so, let me know and I'll try to figure it out.
Comment #10
somebodysysop commentedIf the submissions work fine without ognodeadd, then no reason to use it.
Comment #11
rconstantine commentedAll seems to work, including the submission guidelines for all types both in and out of groups.
Well done.
Comment #12
rconstantine commentedSince this does work, I'm not changing this away from 'ready to be committed'. However, I have a comment about this line:
if (arg(0) == 'node' && arg(1) == 'add' && arg(2) == 'ad' && (arg(3) == 'image' || arg(3) == 'text') && $_SESSION['og_last'] && (!isset($_REQUEST['gids'])) ) {In the conditional using arg(3), is there a way to do this generically? I tried using && arg(3), or even isset(arg(3)) [which is a wrong usage of isset it turns out], but neither method worked. The reason this interests me is because there are other sub-modules in the works. For example, someone has contributed a module to display flash ads. Someone else has added one for adsense. And so on. I don't mind adding these cases by hand if I decide to use them (which I haven't yet), but thought that it might be better to make that part of the 'if' generic.
Any ideas? I thought for sure that && arg(3) would work because it returns FALSE when arg(3) isn't set. I figured the combo of arg(2) being 'ad' and arg(3) returning anything not FALSE would do the trick.
Comment #13
somebodysysop commentedif (! is_null(arg(3)))
What type of generic code would you suggest?
Comment #14
rconstantine commentedIf the 'if' you just provided works, then that's all I'm thinking of. You see, every bit of that long 'if' is obviously needed to make sure we're looking at the right kind of URL. In other words, rather than looking for 'image' or 'text', I thought that it would be possible/good enough to know that arg(3) has SOME value in it along with arg(2) == 'ad'.
What I didn't mean was generic code for handling all other (non-ad) modules if that's what you thought I meant. I'm happy with the results you've worked out as-is.
Thanks. I'll see about plugging in the above 'if' to see what happens.
Comment #15
somebodysysop commentedCommited changes to release OGR release 2.6.
Comment #16
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.