There should be an option to turn of OG breadcrumbs so that posts that belong to a group can still use normal Drupal breadcrumbs if they are placed in the menu tree. After searching for a solution I found a site with a solution (http://www.aidanfindlater.com/2008/11/10/drupals-organic-groups-messing-...) but it requires hacking the module.

The only change necessary is to switch og_get_breadcrumb in og.module to drupal_get_breadcrumb(), but there should be something built in to make this an option (if not the default).

Comments

davidcgutman’s picture

Note: In case anyone else wants to do this, his advice doesn't seem to quite work, but if you remove all the references to drupal_set_breadcrumb in og.module OG will no longer change Drupal's default menu breadcrumbs.

moshe weitzman’s picture

breadcrumbs are so pitiful in D6 I hardly feel like fixing this. And D7 is looking the same unless someone leads the charge. I would take a patch for this if it shows up.

scedwar’s picture

Is this something that Custom Breadcrumbs could take on?
It already works neatly with og posts (nodes only), by providing tokens for the og name, url etc.
There are discussions here about how to fix it for views: http://drupal.org/node/215475

i.chris.jacob’s picture

I second this request to be able to disable OG breadcrumbs... they currently override my Menu Breadcrumbs - which is not what I want. I also don't want to have to hack OG module to 'turn off' this feature. Please please ad it as an option in the admin area.

Gold points if you can make it only use OG Breadcrumb when a Menu or Taxonomy breadcrumb does not exist... ;-)

StevenWill’s picture

I also second the request to be able to disable OG breadcrumbs.

coastwise’s picture

Title: Make OG breadcrumbs work more consistently with Drupal breadcrumbs/menu structure » Make OG breadcrumbs disableable

Agreed, they should be optional.

subscribing

erykmynn’s picture

Agreed, OG breadcrumbs are unhelpful. You should be able to turn them off!

erykmynn’s picture

StatusFileSize
new960 bytes

Here are two patches for OG 6.x-2

one adds a radio buttons for controlling breadcrumbs.
(in og/includes/og.admin.inc)

the other checks that setting and does or doesn't override drupals normal breadcrumbs
(in og/og.module)

rather simple really, and IMO an option that should be rolled in OG. The OG breadcrumbs just get in the way if you're expecting to use Menu Breadcrumbs or the Navigation menu as breadcrumbs.

Please let me know if there is any difficulties with my patches, I know PHP but haven't done a lot of group development.

How do we move towards committing this to OG?

erykmynn’s picture

Title: Make OG breadcrumbs disableable » Make OG breadcrumbs disableable -- PATCH AVAIL.
Version: 6.x-1.1 » 6.x-2.0
Status: Active » Patch (to be ported)

Updating status... Think this should be considered seriously by OG powers that be. Can "assign" to me if further work is needed, but I think this is a full implementation of the requested feature.

coastwise’s picture

Preliminary testing looks good, thanks a lot for this!

I'll update if I see any undesired behaviour.

tronathan’s picture

If you don't want to hack OG, you can override this in the theme layer by adding the following to your template.php file:

function THEME_breadcrumb($breadcrumb) {  
  $breadcrumb = menu_get_active_breadcrumb();
  if (!empty($breadcrumb)) {
    return '<div class="breadcrumb">'. implode(' » ', $breadcrumb) .'</div>';
  }
}

This will override the breadcrumb that is passed into the theme function and use drupal menu system's breadcrumb instead.

erykmynn’s picture

