Drupal 7 - show view without a specific node id - drupal

I like to set a contextual filter with a NID that shouldn't show up in the result list when entered. However i can't find a way in drupal views. Is contextual filters the right approach?
Use-Case: Within a node, at the end of content there is a view loaded with more related topics to this node (they all share the same category). But, I don't like to see the current node within this view result.
How can I achieve this?
I am glad for every help. Thanks in advance!

Have the same problem years ago, and as far as I remember I've used Relevant Content. But for Drupal 7 there is only a dev version, so here is a comparison list of similar modules.
Also, check out this great answer - https://stackoverflow.com/a/11367731/1003329 I guess it's exactly what you are looking for.

Related

Drupal - How would I go about creating my own custom view?

What would be the best way of creating my own custom view?
I want to have my page do some specific stuff. For example, I am creating a search directory for different names. But, there will be 3 different types of search functions and I would like to toggle between them with 3 different tabs (each tab goes to a different search function). Would this be all in one view with then 3 blocks or multiple views selected by different tabs? What would be the best way of doing this?
One of the search functions will list all of the names alphabetically and there will be an alphabetical directory at the top that will bring the user to the corresponding letter that they select on the page. I believe that this will have to be a custom view that I will need to create, but I have never done anything like this before.
Does anyone have any good advice as to how I would go about doing this? Do I have to create my own module first? Are there any good tutorials out there that would help?
Thanks!
I'd recommend giving https://drupal.org/project/quicktabs a try. I haven't used it myself, but I know of others that have.
The project page sidebar has links to docu and a demo with some screenshots of config.
If you're going to be reusing almost all of the settings between blocks you'd want to create different blocks displays within the same view and override what you need to.

Implementing a "Like" button and showing users who clicked it

Our website is powered by Drupal 7 and we are looking for a way to implement a "I am Interested" button/link on a particular node for registered users. The problem here is that we'd also like to be able to display all the usernames who have clicked this button/link.
The idea here is to provide our viewers with a simple way to be able to indicate interest in a particular topic, and essentially giving them an outlet to communicate to other users who have shown the same interest.
I've tried a number of different modules that other sources have suggested: "Flags, Dlike, LikeBtn, Rate Widget, etc." and unfortunately they don't seem to ultimately do what I'm looking for. I want to believe that there is some combination of modules that can perform these actions, so I would greatly appreciate any guidance that can be provided.
I do apologize for my ignorance in this type of development. Looking forward to growing into this community.
Cheers.
You can achieve that with the Flag module (which you tried), and the Views module to display a list of users that have clicked the flag for a particular node.
Looks like this answer would help you out with the Views config to list users that have flagged a node (or poked a user in the example).

Drupal 7 - Administration - Find node by it's field value

I'm looking for the way for the site's administrator / moderator to find / filter the list of nodes by some field custom value. Field value could be defined by radio / text / checkbox etc.
Default content listing proposes only few filters, it's not enough for sites with huge amount of custom nodes.
Use an EntityFieldQuery object, documented here:
http://api.drupal.org/api/drupal/includes--entity.inc/class/EntityFieldQuery/7
The documentation has no examples (ugh), but there's a thread here with some:
http://drupal.org/node/916776
EDIT: Ah, you're talking about administration and not actually writing a module to do it. If that's the case, use a view with exposed filters, like the other guy said. :)
Maybe it would help to use a view for it, where you set filters, so that you get the desired listing.
I had to test this, but I've just confirmed. Views in Drupal 7 can indeed filter across multiple content types w/ custom fields, and still have filters apply to those custom fields. They seem to treat the nodes w/o those custom fields as empty or null values.
So for instance, I have article and blog content types. Blog has images, article does not. I can sort or filter on the image field, even though article doesn't have it. It simply assumes the field is null or empty.
This however, may not solve your problem of having a large number of custom fields. If these are dynamic (i.e. they grow over time) you might be in trouble. If, however, they are set, and just a very large number, you could manage this.
So while there is no automatic add all fields, which I believe you mentioned in a previous post, you could feasibly search on a large variety of the fields. Even exposing fields that you don't necessarily display in the table, but can then search on. Or changing the fields you expose or display on a per page basis in the view. All from one view. And then you could export the view to bring it over to the other sites.
I was going to try and attach the exported view, but the export is rather large for inclusion in an answer, I think. Please let me know if you think I should still include it, or if you'd rather I can simply send it to you through a PM. Let me know!
EDIT: I decided to include a link to an export of the view. http://greggalante.com/sites/greggalante.com/files/cross_type_view.txt
http://drupal.org/project/search_api

How can I filter node references to 'strictly own nodes' ? (Drupal 7)

On my drupal 7 site, I have a content type (artwork) that presents my users with a CCK field where they can specify what project (another content type) the node is referenced to (node reference module). The problem is that I can't seem to find a way to filter the options to 'own nodes only', so all the projects of all the users show up it in the list, and any user can just push his nodes on the nodes of another. I can still filter these nodes out with views on the output of the project node, but it's not very clean on the add/node form.
I found a module that is called 'CCK reference filter' that sounds like it should handle this situation, but it's not ported to Drupal 7.
So far I've gone pretty far without having to touch template.php and using hooks, and I would be very relieved if I wouldn't have to, since I'm hardly a php wizard... But if someone has any suggestions! Everything is welcome
Have a good day!
Bruno
(this is my first post here by the way, please tell me if I'm in the wrong place or anything)
The way to achieve that in Drupal 6 was to use a Views to filter the node that you can reference.
The goal for References module in Drupal 7 is to strictly have the same functionality as the D6 module. But References is still in developpment and it seems that this has not been implemented for now.
This issue seems to be very similar to what to want : http://drupal.org/node/1034042

How to add and relate a node within the parent nodes add form in Drupal

I want to accomplish the following scenario in Drupal:
You have 2 content-types. Lets say, an application-form for a lisence, and a content-type for persons.
Then when you go to add a lisence in the "node/add" submission form in Drupal, i would like to add a relative number of persons that would be related to this lisence, and only this lisence. Say you would like to apply for a lisence, and relate 4 persons to this lisence, then insted of creating the lisence and then create the 4 persons and relate them to the lisence, i would like to do this "inline".
So when i add a lisence, there would be a way to add 1 or more persons that would relate to the lisence node. Is this possible, and if so how?
I have been looking at the node reference module, and that manages to reference a node to another, but not to add them inline with the other.
With the web-development framework Django, there is a way to this with something called "inline-editing", where you get the content-type fields inside another content-type creation form. There you bind them togheter with a ForeignKey.
Anybody know of something simular in Drupal, if not, is it another way to achive something simular, that would be as user-friendly?
The Popups: Add and Reference module has recently been improved and I think it might do what you are looking to do.
Try Node Relationship, it will add buttons for edit/view/add next to the node reference field and will pop up a modal. Make sure you check the module dependencies.
I have looked into this, and it doesnt seem to be possible. I have looked at the reference_create module, and searched and posted stuff on drupal.org, and nobody have a nice solution.
So what I just rebuilt the whole thing in Django in about 3 hours; so, tomorrow I will try to convince my employer to go the Django way!

Resources