Hi Joachim,

Sorry it took so long, tortoise CVS didn't work for me in work! :/

Hope this patch is ok, if not, let me know and I'll do some extra work, as I said before I'm new to this.

Also, could you share some advice on how we could incorporate an example 'user reference' view with this patch. I have one but don't know how I can supply it to you, nor if it's even necessary for you?

Let me know, many thanks,
Jonathan

Comments

jonthomas83’s picture

StatusFileSize
new1.62 KB
Rosamunda’s picture

This seems just what I need! Is this ported yet?
Thanks!

Rosamunda’s picture

Erm... nope, it doesn´t look like it has been ported yet.
Is anyone using this patch in live sites?
THANKS!
Rosamunda

Rosamunda’s picture

I can´t get this to work... I´ve patched the module and followed all instructions...

Rosamunda’s picture

I´ve made the installation all over again, and still no way of using this with userreference fields...

jonthomas83’s picture

It works but you'll need to create a new view, one that references users in the same way as the demo view (packaged with the nodereference views module) references nodes.

I have this working but not on a live site, works perfectly. It''s been a while since I did it but if anyone needs any advice I'll try and help.

Hope that helps.

media desktop’s picture

Hey Jonathan,

it doesn't work for me. What type of view should I use? Type Node or Type User? Which argument in the view Node ID or User ID. Something else I have to change?

Thanks,
Denis

jonthomas83’s picture

Hi media desktop,

Using the nodereference_view "example view" as a reference (that is a Type Node). You need to create a similar view but it should be of Type User, and everything should be changed from Node ID (as used in the example view) to User ID.

If you're still having trouble, let me know and I'll see if I can get you a copy of my view settings, I'll be back in work Monday and will be happy to help you out.

Many thanks,
Jonathan

media desktop’s picture

Now it works :-) Thanks a lot, Jonathan.

jonthomas83’s picture

Glad you got it working media desktop! :)

jwilson3’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new1.71 KB

I realize the module name inherently limits the scope of this module, however it makes little sense to me to copy the entire module, when a small patch would extend this to work for both nodes and users.

So, here is a patch that improves upon the work done in #1, and expands the functionality of nodereference_views to include both node reference and user reference CCK fields.

Assuming there would be a d7 version coming down the line for this module, maybe it makes sense that the module be extended to entityreference_views (supporting any kind of object reference ;) If so, then this patch would be the way to work out a meaningful backport for such functionality to D6.

jwilson3’s picture

Title: Created patch to support 'User Reference' field. (i.e. userreference_view) » Support user reference views (i.e. userreference_views)

Feature request title cleanup.

jonthomas83’s picture

jrguitar, awesome work I'll try it out when I get the opportunity on another project!

+1 for getting this into the module

jwilson3’s picture

Version: 6.x-1.2 » 6.x-1.3
StatusFileSize
new1.66 KB

Re-roll for latest D6 version threw off line numbers.

Renee S’s picture

Patch in #14 worked for me. Lovely! Thanks for a great little module.

Renee S’s picture

If you're using CCK3 with multigroups, the multi-group-specific function also needs to be altered, in a slightly different way:

function theme_nodereference_views_formatter_views_single($element) {
  // Don't use views_embed_view so we can return an error if the view can't be found.
  $view_name  = $element['#field_name'];

  // We get here even if the field is empty, so check that the value is not a proper nid
  // and return nothing so the label is not shown.
  if ($element['#item']['nid']) {
	  $args[]     = $element['#item']['nid'];
  }
  elseif (isset($element['#item']['uid'])) {
	  $args[]     = $element['#item']['uid'];
  }
  else {
    return;
  }

  $view = views_get_view($view_name);
  if (!$view) {
    return "Error: view $view_name not found.";
  }

  return $view->preview('default', $args);
}

(Didn't roll a patch because tl;dr. I will in a week when I get my environment set up properly. Until then... hope this helps :)

joachim’s picture

Project: Node reference views » Reference views
Version: 6.x-1.3 »

Moving this to a new project, where I'm about to commit this patch :)

joachim’s picture

Status: Needs review » Fixed

Committed a modified version of this patch. This is now available in the 6.x-2.0 release :)

Thanks to everyone who's worked on this, and sorry it's taken me so long to work on it!

joachim’s picture

Version: » 6.x-2.0

@Reinette: could you take a look at #1190352: CCK3 multigroups please?

Renee S’s picture

Awesome, will do :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.