Organic Groups Views

Written Steps

In this video I'll show you how to configure the view panes and pages associated with Organic Groups.

  1. OG members: This will be a list of the most recent members of the current group.
  2. OG list: This will be a list of all public groups (and private groups that you are a member of).
  3. OG user groups: This will be a list of all the groups the logged in user is a member of.

Install and enable modules

Install:

  • CTools
  • Views

Enable:

  • Chaos tools
  • Views Content Panes
  • Views
  • Views UI

Members block

First we’ll display a block listing the most recent members of the current group

  • Go to Structure > Views
  • Edit view: OG members

Here we see that the view is already set up, and there is nothing that we need to do, but you can do the following:

  • Change title to "Recent members of %1"

This view currently displays the most recent 5 members to join the group. If you would like to show more, you can do one or both of the following:

  • Use pager: Paged output, mini pager
  • Items to display: 10 (or however many you would like)
  • Save the view

Note: We'll display this in the video: "Group layout"

List all groups

Now we will list all public groups (and private groups that you are a member of) on the site. There is actually a view already setup for this at the path “/group-list”. You can navigate to example.com/group-list to see a list of the current groups on your site. (Substitute example.com with your domain)

To add a menu item:

  • Go to Structure > Views
  • Edit the view OG list
    • Menu path: Normal menu entry
    • Title: All groups
    • Description: All groups
    • Menu: Main menu
  • (Save View)

List user's groups

Now we will list all of the groups the logged in user is a member of. There is already a view setup for this as well, at the path of “/user-groups”. Navigate to example.com/user-groups to see a list of the groups you are a member of. (Substitute example.com with your domain)

To add a menu item:

  • Go to Structure > Views
  • Edit the view OG User groups.
    • Menu path: Normal menu entry
      • Title: My groups
      • Description: My groups
      • Menu: Main menu
  • (Save View)

Comments

Brian, these are well done and a great help. Especially at this time when so much in D7 is still changing, fresh and with so little documentation although I just got a copy of the Definitive Guide to d7 and that should help.

Brian's picture

Thanks for the kind words! I'm hoping to do more of these, so be sure to check the Support Me page to see what modules are in the works!

Thank you! Well done! I especially appreciate the text version of the instructions!!

Brian,
Great videos. I found these very helpful.

A question for you - how can I get a group id from the contextual node id within a view?
For example, I have page with URL
mysite/%/members. So if a user typed mysite/node/74/members, I want to show all the members belonging to the group that has node id 74. Is it possible to do this within Views, without using Panels?

Thank you very much!

Brian's picture

I've not done this before, but as far as I know, you should be able to use the Organic groups context module that comes with OG, then set the contextual filters in your view.

I have a View that lists the members of an OG Group. Is there a way to filter it by Group Role? The group role doesn't come up for filters in Views but I suspect there's a way to do it, I just don't know how.

Brian's picture

I did a little searching and found this issue, which seems to say that it isn't currently possible. On the bright side, you're not alone, so it may be possible in the future!

Thanks for taking the time to look this up, Brian. I really do appreciate it. Saves me from banging my head against the wall. I will say that OG saved my a$$ on my current project and these videos certainly saved me a lot of time and aggravation.

Brian's picture

I'm glad I could help! (Don't forget to visit my support me page to show how much you like the videos) :)

should add Page settings
Access: Role | authenticated user
to OG User groups view so anonymous access do not get Undefined property: stdClass::$name error.

Brian's picture

That sounds like something that should be mentioned on the OG issue queue. But in the meantime your suggestion sounds like a reasonable stop-gap. So, thanks!

Thanks for the videos, and especially for the written notes summarizing the steps. Really good stuff.

I'm having an issue with OG User Groups. No matter what I do to the title of the view it always comes out as " groups" when viewing the page. I can't figure out any way to override that in Drupal. Is this a known issue or is it just me? I do see line 473 of ./og/includes/og.views_default.inc where I could change it:

$handler->display->display_options['arguments']['etid']['title'] = '%1 groups';

... but I'd really like to avoid hacking the module.

my apologies, it took my username as a tag and it was removed :)... anyhow, the title is thus: "username groups"

Brian's picture

That is a fantastic question! I've never tried to change that, and sure enough, I couldn't figure it out either. So, I'd recommend asking Amitai in the issue queue on Drupal.org. If you figure it out, please post back to let us know!

Here's the solution:

http://drupal.org/node/1365080

Brian's picture

That will help a lot!

Sure enough, that's the solution I needed! Thanks for following up!

