I have a site where there can be more than one node author. My solution to this is a custom user reference field called additional authors, added to my content type. So if three people wrote an article, the person who publishes it, enters the other two into this additional authors field.
The problem I have is the following:
I'm trying to create a page (with Views) with the listing of all author's nodes - these can be either nodes where he is author OR nodes where he is referenced under additional authors. I want the author to be specified in the url (mysite.com/people/john-smith), but if I use contextual filters in Views, I can't seem to find the option to use OR - e.g. take author ID from url and show nodes where he is author of OR nodes where he is under additional authors.
I don't see any problem here:?? why you don't add the 'authors field' to your fields?
If you don't find it by the normal way look for it in 'Relationships'
Goodluck
Related
I've just started learning Drupal 7 and I'm stuck on a problem.
I want to relate different content types using taxonomy. For example, how can I display blogs related to an article?
I know how to relate articles and basic pages but I don't know how can I relate blogs with articles?
Please help me.
Use reference field in blogs content type
like
field name is: related with
field type is reference
set reference type node
set node type is article
optional multivalued true
Now you have a relationship field in blogs
Now you can do every thing with this relationship
Hope this make sense
Thanks
You would create your taxonomy vocabulary and supply it with terms. On its own, this doesn't do anything, you need to add a field to each of your content types that are using this taxonomy.
If you go back to your content types, structure > content type > article. Here you would create a new field of type term reference. Inside the settings of the field you'd select your vocabulary and then also the widget eg. select list. You can re-use this field on the other content types where you want to share this vocabulary.
If you go back to your content for the types you added this field for and populate them with selections, when you view that page by default the term will appear as a link. If you click this link it will take you to a page view that will list all the other nodes that have that term form that vocabulary.
More information on taxonomies: https://www.drupal.org/docs/7/organizing-content-with-taxonomies/about-taxonomies
If you are creating a view and want to know how to pull in different tagged content there, I'd recommend reading this post which outlines the steps to do so https://drupal.stackexchange.com/questions/205921/how-do-i-show-related-content
The process:
Basic stages:
Create a “Content” view-block.
Add a contextual filter: “Has taxonomy term ID”.
Choose “provide a fixed value”.
(From type): “Taxonomy term ID from URL“.
Checking:
• Uncheck “Load default filter from the term page”. • Check “Load
default filter from node page, that’s good for related taxonomy
blocks”.
• Check “Limit terms by a vocabulary”. • Check your desired
vocabulary.
Select “Filter to items that share any term”.
Go down and check “Reduce duplicates”: This will several terms that relate to the same page – To appear. Only one will of them will.
Here is the situation:
I am working on a Wordpress-driven site
on which front-end users should be able to create Authors
and once on the Author's page,
add Books that the Author has written.
To do so:
I have created two custom content classes (Author, Book)
I have used the Advanced Custom Fields plugin to create a 1-to-many relationship between the two. The field is a custom field of the Author, listing the Books that Author is "related" to
I have used User Submitted Post Pro plugin to create the two forms needed. The first to create a Author and the second, placed within the Author detail page, to add a Book.
My issue is double:
How do I pass the Author id to the Book creation form?
How do I, upon creation of a new Book, update the relationship field of the corresponding Author?
I am also willing to hear I am taking this the wrong way.
Your input is very welcome.
Thank you.
Axel
(I am not providing the code in this answer, but can write it if required)
Because this is a 1 to many relationship between author and Book here is the best way to achieve this -
Create a custom Taxonomy called "book_author".
Create a custom post Type "Books" and link the taxonomy 'book_author' to it.
Create custom front end form to create the new Authors (Taxonomy terms) in Book Authors (Custom Taxonomy)
Create a front end form to create Books (custom post).
When the Create Author form is submitted and author is created redirect the user to create book form with the author_id (term_id) in url. something like http://example.com/create-book/?author_id=1
Use this author Id to associate the book with it. You can use this wordpress function to associate a custom post with a term https://codex.wordpress.org/Function_Reference/wp_set_post_terms
So if I have 2 custom content types book and review, I'd like a user(when viewing a specific book) to be able to create/attach a review to the book.
I've tried a few options.
1) Created a "create review" formblock and using panels made a custom node view panel for review, but I couldn't get the relationship to work.
2) I also tried overriding comments on the book type with the node type review, the problem with this is I'd like users to be also be able to comment on the book and I couldn't see the ability to add multiple comment types.
This seems pretty easy to do on node edit with node reference extension so I'm hoping this isn't a big ask.
You need nodereference and nodereference_url modules.
You can simply create a nodereference field in your review content type, and configure it with nodereference_url widget.
You partially answered your own question. With the nodereference module in D6 (or just references in D7), you can create a link in the same place 'add a comment' appears (the .links div) which says "add a review". This link is because "reviews" has a field called something like "book reference" which is a noderef field. This review will automatically fill in the field with the book where the user clicked the link and, depending on how you set the field up, send you back to the referenced node (book) or the new review.
You can find an interesting screencast there that show how to use Views Attach and Node Reference URL to do what you want :
http://mustardseedmedia.com/podcast/episode37
I have a parent/child relationship (based on the cck node reference field).
Recipe Group contains a node reference to the type Recipe. It's a 1 to many relationship.
What I need to do is create a view that displays the recipe group information, and then under it, the recipes that have been assigned to it's cck field.
So
RecipeGroup1 - Title
Recipe1, Recipe2, Recipe3
RecipeGroup2 - Title
Recipe4, Recipe5, Recipe6
etc etc
I've created the view to pull the list of recipe groups.. but I have no idea how to retrieve the recipes that belong to the group?
I've tried googling, but we are on a tight time line and would appreciate any assistance.
Thanks.
Take a look at http://drupal.org/project/views_field_view. It lets you combine two views (groups, recipes), inserting the recipes view as a field into the groups view. Using this, you can have as many fields as you want for the group.
You can use the Views attach module to associate a view with a specific content type and display that view on that content type's node page.
There is a webcast here that demonstrates how the module can solve a problem similar to yours.
However, the webcast assumes your nodereference CCK field is on the child content type and is pointing to the parent content type, not the other way around like you have it.
Instead of using the nid of the recipe group as an argument to the view (as shown in the video) you may be able to use one of the recipe group's tokens (the nodereference field referencing its children). You can see that option at 9:32 in the video.
Whatever you decide to do, I think Views attach will likely be your answer.
Include the cck reference node field as an output field to your view. After, you can 'rewrite the output of this field'.. so that it looks however you want.
add noderefernce field in to views fileds
select check box to group field result in node ref field settings
theme that field as you want
I have to create a simple company blog within drupal-6. That means there should be only one single blog each user can post into.
What i have done so far is to create a custom content Type (blog) and a view that displays teasers of the recent blog entries with links to the full blog post.
Now i have to create a Tag-Cloud for this blog.
I created a taxonomy vocabulary for this "blog" content type and set the settings to Tags (Terms are created by users when submitting posts by typing a comma separated list.)
I also installed the Tagadelic Module and created a tag cloud with it, that works great and it displays all the Tags i entered when creating new blog entires.
But now to my problems:
First: If i click on an entry in this tag-cloud the default Taxonomy_term view is used to display the resulting blog entries. Thats bad because i would like to have it displayed the same way as in the view i already defined to show the blogs. Is there a way to use my view to display the results of the tag-cloud?
Second: On my view, below each blog-teaser should be a link to related blog entries (the ones that share the same terms). I do not have a clue how to do that.
is this even possible with the setting i have now or should i maybe take a whole other approach to create that company blog with tag clouds and related blog entries?
You should be able to solve both problems pretty easily, while keeping your current approach:
Take a look at your views list ('admin/build/views/list'). You should see a view called 'taxonomy_term (default)', which is usually disabled by default. This is an optional override of the built in taxonomy term page. You can enable this and configure it to look like the blog view you created.
Alternatively, you could leave that one disabled, but add another display of type 'page' to your already existing blog view, and configure that as an override to the built in taxonomy term. For this you'll need to set the path of that display to 'taxonomy/term/%' and adjust the display to use the term id argument as a filter (look at the above override for how this works).
You could also do it the other way round - use the default taxonomy_term override view, configure its output according to your blog view needs, and add another display for your recent blog entries to that. After this, delete your own blog view and use the new display of the taxonomy term override instead.