Hi,
The OG system is fantastic. I was able to make a lot of progress really really fast. I have one problem which has stumped me and I'm hoping somebody can help.

I created a Group Node and added a few CCK text fields.

When somebody creates content of Group Post type, the group post appears in between the mission statement of the Group Node and the CCK fields. The more group posts there are, the less likely somebody will see the fields. WHen I preview the Group Node page, the fields are on top all nicely.

I have been searching within the Views created by the OG but there are no fields even listed in that section. So, does anybody have a suggestion?

Thanks,
/TL

CommentFileSizeAuthor
#28 og.373983-28.patch1.25 KBGrayside
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tlash’s picture

anybody?

Spiked’s picture

Same here. I've made a groupnode, and I'm using a custom content type with CCK fields, and the group posts display in between certain fields.

izmeez’s picture

Version: 6.x-1.1 » 6.x-2.0-rc3

I am having this problem too. I presume it requires me to develop a better understanding of the various OG views.

Any help on getting started on how to change this would be appreciated.

Thanks,

Izzy

petednz’s picture

Don't you control these things via 'manage fields' on the content type eg .../admin/content/node-type/group-event/fields in the case of a content type called 'group-event'

izmeez’s picture

Thanks, peted.

In my particular case, I am using a node location rather than a field of location type because of issues related to viewing the node location as described at http://drupal.org/node/386848#comment-1705876

The location field display has a weight of 0 and was appearing immediately before my newly defined cck fields which was fine and could not be moved to another place as there is no visible anchor for the location, as described at http://drupal.org/node/492956

What I found was that the Group posts were appearing sandwiched between the location fields above and all the unique cck fields below.

From your suggestion, I went ahead and in the Content type for 'my-group-type' manage fields I created a new field group name, 'mygroup-details' and arranged the unique cck fields that had been created so they were indented under the 'mygroup-details' and configured the field group so that it is collapsible.

Now the group posts all appear at the top followed by both the location (which I gather is a grouping) and 'mygroup-details', the new field group.

Now I would like to move the posts to the bottom and I will take a look at views for that.

Your suggestion had the unexpected benefit in resolving another issue, http://drupal.org/node/492672 where the theme selection was appear arbitrarily between some of the unique cck fields and this no longer happens.

I guess I am just getting my feet wet in understanding cck fields and field groups.

Thanks,

Izzy

sethcohn’s picture

izmeez’s picture

Absolutely agree it's not an OG issue.

But, thanks for pointing me to making use of the cck manage field add group function. I will follow-up with some comments in the cck issue queue.

I still have lots more to learn about OG.

Thanks for your help.

Izzy

PS how do you copy and paste the link to a comment so it shows up with the number and title rather than the full url ?

izmeez’s picture

Sorry, to ask again but I am still having the same problem that others have described and I'm also wondering where to turn.

I created a new group type that includes the body and also some new cck fields (grouped into one fieldset). When posts are added to the group the teasers show between the group node body and the group node cck fields. I would like to be able to rearrange the cck fields for the node and style them differently, and preferably before the body of the group node. I realize that og_ghp_ron (river of news) is responsible for the string of teasers but I can't get a handle on how to rearrange and style the other node components being displayed.

Any help would be appreciated.

Thanks,

Izzy

mariagwyn’s picture

Status: Closed (duplicate) » Active

I am having the same problem, though it is not connected to the location module.

Description
1. I created a unique node type which includes a number of CCK fields place in field groups, and which are properly displayed according to the settings at admin/content/types/group_type. This content_type is activated as a group type (NOT a group post type). The post itself is effectively themed by node-og-group-post.tpl.php.
2. When members post to the group, the posts display as a 'river of news' according to the VIEW og_ghp_ron, which I can of course modify.
3. BUT... the RIVER appears between the group description and the unique fields. I want the unique fields a the TOP, not bottom. This page, which includes the Group info, and all the posts, is themed by node-og-group.tpl.php
4. The content variable is this: <?php print $content ?>

The problem is that $content prints all content, i.e., node-list (og_ghp_ron) AND unique fields. In that order. I need to switch the order of the VIEW and the CCK fields. I have no idea how to do this.

In the past I have themed a node using unique fields...

<?php if ($node->field_subtitle): ?>
    <h3><?php print $node->field_subtitle[0]['view'] ?></h3>
  <?php endif; ?>

I can probably do this with at least the unique CCK and VIEW fields, as that is all they are. But I am not sure what the OG description fields are (they are just a part of $content).

