As per title. I don't need the Faces tab or page, but I do want user pictures. I assumed disabling the faces view would remove the page and tab, but there was no effect. I emptied the cache but still no effect. Any ideas?

I tested this on Drupal 6.6 with Views 6.x 2.1 and OG 6.x 1.0. No other modules installed except basic core.

Comments

moshe weitzman’s picture

Status: Active » Fixed

Committed a quick fix. Please test and reopen if there is a problem.

Anonymous’s picture

Status: Fixed » Active

Updated to 6.x-1.1
Tested again on same setup... cleared cache... still seeing the Faces tab.

tallsimon’s picture

The faces tab is from the default view, there is no page view for the og_members_faces view. The tab can't come from the default view, as far as I can see (no setting for menu item in default view). So where does it come from?

marcoBauli’s picture

guess it's coded in the module somehow, the same happens also for the 'Group activity' tab i cannot get from where it comes from. Probably we have to create a new OG/all and OG/my views from scratch to prevent them from showing up.

scottrigby’s picture

Version: 6.x-1.0 » 6.x-1.2

Still the case in 6.x-1.2.

@marcoBauli: has that worked for you - creating those views from scratch (as a temporary workaround)?

@moshe: any advice on approaching this?

marcoBauli’s picture

@scottrigby: yes, it did

scottrigby’s picture

@marcoBauli: To test this workarond, I cloned the existing og/* views and renamed the views menu & tab paths to groups/* (groups/all, groups/my etc). This allows selecting which tabs appear at those paths... but then you have to override the breadcrumbs and group details block etc - or did you go about this another way?

Regarding the root of the problem however, i'm still not sure why this tab wouldn't hide once the view is disabled. Here's the access callback function for the Faces tab in og_views.module:

function og_menu_access_picture($gid) {
  $view = views_get_view('og_members_faces');
  return og_is_picture() && og_is_group_member($gid) && !$view->disabled;
}

It seems that the && !$view->disabled bit should return FALSE if the og_members_faces view is disabled. As a test I commented out this line and added return FALSE;, and the tab disappears. So there must be something in this line that isn't correctly returning FALSE as it should.

moshe weitzman’s picture

Title: Disabling Faces View doesn't remove menu tab or view page. » $view->disabled is FALSE even when view has ben disabled
Project: Organic Groups » Views (for Drupal 7)
Version: 6.x-1.2 » 6.x-2.4
Component: Og Views » Code

Reassigning to Views project:

To reproduce:

1. Mark a view disabled in views ui. i am using a view provided in by a module as a default view.
2. in custom code, call views_get_view(). note that value of $view->disabled is FALSE despite #1. It seems this property is always FALSE.

dawehner’s picture

Category: bug » feature

This property is currently just for exported views to code. You can disable it if you have defined a view in code.

Perhaps someone wants to fix this with a patch.

iamjon’s picture

Category: feature » task
iamjon’s picture

I'm marking this as an unassigned task. If anyone would like to role up their sleeves and take it upon themselves to write a patch it would be awesome.

Drake’s picture

I'm interessting in this solution too...
so if someone has some ideas how to solve this, please share this with us...

I found this in og_views.module in line 160

/**
* Implementation of hook_og_links_alter().
*
* Hyperlink the members count to the members listing.
*/
function og_views_og_links_alter(&$links, $node) {
if (isset($links['subscribers'])) {
$txt = strip_tags($links['subscribers']);
$links['subscribers'] = og_is_picture() ? l($txt, "og/users/$node->nid/faces") : l($txt, "og/users/$node->nid");
}
}
maybe changing the link might help

nigelcunningham’s picture

Status: Active » Needs review

The test in og_menu_access_picture that currently says

!$view->disabled

should be changed to

empty($view->disabled)
Drake’s picture

Well, chaning this !$view->disabled to empty($view->disabled) disables the tab but if you click on teh group member_count you will get the group members.

But the group member_count provide a link to og/users/%/faces.
I woudl like to change this link which should point to another view for example og/%node/members
%node is a single group.

I changed this to:

function og_views_menu() {
// This exists because I can't easily restrict access based on pictures_enabled using Views.
$items['og/%node/members'] = array(
'title' => 'Group Members',
'page callback' => 'og_views_users_faces',
'page arguments' => array('og_members_faces', 'default', 2),
'type' => MENU_LOCAL_TASK,
'access callback' => 'og_menu_access_picture',
'access arguments' => array(1),
);

But this does not help.
I asked thsi here as well: http://drupal.org/node/992422

nigelcunningham’s picture

I think the og bug mentioned in the previous post is more appropriate.

There isn't really a bug in Views. $view->disabled does work, it just doesn't work as you and I might expect (returning a simple TRUE or FALSE).

Drake’s picture

So do you knwo hwo to redirect the link from og/users/%/faces.to for example og/%node/members???

merlinofchaos’s picture

Status: Needs review » Closed (won't fix)

$view->disabled has meaning only if $view->type == t('Default'). Currently views only controls the status of views that are not in the database. All views in the database are automatically enabled.

The code in views_get_view() should always set this field if $view->type == t('Default'):


   // The view does not exist.
  if (empty($view) && empty($default_view)) {
    return;
  }
  // The view is defined in code.
  elseif (empty($view) && !empty($default_view)) {
    $status = variable_get('views_defaults', array());
    if (isset($status[$default_view->name])) {
      $default_view->disabled = $status[$default_view->name];
    }
    $default_view->type = t('Default');
    return $default_view->clone_view();
  }
  // The view is overriden/defined in the database.
  elseif (!empty($view) && !empty($default_view)) {
    $view->type = t('Overridden');
  }

By default, views exports all views with $view->disabled = FALSE. So that flag SHOULD be set on all default views, and not be set on views in the database.