|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
tying user and content_profile together in a view or moduleI'm using content_profile, and need to have an admin user report that
lists user info including the profile fields. It seems that content_profile exposes itself in some templates, but not as a global (such as $user) or to views. If I create a user view, I can't get to the content_profile node I think, and vice-versa. Any thoughts would be appreciated! |
|
|
Re: tying user and content_profile together in a view or moduleOn Wednesday 28 October 2009 11:40:30 pm Jeff Greenberg wrote:
> I'm using content_profile, and need to have an admin user report that > lists user info including the profile fields. It seems that > content_profile exposes itself in some templates, but not as a global > (such as $user) or to views. If I create a user view, I can't get to the > content_profile node I think, and vice-versa. Any thoughts would be > appreciated! From a content profile node, that node's owner is going to be the user for which it is a profile. From a user, there is a Relationship handler for the content profile module that can get you to the corresponding node, from which you can then pull fields. Sadly I don't know of a full-on relationship handler from nodes to their users, which would let you get from an arbitrary node to its owner to that owner's profile nodes. But I have been wrong about such things before. :-) -- Larry Garfield larry@... |
|
|
Re: tying user and content_profile together in a view or moduleOn 2009-10-29, at 12:40 AM, Jeff Greenberg wrote:
> I'm using content_profile, and need to have an admin user report > that lists user info including the profile fields. It seems that > content_profile exposes itself in some templates, but not as a > global (such as $user) or to views. If I create a user view, I can't > get to the content_profile node I think, and vice-versa. Any > thoughts would be appreciated! Content profile works fine with Views; be sure to create a relationship from the user account to the profile node. |
|
|
Re: tying user and content_profile together in a view or moduleOn 2009-10-29, at 12:57 AM, Larry Garfield wrote:
> Sadly I don't know of a full-on relationship handler from nodes to > their > users, which would let you get from an arbitrary node to its owner > to that > owner's profile nodes. But I have been wrong about such things > before. :-) You can do n*way relationships, but I'm sure the performance sucks with many relationships (as they are usually cross-table joins). You can "chain" relationships in the UI just be selecting a pre-existing relationship. In your case, I don't think you even need 2 relationships. Build a node view, create a relationship of "Node: content profile" and it will join on the content profile of the author of each node. I got the following query showing me a view of all book pages and the title of their author's content node: SELECT node.nid AS nid, node_users.title AS node_users_title, node_users.nid AS node_users_nid, node_users.language AS node_users_language, node.title AS node_title, node.language AS node_language FROM node node INNER JOIN users users ON node.uid = users.uid LEFT JOIN node node_users ON users.uid = node_users.uid AND node_users.type = 'profile' WHERE node.type in ('book') |
|
|
Re: tying user and content_profile together in a view or moduleThanks Andrew and Larry, I'm part-way there now. There's a third step,
which is where it's failing. What I'm trying to achieve is a basic (on any billing system) customer report. So it needs the e-mail (user), profile info... and (third step) their address, which is kept in the Ubercart order. So, I did a node view. Filtered on Profile content type. Added (for testing) the user email field. And all is well. Then, time for the address info. I tried first without relationship to add the Payer Phone from the field list (since it was offered). Got a SQL error of the bill-to-phone column being unknown. Ok, so then I added a relationship for Order UID, and received "ambiguous field order_uid. So I added Order UID in the fields list, and the error went away. Oddly, the Payer Phone did not offer a relationship when I did that, and I still got an unknown column for bill-to-phone. Then I tried making the relationship to the Profile instead (odd that it offered that, since I was starting with the profile). Now, the Payer Phone offers a relationship, but when i select it, I get an SQL error of unknown field node_users__uc_orders.nid. |
|
|
Re: tying user and content_profile together in a view or moduleOn 2009-10-29, at 9:25 AM, Jeff Greenberg wrote:
> What I'm trying to achieve is a basic (on any billing system) > customer report. So it needs the e-mail (user), profile info... and > (third step) their address, which is kept in the Ubercart order. It's worth playing around with the ordering of the relationships. I had some strange issues with relationship ordering between MySQL 4 and MySQL 5. --Andrew |
|
|
Re: tying user and content_profile together in a view or moduleAndrew Berry wrote:
> It's worth playing around with the ordering of the relationships. I > had some strange issues with relationship ordering between MySQL 4 and > MySQL 5. > > --Andrew > I've put a support request in on the Ubercart end. There is only one relationship... I'm creating a node view, filtered on the content profile node, and accessing the user information in it by the fact that the creating user's e-mail is offered, and that will be the user whose profile it is. So the only relationship I create is to Order UID. As soon as I do that, I get an sql error. Similar results if I instead create a relationship to Order Payer Zone (which I need, because for some reason the State is not an address field offered, a whole other tale). Thus, there's no rearranging of relationship order possible, since there's only 1. Jeff |
| Free embeddable forum powered by Nabble | Forum Help |