Any ideas? help? It would be nice if there was a way to ensure that unique fields preceded the view stream, as a standard practice, or perhaps a checkbox.

Thanks,
Maria

benmmc’s picture

I was having the same problem.

Not sure if it's the best approach, but I just themed it like a normal node type (node-TYPE.tpl.php) and printed each field separately, then added the following where I wanted the river of news.

<?php
print views_embed_view('og_ghp_ron', 'default', arg(1));
?>

Not sure if that's what you're looking for, but it worked for me.

Spiked’s picture

I've also managed to solve this with some (advanced) theming.

izmeez’s picture

@engineindustries Thanks. With #10 and some advanced theming it worked.

benmmc’s picture

Glad it worked for you, Izzy. I've found that views_embed_view(); comes in handy often.

Anonymous’s picture

I solved this issue by changing the weight of values in the node->content array using hook_nodeapi in a custom module:

function CUSTOMMODULENAME_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'view':
     if (module_exists('og') && og_is_group_type($node->type)) { //checks to see if og exists and if node is a group node
        $node->content['view']['#weight'] = 50; // make group home page view (e.g. og_ghp_ron) heavier than other node fields
      } 
     break;
  }
}

From what I understand, the node module creates the $content variable based on the weight of items in the $node->content array.

OG orders the content array as follows:

  • og.module moves the group node's body field to $node->content['og_mission'] and gives it a weight of -3 (see og.module hook_nodeapi, this calls function og_view_group, which adds the og_mission array to node->content around line 878 in og.module 6.x-2.0).
  • og_views.module adds group node home page view to $node->content['view'] but omits a weight value (see og_views.module hook_nodeapi, this calls function og_views_view_group, which adds the view array to node->content around line 210 in og_views.module

So to make the view appear below the other fields I made the view in the node->content array heavier, before the content variable is rendered by the node module.

I guess another way might be to change weight of fields using manage fields in the admin interface, but at quick glance my group node title weight is already at 13, so not sure you'd ever be able to get your CCK fields to be lighter than the view using manage fields. Also note that regardless of where you place your body field it will get converted to og_mission and given a weight of -3 programmatically. In my case that means it always appears first in the rendered template $content variable, unless I add it to view $op in hook_nodeapi to change it's weight before it gets rendered, i.e.:

$node->content['og_mission']['#weight'] = 40;

If I've understood this correctly then, out of the box, og_views could add a heavy weight to the $content->node['view] array to make it more likely that the group post listings from og_ghp_ron would appear below CCK fields by default.

soyarma’s picture

I agree that this is an OG issue. I experience it just with CCK fields. The OG admin page needs a weight option.

If you use the solution in post #14, keep in mind that you'r module may not have a heavier weight than OG and thus OG will overwrite the custom hook_api you create. A handy way to fix this is to use the Util module (or just set your entire custom module to have a higher weight).

mpotter’s picture

I had this same issue. The idea in post #14 helped me a lot.

This problem occurs when you have custom CCK fields added to the group node type and then change the order of these fields. Seems that when you drag/drop CCK field order, at some point you can get the CCK fields to have a larger weight value than the embedded OG group home page view.

This could also be fixed in the og_views.module file in the function:

function og_views_view_group($node, $teaser, $page) {
...
$node->content['view'] = array('#value' => $built);

changed to:

$node->content['view'] = array('#value' => $built, '#weight' => 99);

Maybe somebody can make this into a real patch at some point. Until then, I like the idea of just overriding it in my own module as in post 14.

xacto’s picture

I agree with this post topic. I have the same issues.

There needs to be an easier way to simple rearrange the order of the OG group page.

This is all too complicated and seemingly unnecessary for something so simple and basic.

All I want to do is list the CCk field nodes above the mission statement.
Even below it would be fine. But having the nodes below the ron(river of news)
is really a bad default setting.
And to hard code each field makes it difficult to implement for different group types.

Has anyone found a simpler way to resolve this yet.

Wzu’s picture

I didn't the weight property working with the funciton in #14 with my own custom module. Anyone know what I'm doing wrong?

Edit: Had to modify my custom module's weight using the util module... works now!

nodecode’s picture

Version: 6.x-2.0-rc3 » 6.x-2.1

I wish someone who really knows the OG code would chime in on this. Or commit to fixing this, or even suggest a solution that doesn't involve a custom module or advanced theming. C'mon who needs their CCK fields BELOW the 'river of news?' Who i ask? I'd mark this as a BUG if it were my own thread.

I will report back if I figure anything out myself.

jenyum’s picture

I created a custom OG view because this was driving me insane. Create a new view with the naming convention: og_ghp_mynewview (Can't use it as the OG default view unless it has "og_ghp_" before it)

Set it up with an unformatted style and an organic groups argument. Add in all the fields you need with all the bells and whistles you need. Filter it to show published nodes of your group node type(s).

When you are done and you've saved your view (don't forget you need a page display and a path) set that as your default view at organic groups configuration.

After you have done that, unfortunately you will have to re-do the links by hand in all the other organic groups views. (The groups list, my groups, etc.) It's worth the work though, because then you will have a view that will include only those fields you want, where you want them.

og_ghp_ron should really include CCK fields. I don't understand why it doesn't. Maybe one of the module maintainers can chime in.

jenyum’s picture

Category: support » feature

Changing this to "feature request" - because I think what we are asking for is a default view that supports CCK fields.

nodecode’s picture

@jenyum: Correct me if I'm wrong but I think you're explaining how to add cck fields to OG's "river-of-news" right? It's not GROUP POST cck fields that are an issue, it's GROUP cck fields and their interaction with the og_ghp_ron view. The problem many users in this thread are having, is getting a GROUP's cck fields (such as a group image) to appear above the river of news instead of having those fields pushed down to the bottom of the page by the river-of-news itself.

Please chime in here if I misunderstood.

jenyum’s picture

Well, the default (og_ghp_ron) view is actually set to "row style: nodes" meaning it doesn't use fields at all, so reordering of fields is not possible. Looking at it again (and I looked at this thing until my eyes bled the other day but somehow missed this) I suppose I could have just set the row style to fields and then added the fields back in to the og_ghp_ron view, but then I would still have had the problem of getting false "this group has no posts" messages (which I am getting now, or would be if I hadn't hacked them out) and probably other unfortunate consequences from messing with the default set up.