Hi Brian,

Firstly I must say I've watched all your videos on Organic groups and they are great. I've been able to do everything you've shown except one.....

I can't get articles to show in Groups; they show on the front page but not in the group. You made a point of this in your video and you also go on to show how to get them to show.

My problem is I don't seem to have the same selection option you used to do this. You selected Configuration / Organic Groups / Organic groups field settings / Bundles -> (Groups) and Fields -> (Group Views). I don't have the selection 'Group Views'

In the drop down, Organic groups / Organic groups field settings /
Fields:
I have 4 selections listed under 'Group', they are
Group
Group Roles and Permissions
Group Visibility
Group Register

I have 2 selections listed under 'Group content', they are
Groups audience
Groups content visibility

Is there something I've missed? or I've not configured?

Brian's picture

Have you watched Part 3? That is where I show how to show content on group pages. If that doesn't help, please post back on that page, but I think it should be able to get you going.

Hello, yeto again ....

I wanted to ask what is the right way to display list of group members using simple block and view that already exist.

Just enabled the block @ sidebar first... nothing happened, thereafter created a page with path as "members" shows "The requested page "/members" could not be found." when i did inspect element [chromium browser] it showed "event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future."

Me and many people are looking for solution here is the link ---> http://drupal.org/node/871944
---> http://drupal.org/node/707738

Thank's again

http://drupal.org/node/1283862 <--solution for the above problem....hope this is helpful to other new users like me ... :)

Mandatory registration blows.

Brian's picture

I'm sorry you feel that way. If it makes a difference, I was *this* close to making my videos available through purchase only, but decided to release them for free, and ask that you join my newsletter instead (and even that is not required). Since you're the first person to complain, I feel that I made the right choice. I am sorry to have inconvenienced you though. :\

Your tutorials have been so very helpful for the projects I am currently working on -- thanks!

I have set up the views exactly as you described, and like how they summarize everything. However, I would like it if when people click on an article listed in the view, it took them to a full page about the item, including comments. How do I do this?

Any help would be greatly appreciated, as this project is due early next week. Thanks!

This was great inspiration to get started

So I followed along with the video so far and everything was matching up until I look at the /user-groups

I get a
"User is not a member of any group."

When I go and edit the group entity in the admin tools and get a list of people in the group, I just get a "No people available apart of the group manager."

I'm guessing it's a config difference, any ideas?

Hi Brian. Thanks for these videos. This series has been extremely helpful.

In this video you added a %1 argument to the title of the members block so that it displayed "Recent members of Group 1". I am attempting to do something similar. I have a Views display page that displays all of the articles in a group. I attempted substituting the %1 argument in the title (Recent Articles in %1) , however instead of displaying the group name it displays the GID number. Any idea what gives? I've been beating my head against the wall for two days. Any advice would be much appreciated.

I don't seem to be able to find the "OG List" view. The views I have for OG are "OG all user group content", "OG content", "OG members", "OG members admin", "OG User groups". None of them seem to have a path. I even tried downloading the OG Views module, thinking I must have missed a module. Still no OG List. What's up with that? hmmm...
On the OG views I do have, instead of "Page Settings" they have "Pane Settings". Is this something to do with having Panels?

Brian's picture

Are you using OG-7.x-2.x? I haven't taken a look at it yet, so I'm not sure what the differences are.

7.x-2.0-beta2

Brian's picture

Ok, yeah, this series only applies to 7.x-1.x. The 2.x version has some fairly large differences, and I haven't had a chance to take a look at it yet, so I won't really be able to help you there.

Just kidding. I know it's hard to keep up with changes. I should have known better than to try to work with a beta version. Your videos are still useful. At least the first one allowed me to make groups. I will watch the rest and try to figure out what to do. I imagine the views are being made panes so that they can be put in the dashboard for D7. I will try to post here if I gain any insight.

Cheers

For OG 7.2, those views are now provided by the OG Extras module.

At around 3:35 in your video, there is a screen with the title "admin groups," and I was wondering how to change that to something else. I tried changing the title in the views edit page, but that didn't do anything. Thanks!

Brian's picture

I was able to briefly take a look at this, and it looks like it's displaying "[current-user] groups". So, it will display the username of whoever is logged in. I think it's something in the code of the module itself. I briefly looked through the view, and changing the title didn't affect anything. Unfortunately I'm not able to actually dig through the code right now, but I'm pretty sure that's where it's being set.

Thanks for the response. I'll probably try rooting around in the code to see if I can get it to change.

Search form

Add comment

Comments

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.