I've created two cck-types (myprofile) and (favouritewriters)
I use the first one(myprofile) as userprofile and it works fine with usernode-module and nodeprofile-module.
The second cck-type (favouritewriters) is connected with a freetagging-category "writers".
Every new entry of this category uses a new authorname as subcategory like this:
Category "writers"
--- Shakespeare
--- Pessoa
--- etc.
At the contenttype (myprofile) there's a field called (field_favauthor)
Now I want to create a view, that lists entries of the category "writers" but filtered (Taxonomy: Terms for Writers) by the field (field_favauthor) depending on the actually viewed profilepage. I've tried to manage, but I've failed. I've tried to use nodereference, but it failed. Now I first tried to list the uid and the username of the actually viewed profilepage inside my view(blockview) and that works:
(php)
$x = arg(1);
$account = user_load(array('uid' => $x));
$readname = $account->name;
echo $readname;
$readuid = $account->uid;
echo $readuid;
(php)
But how do I get the value of (field_favauthors) from content type (myprofile) of the actually viewed profile into the view to list only entries with authors the actually viewed member likes?
Do I need a custom module, or do I need sql-queries. I am a php-newbee and a little bit confused with views.module.
I am looking forward for every hint.
Ich habe mit cck zwei neue contenttypes erstellt (myprofile) und (favouritewriters).
Den ersten contenttype (myprofile) nutze ich in Verbindung mit usernode und nodeprofile als Userprofil.
Der zweite ist einfach ein neuer Inhaltstyp, der mit dem Freetaggingvokabular "Writers" benutzt wird.
Jedem neuen Beitrag (favouriteauthors)/Kategorie "Writers" wird bei der Erstellung als neuer Subterm ein Autorenname zugefügt, bzw. wenn dieser Term schon besteht, sieht der User dies im Autocompletefeld. So sieht die Taxonomy der Kategorie Writers also so aus:
Writers
-- Shakespeare
-- Goethe
-- etc...
Bei meinem anderen neuen CCK-Contenttype (myprofile) gibt es ein Feld namens field_favauthor.
Nun möchte ich eine View erstellen, die alle Beiträge der Kategorie "Writers" listet, aber bei den Filtern
(Taxonomy: Terms for Writers) den Wert des Feldes field_favauthor basierend auf der uid des aktuell angesehenen Userprofils übernimmt. Ich habe nun einige Versuche mit nodereference gestartet, die aber alle gescheitert sind.
Das auslesen der UID oder des Usernamens des aktuell angesehenen Profils klappt in der View(Block) soweit schon einmal.
(php)
$x = arg(1);
$account = user_load(array('uid' => $x));
$readname = $account->name;
echo $readname;
$readuid = $account->uid;
echo $readuid;
(php)
Natürlich ist auch die Listung aller Beiträge von bspws. Shakespeare kein Problem, wenn ich manuell Shakespeare beim Filter (Taxonomy: Terms for Writers) eingebe, aber wie bekomme ich es hin, dass das Feld (field_favauthor) des contenttypes (myprofile) basierend auf der UID, oder des Usernamens des aktuell angesehenen Profils in den Filter der View übernommen wird? Benötige ich dazu am Ende ein custom.module, oder SQL-Queries? Ich bin absoluter PHP-Newbie und mit drupal auch noch nicht so vertraut und freue mich über jede Hilfe.
Comments
Comment #1
drupov commentedGood question! I'm interested in a similiar solution for views 6x. There is a module that does filtering through php - http://drupal.org/project/viewsphpfilter - but it is meant to be used only for nodes views, not users...
Comment #2
esmerel commentedNo real work is going into the 1.x line; you should try to do what you're looking for in 2.x.
Comment #5
ash0815 commentedDanke dir, den Code habe ich gesucht :-)
Hatte es eigentlich inzwischen bei dir funktioniert?
Thanks you, this code I was looking :-)
Had it actually works for you now?
Comment #6
dawehnerPlease don't hijack old issues...