yes, but philosophically it seems silly to have OG overwrite Drupals breadcrumbs only to have your template write drupals breadcrumbs back in when you could just cut it back a step by not having OG carry out that behavior (since it's apparently sub-ideal for so many people)

erykmynn’s picture

Status: Patch (to be ported) » Needs review

I'm not sure exactly what to set the status to, but it would be great if we could get some sort of reply from one of the project maintainers. A lot of people seconded the request for this feature and it seems to be a tiny and sensible change.

moshe weitzman’s picture

Status: Needs review » Needs work

Looks good. Could you please change all these drupal_set_breadcrumb() calls to og_set_breadcrumb() calls and then put this check in one place.

Please see diff and patch page for instructions on creating a patch. One patch can span multiple files. If you just can't get that working, attach two patch files to the issue instead of one zip file. This makes it easier to review.

Also, if (variable_get('', 0)) is enough. Not need for the == 0 part.

Thanks for the patch.

erykmynn’s picture

Status: Needs work » Needs review
StatusFileSize
new2.26 KB
new2.26 KB

Excellent tips! I'm sort of new to patching, so I hope this worked. I assume it is most appropriate to patch the DEV version, but since I started on the stable (or someone might want to use it) I've included that too.

Since I'm not 100% sure that I did a "multiple file patch" correctly, let me know if you have trouble with it. I can provide separate patches.

also with the variable_get, i changed to if(!variable_get(",0)) since I want to act on the state of 0 and not 1 (which PHP assumes 1 is true and 0 is false).

Thanks, Eric

datune’s picture

Status: Needs review » Reviewed & tested by the community

Seems to work as expected, I have tried patching both the dev and stable one. Thanks a lot, this is exactly how it should work. This should go into OG Core ;-)

erykmynn’s picture

thanks for testing datune...

is this the correct status to get a maintainers attention again?

crea’s picture

Subscribing

erykmynn’s picture

Version: 6.x-2.0 » 6.x-2.x-dev

changed version status as there was a dev patch dated October 2nd.

servantleader’s picture

+1
Thanks for the patch. I hope the maintainers fix this soon.

amitaibu’s picture

Title: Make OG breadcrumbs disableable -- PATCH AVAIL. » Make OG breadcrumbs disableable
Status: Reviewed & tested by the community » Needs work
+++ includes/og.admin.inc	2009-10-02 12:17:55.000000000 -0700
@@ -87,6 +87,17 @@ function og_admin_settings() {
+    $options = array(t('Organic Groups Breadcrumbs'), t('Drupal Breadcrumbs'));

Only first letter should be capital.
Also there an extra space there.

+++ includes/og.admin.inc	2009-10-02 12:17:55.000000000 -0700
@@ -87,6 +87,17 @@ function og_admin_settings() {
+  unset($options);

Do we really need to unset the options?

+++ og.module	2009-10-02 12:14:06.000000000 -0700
@@ -1166,6 +1166,14 @@ function og_get_breadcrumb($group_node) 
+// Check whether to return OG or Drupal breadcrumbs

Please add PHPDocs in the form of

  /**
   * Check ...
   * @param
   * @return
   */ 
+++ og.module	2009-10-02 12:14:06.000000000 -0700
@@ -1166,6 +1166,14 @@ function og_get_breadcrumb($group_node) 
+	if (!variable_get('og_breadcrumbs',0)){
+		drupal_set_breadcrumb($bc);
+	}

Please fix tabs

Also it would be nice to have a simpletest to check the breadcrumbs option.

I'm on crack. Are you, too?

erykmynn’s picture

Status: Needs work » Needs review
StatusFileSize
new1.51 KB
new1.69 KB

I see. I didn't know anything about coding standards then, and I've cleaned up some of the mess.

Also it struck me there was an even more efficient way to handle this. Instead of adding another function and multiple calls to it, I have merely included the logic in the exisiting og_get_breadcrumbs function instead.

I've incuded a stable and dev version of the patch

amitaibu’s picture

Status: Needs review » Needs work
+++ og.new/includes/og.admin.inc	2010-04-20 17:15:39.000000000 -0700
@@ -87,6 +87,16 @@ function og_admin_settings() {
+  // og or drupal breadcrumbs setting  ¶

Words should start with a Capital letter. In this case it should be OG or Drupal ... Line should add it a dot. Also you have empty spaces all over, please remove them.

+++ og.new/includes/og.admin.inc	2010-04-20 17:15:39.000000000 -0700
@@ -87,6 +87,16 @@ function og_admin_settings() {
+    '#description' => t('Choose to use Organic Groups breadcrumbs or revert to  breadcrumbs drupal (or your other modules) provide.')

I think the description should be something like "Use Organic groups custom breadcrumbs."

+++ og.new/og.module	2010-04-20 17:36:32.000000000 -0700
@@ -1249,12 +1249,16 @@ function og_update_group($node) {
+  } else {

Should be:
}
else {

btw, you need to roll only against DEV. Thank you for the work...

Powered by Dreditor.

tallsimon’s picture

this looks promising indeed, please do keep going... would love to see in dev soon!
thank you

mrtorrent’s picture

subscribe

wfx’s picture

subscribe

wizonesolutions’s picture

Anticipating this one as well myself. OG's a module I don't really want to break on upgrades so I'll just use the theme layer workaround for now...

thepanz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.46 KB

This is my patch against 2.x-dev

thepanz’s picture

Status: Needs review » Reviewed & tested by the community

As no review received: my patch adds the ability to configure the OG Breadcrumb visibility: you can choose to turn them off or not (default: on).
Patch also includes the uninstall cleanup for the setting.

tallsimon’s picture

great thanks

amitaibu’s picture

Status: Reviewed & tested by the community » Needs review

@thePanz,
Thanks for the patch, but please don't chane the status to RTBC on your own patch. Haven't got much time to review it before OG7 is out, but maybe others will.

thepanz’s picture

@Amitaibu: sorry for that! I didn't mean to change the issue status, but add more details about my patch.
Regards

wilco’s picture

Version: 6.x-2.x-dev » 6.x-2.1
StatusFileSize
new3.46 KB

In case you all need this, here is a patch against 2.1 of the module. I hope this helps all those out there, with the same issue, as much as it did for me.

Thanks thePanz!

wilco’s picture

StatusFileSize
new3.46 KB

In case you all need this, here is a patch against 2.1 of the module. I hope this helps all those out there, with the same issue, as much as it did for me.

Thanks thePanz!

thepanz’s picture

I've forked Amitaibu OG module from github and I've merged 2.x branch with this patch on commit https://github.com/thePanz/og/commit/86787a87697259bae5b5138f5437171016c...

Amitaibu : you can merge my edits with the default OG code (or cherry-pick the right code commit)

acbramley’s picture

StatusFileSize
new1.5 KB

I've just run into a problem with the patch in #22. This is quite an edge case but if it happens that the user has selected for og not to set breadcrumbs, in og_get_breadcrumb you have not said to return anything it's just drupal_get_breadcrumb(). This falls down when og_view_group calls that breadcrumb function and does an array_pop on it. You get the error

warning: array_pop() [function.array-pop]: The argument should be an array in .../modules/contrib/og/og.module on line 967.

This patch fixes that, and also removes the t() functions from inside the l() which do not need to be there (Check the API page for l). There's also a couple of minor layout changes.

acbramley’s picture

StatusFileSize
new1.67 KB

And here's the same patch for 6.x-2.1

ice5nake’s picture

Would love to see this in a new version of OG.

ice5nake’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +breadcrumb

@Zombienaute, Thanks. Your patch worked for me.

This is a great feature. Hopefully they will get this into 2.2 if we ever get it.

Grayside’s picture

Status: Reviewed & tested by the community » Needs work
donquixote’s picture

OG support for both branches is in the pipeline for Crumbs.
This does include disabling some of the og-based breadcrumb logic.

I need some help from og experts to review the recent work:
#1819300: Support both branches of Organic Groups: 7.x-1.x and 7.x-2.x

Grayside’s picture

@donquixote, this issue is OG6-specific. Not likely to find many OG7 folks wandering up and down these shadowed halls.

claudiu.cristea’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

This version of Drupal is not supported anymore. If this is still an issue in the 8.x-1.x branch, please open a new up-to-date ticket. Closing.