Hello,
I would like to create a list of a user related nodes according to a list of interests that the user has chosen before. I wanted to use views to achieve this, but I am having problems to set it up propperly.
That's what I did:
1. Install and configure Content Profile.
2. Create a vocabulary called "interests/targets"
3. Create a taxonomy field called "interests" (linked to vocabulary created before) in a content type using content profile that would be displayed in sign-up process.
4. Create custom content types with a taxonomy field called "target" which would share the same vocabulary ("interests/targets").
5. Create a block using views that would display current's user's content of interests, according to the taxonomy fields.
6. Provided that both content types and users share a content taxonomy field, I wanted to use it as an argument (it's the field called "Interessos" in the attached view) and as default value I chose "logged in user".
7. Since technically users don't have any taxonomy field (I had to use content Profile) I also used that field as a relationship and I made sure that the argument uses the relationship.
I think this makes sense to me but unfortunately it does not display any result. Hopefully someone can help me with this (see the export view below).
$view = new view;
$view->name = 'Recomanacions';
$view->description = 'Llistat de recomenacions de cursos, ofertes de feina o publicitat per a un usuari';
$view->tag = 'usuaris';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Per defecte', 'default');
$handler->override_option('relationships', array(
'content_profile_rel' => array(
'label' => 'Content Profile',
'required' => 1,
'type' => 'profile',
'id' => 'content_profile_rel',
'table' => 'users',
'field' => 'content_profile_rel',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'field_perfil_interessos_value' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'Tot',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'current_user',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 1,
'not' => 0,
'id' => 'field_perfil_interessos_value',
'table' => 'node_data_field_perfil_interessos',
'field' => 'field_perfil_interessos_value',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'3' => 0,
'9' => 0,
'4' => 0,
'5' => 0,
'6' => 0,
'8' => 0,
'10' => 0,
'7' => 0,
),
'relationship' => 'content_profile_rel',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'poll' => 0,
'ad' => 0,
'faq' => 0,
'long_answer' => 0,
'matching' => 0,
'multichoice' => 0,
'quiz_directions' => 0,
'scale' => 0,
'short_answer' => 0,
'truefalse' => 0,
'quiz' => 0,
'forum' => 0,
'book' => 0,
'curs' => 0,
'documents' => 0,
'empreses' => 0,
'links' => 0,
'ofertes_treball' => 0,
'page' => 0,
'perfil_professional' => 0,
'productes_llibreria' => 0,
'profile' => 0,
'story' => 0,
'ubicacio' => 0,
'videos' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
'4' => 0,
'16' => 0,
'3' => 0,
'6' => 0,
'7' => 0,
'8' => 0,
'13' => 0,
'15' => 0,
'5' => 0,
'9' => 0,
'10' => 0,
'11' => 0,
'18' => 0,
'12' => 0,
'17' => 0,
'14' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_is_member' => 'OG_VIEWS_DO_NOT_VALIDATE_MEMBERSHIP',
'validate_argument_group_node_type' => array(
'perfil_professional' => 0,
),
'validate_argument_signup_status' => 'any',
'validate_argument_signup_node_access' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status_extra' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status_extra',
'table' => 'node',
'field' => 'status_extra',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'ad' => 'ad',
'curs' => 'curs',
'ofertes_treball' => 'ofertes_treball',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Et pot interessar...');
$handler->override_option('empty', 'No tenim recomanacions (encara) per a fer-te.
Prova d\'afegir més interessos editant el teu perfil d\'usuari.');
$handler->override_option('empty_format', '1');
$handler->override_option('use_more', 1);
$handler->override_option('use_more_always', 0);
$handler->override_option('use_more_text', '[+]');
$handler = $view->new_display('block', 'Bloc: Interessos', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
Comment | File | Size | Author |
---|---|---|---|
#4 | content-type_Perfil.txt | 40.05 KB | c-c-m |
#3 | views_export.txt | 5.37 KB | c-c-m |
#3 | content-type_Curs.txt | 85 KB | c-c-m |
Comments
Comment #1
iamjon CreditAttribution: iamjon commentedc-c-m,
did you every find a solution for you problem.
I tried replicating your instructions but got a bit confused, can you please turn on content copy, and export your cck fields or provide a feature.
if you figured it out please update the thread so others can benefit, if not please provide more information.
Comment #2
iamjon CreditAttribution: iamjon commentedChanging status. Please feel free to reopen.
Comment #3
c-c-m CreditAttribution: c-c-m commentedHello iamjon,
I didn't see your message. Of course I will provide more info!
I attach two content types: "Curs" (Course) and "Perfil" (Profile, which is a node profile) and I also attach the view which has to relate both content types.
The idea is that since both content types share the same field (the taxonomy field: "Interessos/Targets") it would be "easy" (Although it's obvious I didn't succeed on it) to relate both contents, according to the logged-in user's interests.
Hope you have everything you need. In case something else I will gladly provide with the requested information.
Thanks for your help!
Comment #4
c-c-m CreditAttribution: c-c-m commentedOops, I forgot to attach the last content type export!
Comment #5
gawas.sachin CreditAttribution: gawas.sachin commentedI was stuck into the same problem since last few weeks.
But the solution was so simple.
Steps you can follow;
Create a "Related Node block" View , Just like shown in the tutorials on Drupal.org.
Then you can paste the code below, as an argument. Your argument will be a Taxonomy: Term ID
It should work, because it worked for me.
Comment #6
dawehnerThanks for giving the helpful information.
Marked as fixed based on #5