I am trying to use FC on a test site where I setup a "News" content type linked to two taxonomies: one to categorize news based on its content, and the other one based on the countries.

I setup a FC block that should be shown only on the "News" pages (in "Featured Content Visibility Settings"), and only list nodes of the same content type (I explicitely selected the news content type in the list in the "Content Type Filter Options filter").

But the block is shown also on my website homepage, the default "Promoted to frontpage" nodes list.
Is this by design?

Comments

kristen pol’s picture

Category: bug » support
Status: Active » Needs review

Perhaps you still have the:

"Use all content types"

radio button selected? If so, switch it to the:

"Use the content types selected below"

and don't choose anything in the selected list.

This is part of the UI that needs to be changed and is discussed here: http://drupal.org/node/705308

If you have suggestions to make this more obvious and user-friendly, please add a comment to that feature request.

Thanks,
Kristen

maxferrario’s picture

No kepol,
the "Use the content types selected below" radio button is selected.

But, as the problem could be related to my other filters, I attach a snapshot of the admin screen.

Massimo

kristen pol’s picture

Unfortunately I can't see attachment. I think it's due to some weird characters in the file name. Can you try renaming it to just letters and upload again?

Thanks,
Kristen

maxferrario’s picture

Here it is!

kristen pol’s picture

I looked at the settings and don't see anything in particular which would cause it to show on your home page. Is your home page a node page or a view page or the default Drupal node summary? Are you able to send me the URL or is it a private site?

One thing I did notice which I don't think would matter but who knows: for the taxonomy terms selected, if you are choosing to match the node page terms (rather than all), you'll need to change the radio buttons from:

"Use all xxx terms"
to
"Use the xxx terms selected below" (and don't select anything)

That is the same UI issue referred to previously.

Btw, how did you do a screen shot of the entire settings page?

Kristen

maxferrario’s picture

Unfortunately I cannot give you a public URL as I am developing the website on my home PC.
My home page is, for the moment, the default Drupal "node summary".

I will try to change the taxonomy terms matching as you suggested and see what happens.

I will also try to work with the FC module on a different installation here at work: I will let you know if I find a solution (or other "weird" behaviour).

Massimo

PS
the screenshot was taken with Firefox + FireShot extension

maxferrario’s picture

I looked to the module code, added some debugging and, though I am in no way a Drupal module programmer, I think there is a bug in the featured_content_view function.
After getting the block configuration with featured_content_get_block_data, the function tries to establish if the block has to be shown on the current page with the following code:

  // check visibility settings to see if block should be shown
  $show = TRUE;
  if ($type == null && arg(0) == 'node' && is_numeric(arg(1))) {
    // only check on node pages for now
    $this_node = node_load(arg(1));
    if ($this_node->nid) {
      if (! empty($featured_content['visibility']['content_types']['selected']) &&
          ! in_array($this_node->type, $featured_content['visibility']['content_types']['selected'])) {
        $show = FALSE;
      }
      if (! empty($featured_content['visibility']['users']['selected']) &&
          ! in_array($this_node->uid, $featured_content['visibility']['users']['selected'])) {
        $show = FALSE;
      }
      $vocabularies = taxonomy_get_vocabularies();
      foreach ($vocabularies as $vocabulary) {
        $vid = $vocabulary->vid;
        if (! empty($featured_content['visibility']['vocab'][$vid]['selected'])) {
          $tid_intersect = array_intersect(
              $featured_content['visibility']['vocab'][$vid]['selected'], 
              array_keys($this_node->taxonomy));
          if (empty($this_node->taxonomy) || empty($tid_intersect)) {
            $show = FALSE;
          }
        }
      }
    }
  }

When the default Drupal homepage is shown, the code evaluates the condition in the first if and find it FALSE, because arg(1) is empty. So, as you set the default value of $show to TRUE, the block is shown.
But this is not the expected behavior, as I set the block visibility settings to only show the block on specific content types.

kristen pol’s picture

Ah! Good job :) Yes, it should check if some of the visibility settings are chosen and, if so, it should default to false. I have it defaulting to true in case there are no visibility settings chosen, but that is not true in your case.

I'll try to fix it right now.

Thanks a ton,
Kristen

kristen pol’s picture

Ok, I just checked in a fix. I did a quick test and I think it's working but please verify when you get a chance. It will be in the next *dev* version once the drupal cron runs.

Thanks!
Kristen

kristen pol’s picture

Assigned: Unassigned » kristen pol
Category: support » bug
maxferrario’s picture

Thanks Kristen,
now the block is shown where expected.

maxferrario’s picture

I think that the FC block should not be shown when a page is edited.

I propose to change one line in your code from

  if ($type == null && arg(0) == 'node' && is_numeric(arg(1))) {

to

  if ($type == null && arg(0) == 'node' && is_numeric(arg(1)) && (arg(2) != 'edit') ) {

Massimo

kristen pol’s picture

Status: Needs review » Fixed

I just checked in a change so it won't show up on the edit page.

I appreciate your feedback and welcome any more you have.

Thanks,
Kristen

kristen pol’s picture

Status: Fixed » Closed (fixed)
kristen pol’s picture

Assigned: kristen pol » Unassigned
Issue summary: View changes

unassigning old issues