This looks like a very useful little module. I like the way it's been designed to provide reusable functions that can be called by other modules/themes.

However I'd like to request the similarterms_list() function should take another argument to specify the type of the nodes returned. This is something I need for my current job, so I'll be patching your code accordingly and it'd be nice to know this feature was going to be added at some time in the future.

When I have it working I'll append the code here.

Comments

jjeff’s picture

I like this idea.

Keep in mind that you can get some of this functionality simply by assigning your vocabularies only to certain node types. For instance, if you have a vocabulary called "blog tags" that's only assigned to blog content, then page or story content items won't show up (as they won't have any matching tags in that vocabulary)...

However, I could see a use for this in certain cases. So I'll keep an eye out for your patch.

alfaguru’s picture

StatusFileSize
new1.55 KB

OK, patch attached. I'm passing in a single nodetype with a default of null. I could have used different vocabularies for different content types but that did not seem a natural solution. And the change is really very simple, although there might be a neater way to code it.

nath’s picture

This is something we need. We have multiple content types all using the same vocabulary but only node types from one content type should be displayed in one of the blocks.
Thanks for the patch, that does one part of the needed changes. I guess, in addition to this I need to change the block configuration so that one can choose the content type to be displayed.

nath’s picture

I have added the following code to the form configuration so that I'm able to chose a content type to display in the block.

    $form['type'] = array(
      '#type' => 'radios',
      '#title' => t('Display nodes of this type'),
      '#options' => node_get_types('names'),
      '#default_value' => variable_get('simterms_type_'. $delta, ''),
      '#description' => t('Only nodes of this type will be displayed in this block.'),
    );
Christefano-oldaccount’s picture

Status: Active » Needs review
StatusFileSize
new1.76 KB

The patch at #2 no longer applies and wasn't marked "needs review" (and the code in #4 wasn't in it anyway), and I hate to think this issue is disappearing into a black hole. I think the idea is a good one, though, and hope others will have a chance to see what all the excitement is about.

Christefano-oldaccount’s picture

Status: Needs review » Reviewed & tested by the community

I like this patch a lot. It works perfectly and doesn't disrupt any existing functionality. I'd like to have the option of selecting more than one content type, though. Currently the selection only allows one content type.

miiimooo’s picture

StatusFileSize
new1.93 KB

This version of similarterms adds supprot for choosing multiple content types AND the same content type as the currently displayed node is of.

Go into the block settings and select the content types you want the block to display.

Hope you find this useful.

Christefano-oldaccount’s picture

Status: Reviewed & tested by the community » Needs review

I'll test this soon (it would help if it were a patch, though). Thanks, miimooo!

Christefano-oldaccount’s picture

StatusFileSize
new3.45 KB

Here it is as a patch. I'll start testing it tomorrow or the next day.

Kripsy’s picture

The patch works great so far. My only concern right now is duplicating the "Similar entries from ANY vocabulary" block so that I can have different blocks for finding related material from different node types. Any ideas?

goosemoose’s picture

$form['type'] = array(
'#type' => 'radios',
'#title' => t('Display nodes of this type'),
'#options' => node_get_types('names'),
'#default_value' => variable_get('simterms_type_'. $delta, ''),
'#description' => t('Only nodes of this type will be displayed in this block.'),
);

This is exactly what I need to filter blocks but where did you add it?

jrabeemer’s picture

Awesomeness. Where is jjeff?

summit’s picture

Subscribing, +1 to get this in! greetings, Martijn

rmiddle’s picture

This sounds like a neat Idea.

Rob T’s picture

I'd love to see this in the 6.x version.

rmiddle’s picture

I need to do some testing before I can put this in. Leave open for review.

rmiddle’s picture

Status: Needs review » Fixed

Ok I lied it is in CVS and will be included in the 1.3 release.

Thanks
Robert

Anonymous’s picture

Status: Fixed » Closed (fixed)

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