So the way I look at it (and maybe I'm misunderstanding) the essential problem is that OG was set up using nodes instead of fields, so reordering content at will can't be done in the way we generally like to be able to do with a view. My guess is that this is because OG pre-dates some of the sweeter features of CCK and views. I at least would prefer a default view that uses fields, because then I have control over what to put in it and where, without breaking everything.

If you do want to reorder your fields, change the setting from nodes to fields and tinker with it. If you want everything on one page, you should be able to add a photo field, title field, body field etc, and then set your main group post content type to sticky at top of lists. If it doesn't work with og_ghp_ron, create a new default view. I went about it a little differently, creating a new default view with just my group node, (using fields) and then a separate view entirely for my posts, which I then link to through a field in the group node view. Then I had to fix some aspects of how other modules interact with Organic Groups because they were built with the default set up in mind. (Modr8 was my biggest issue.)

In the set up we're using, the main "group photo" is attached to the main group node, which means that provided the fields are in the correct order it should stick at the top of the page where it belongs.

izmeez’s picture

@jenyum, I am also wondering if you are describing another issue or trying to elaborate on this issue.

I hope I am not misunderstanding you.

As I understand, this issue is about the group content type and what appears on the group home page. If cck fields are added to the group content type then looking at the group home page one finds the "river of news" view appears between the "body" of the group content type and the cck fields of the group content type. Since these cck fields do not appear grouped on the content type display page they can not be rearranged there. Instead currently the solution requires using theming as described in #10.

This issue does not speak to the teasers in the "river of news" themselves.

jenyum’s picture

Right, no, I think you're missing what I'm trying to say.

Whether or not fields are grouped on the content type display page, they can be rearranged in a view. (So don't worry about content types or anything else in the admin interface here - I am speaking solely of this as a view.)

Since og_ghp_ron is a view, one would expect to be able to edit it and rearrange the fields (thus fixing the problem of fields displaying below the river of news, etc.)

You do this here:

admin/build/views/edit/og_ghp_ron

Unfortunately, og_ghp_ron is set up with a row style "node" which does not make use of CCK fields. When we change this to "unformatted," we then see that it is possible to define fields (look directly underneath "arguments").

We can now add back in and freely rearrange the fields, if you click on the "+" next to fields you should see that all of your fields are available. However, after rebuilding the view in this way, other things within the module do not work as expected.

Go ahead and try this and you will see what I mean. Change og_ghp_ron (or set up a new og_ghp_newview view) to row style "unformatted" and build your view using fields. (Photo, description, title, body, etc.) Make sure you have an organic groups argument. Set your main group node content type to default to "sticky at top of lists" in the content type admin section, and if you created a new view set this to default in OG configuration. (These are the only things you should need to do outside of the views interface.) For this particular site, I didn't have to worry about a sticky and I took a further step of filtering for just my main group node content type because I wanted to display group posts on a separate page.

If you take the above steps and you still aren't getting different results, let me know, but it *should* work. (Worked for me.)

In my opinion, it would be preferable if OG came with a default view that used fields rather than nodes to display the content, for maximum flexibilty. I don't think it's very Drupal-like to assume that only one configuration of nodes and fields is desired.

jenyum’s picture

Well... that didn't work. (Tried it on a clean set up.) Setting up a view without the group posts (just the main group node) does work, however. Unfortunately, you have to set an Organic Groups: Group Node argument which means you only get the main group node. I'm working on a work around but for now here's the exported view if it helps anyone:

$view = new view;
$view->name = 'og_ghp_main';
$view->description = 'New Default View';
$view->tag = 'og';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'field_image_fid' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'image_plain',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_image_fid',
    'table' => 'node_data_field_image',
    'field' => 'field_image_fid',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'description' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'description',
    'table' => 'og',
    'field' => 'description',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'body' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'exclude' => 0,
    'id' => 'body',
    'table' => 'node_revisions',
    'field' => 'body',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'created' => array(
    'order' => 'DESC',
    'granularity' => 'second',
    'id' => 'created',
    'table' => 'node',
    'field' => 'created',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'nid' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'nid',
    'table' => 'og_uid',
    'field' => 'nid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
    ),
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_image_size' => '_original',
    'default_argument_fixed' => '',
    'default_argument_user' => 0,
    'default_argument_php' => '',
    'image_size' => array(
      '_original' => '_original',
      'thumbnail' => 'thumbnail',
      'preview' => 'preview',
    ),
    'validate_argument_node_type' => array(
      'image' => 0,
      'group_posttype' => 0,
      'main_groupnode' => 0,
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '2' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_is_member' => 'OG_VIEWS_DO_NOT_VALIDATE_MEMBERSHIP',
    'validate_argument_group_node_type' => array(
      'main_groupnode' => 0,
    ),
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => 1,
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Group Page');
$handler->override_option('use_ajax', TRUE);
$handler->override_option('use_pager', 'mini');
$handler->override_option('style_plugin', 'list');
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', 'Group files');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'group2');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));

You have to view this as the "page" view just going to node/[nid] gets you a weird mixture of the new and the old view. set this up as a "page" display, and then manually fix all of the links. Also, in OG configuration set the default view to "none" otherwise it will break the appearance of the main group node when navigated to directly at node/[nid]. Then, you can edit your group node content type to put the "image" field (and any other fields) back in the order you want them, and they will display that way in the node view.

Example of new Group Node Page View: (The main view I want my users to see when they first go to my groups.)

http://laundryrobots.com/group2/17

In this view, I have also added a link to see the posts in the group at a different view. I did this by adding a nid field to the view, excluding it, and then adding a text field (need to have created this for your content type first) outputted as a link like this:

<a href="newpageviewpath/[nid]">Read Group Posts</a>
You could of course make this a button or anything else you want, by adding a class to the link and then theming it. (Inline css won't work in a view.)

Example of Group posts page:

http://laundryrobots.com/group/17

Example of node view:

http://laundryrobots.com/node/17

After you do all of this you have to go back and manually fix all of the links in the other OG views. As far as I can determine, setting the default view in OG configuration didn't do any of this anyway, so we're not losing anything by setting that to "none."

Aple’s picture

Thank you so much. I've been struggling with this for hours now and knew it was something like that. This is great. Now I know how to pass args to embedded views too.

Can't thank you enough.

Grayside’s picture

Version: 6.x-2.1 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
1.25 KB

The correct approach here is most likely to implement hook_content_extra_fields() for the River of News view. This is the de facto non-programmatic method of fixing the sort order of elements on a node page.

Grayside’s picture

Status: Needs review » Fixed

Committed #947488: OG ignores CCK weight settings for body content on group nodes. so the mission statement (aka Body) can be properly adjusted relative to other elements of the group node. Committing #28 with modifications so the home view can also be adjusted.

This change requires the CCK content.module to be available so the manage fields interface can be used to reorder the components of the node.

http://drupalcode.org/project/og.git/commit/f958f75

Status: Fixed » Closed (fixed)

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