I'm attempting to create tabbed content on a group home page using specific URL aliases for each group content type. I can a) use URL Alias without issue and b) create tabbed content without issue. The issue is when I combine the two together. I'm at a loss on how to setup the views page path and views page menu options.

Content type setup
Group content types
- Team
- Committee
- Social

Posting content types
- Discussion
- Event
- News

Group homepage (og_ghp_ron) view modifications
I cloned the default view but for the sake of discussion I'll reference og_ghp_ron.

I added three pages to this view, one for each content type. Each page filters based on the content type. The idea is to have a tab for each content type on the group home page. For each page I gave the following page path and page menu parameters:

Discussion
- path: og/%/discuss
- menu: tab discuss

Event
- path: og/%/events
- menu: tab events

News
- path: og/%/news
- menu: default tab news

So far this works great! When navigating to a group (og/) I can see the tabs and the content is filtered correctly.

Problem
I want to use URL Alias to give a different path for each group type as follows:
Team: og/team/[title-raw]
Committee: og/committee/[title-raw]
Social: og/social/[title-raw]

Creating the URL alias isn't a problem in and of itself. However when doing this I'm not sure how to modify my group homepage view (page paths, page menus) to accommodate. My goal is for the tabbed paths to be something along the lines of og/team/[title-raw]/news.

Any ideas how to accomplish this?

Comments

caschbre’s picture

After thinking about this some more there may be other questions to answer that help solve this problem.

1) What exactly does the Organic groups: Groups argument do? I see it validates group nodes on the node ID. Is there anyway to make that go against the node title?

2) How would we handle two arguments? Basically making the first argument be the (group) node type and the second being the node title (assuming we solve #1 above).

And to summarize the original post for easier reading....

I'm trying to create tabs on my group home pages, each tab representing a different content type... and using a more elaborate URL alias for each different group content type.

caschbre’s picture

Here are a couple of things I learned...

* Views do not (and should not) overwrite a node. The node seems to always win out.
* To have view page tabs show up on a node, have the page url use node/%/

Here is how I went about this...

I will do a more thorough step-by-step writeup when I have more time.

1) Create the group content types and give it a machine readable name (e.g. team, social, etc.) that you want to use in the path.

2) Create the pathauto settings (e.g. groups/[type]/[title-raw]) for each of your group content types.

3) Clone the og_ghp_ron view so you can make modifications.

4) Add a page for each group posting content type (e.g. news, discussions, events, etc.) that you want a tab for. Set the page url using the following nomenclature node/%/news. Set the menu to tab and give it a tab name.

Up to this point it has been pretty easy. The only issue now is that each tab points to node/%/ instead of groups/[type]/[title-raw]/ (desired). Here's where it sort of gets tricky but with the rules module we can handle this.

5) Create rules to remove and create the additional aliases to point to node/%/

(the following is copied from another thread I was researching which actually helped me solve this issue.)

Here was my basic rule setup...

Delete Node Aliases Ruleset
- Delete all aliases that point to system path
- Delete all aliases that point to system path
- ... (and so forth)

Create Node Aliases Ruleset
- Create alias #1 to point to path A
- Create alias #2 to point to path B
- ... (and so forth)

Triggered Rules
- IF new node created (and any other conditions) THEN call Create Node Aliases ruleset.
- IF node deleted (...) THEN call Delete Node Aliases ruleset.
- IF node updated (...) THEN call Delete Node Aliases and then call Create Node Aliases

So far this has worked great but I'm sure issues will arise. One I can think of off-hand is how the aliases are built. I use tokens and build the aliases using the [title-raw] token. It's possible that two nodes could have the same title. That would create the same alias twice, each pointing to a different node.

So after all of this, when a group node is created / updated I end up with the tabs on the group node and the appropriate aliases. I need to test whether using the raw tokens is best or not however.

WorldFallz’s picture

You can also do this type of node page override with the panels module.

caschbre’s picture

Yeah, I may eventually look more into panels, however it's been a long road getting panels (beta) ready for D6. That doesn't make it an attractive module to support. I don't want to be hung up on panels if/when it comes time for D7.

WorldFallz’s picture

That's a common misconception. It was not a problem doing an upgrade or any type of 'lagging'-- the maintainer (who is also the maintainer of views) decided to do a complete rewrite from scratch (along with a complete rewrite of views for views2 at the same time). There's only one merlin so complete rewrites of modules like views and panels is going to take time. I wouldn't let that dissuade you from using them.

caschbre’s picture

Ah, I did not realize that. Then when I get some time and panels is a little bit more developed I'll definitely check it out.

lionstone’s picture

I faced the same problem - I wanted the views I had built as pages off my organic-groups main page to have pathauto'd urls, instead of node/[group-nid]/blog , etc.

Two EASY-AS-PIE steps to do this for D6:

1) Install http://drupal.org/project/url_alter
2) Install http://drupal.org/project/subpath_alias
3) Enable the modules.
4) Look in disbelief as it works.

That's it. Really. Go enjoy life now rather than messing with rules :)

dafeder’s picture

What a lifesaver! Thanks! Who know how long I might have spent on this if I hadn't found subpath_alias. It really is just a question of enabling the modules.

caschbre’s picture

Thanks for the info! I have switched from rules-based to using these modules. It took me a minute to figure out I had to patch the global redirect manually but after that everything seems to be working great. It is a time saver.

JasonMoreland’s picture

Great post thank you its helped a lot.

I have a problem with my argument. In views if I pass the augment as a number eg. 31 I see the content that I want but when I run it live I get a blank page with the group name in it. I seem to be having a problem with the argument being passed as a text from clean URLS or pathauto.

http://mysite/group/31/wiki works fine

but http://mysite/group/new-zealand-policy-group/wiki doesn't work.

How do I get it to pass the number or accept the text id?

cheers

JasonMoreland’s picture

It seems that the Filter :: Organic groups: Group member = true was messing it up.

For displaying only posts that the user is a group member of I used a relationship.

Relationship: Organic groups: Group node (member)

This seems to be working fine now. :-)

dabro’s picture

I do not understand how to implement these modules and make this work. Could someone please clarify how to do this. I'm trying to do the same with og and am not understanding this. Thanks in advance, Dave

dafeder’s picture

Enabling the modules was all I needed to do to make it work as expected. What are you trying to do?

chrispeat’s picture

I would love a further explaination?

I have setup Organic Groups, and added og_forums.

I set the homepage to be www.domain.com/committee/groupname

I would then like all forums and posts to have the URL:

www.domain.com/committee/groupname/forum
www.domain.com/committee/groupname/forum/postname

How do I do this? I'm totally STUCK!

Everything else is going really well though, quodos to all involved in OG and Drupal!!!

Thanks

Chris

caschbre’s picture

I finally put together a tutorial of what I had done with group tabs and aliases. I didn't deal specifically with the forum module but you probably will want to look at step #4 that deals with the automated URL alias settings. I hope that helps.

fehin’s picture

subscribing.

drupalina’s picture

Subscribing