I wanted the ability to let users have node references as profile fields. I coded a new field type (node_reference) into the module. The new code allows user to:
1. create a profile field of type node reference and select which type of node can be referenced
2. populate that field in a profile with a selection from a pulldown containing all nodes of previously selected type
3. view this new field in profile (displays node title as a link to the node)

This is my first module work so the code needs review for style. I am also open to feedback about what I can do better. Also, I was unable to get the pulldowns to work for multi-select completely; help there would be appreciated.

Comments

michelle’s picture

Title: Added functionality, would like to contribute » Add nodereference field to profile module
Version: 5.6 » 7.x-dev

That sounds pretty cool, but the next version to get new features will be 7.x. I bumped the version and gave it a better title. You may want to check that your patch still works against 6.x as that's what will become 7.x.

Michelle

jasonsafro’s picture

Title: Add nodereference field to profile module » Added functionality, would like to contribute
Version: 7.x-dev » 5.6
StatusFileSize
new4.43 KB

Previous patch file seems to have picked up every line as different. I'm guessing that dreamweaver changed all the newline characters. I re-wrote the changes in vi and generated a new patch file. This latest one seems to be the correct size and contents.

jasonsafro’s picture

Title: Added functionality, would like to contribute » Add nodereference field to profile module
Version: 5.6 » 7.x-dev

Michelle,

Heh... didnt mean to overwrite your changes. We were both posting at the same time. I'll test this against v6. If you have a minute, could you do a quick code review for style and logic?

Thanks!
Jason

michelle’s picture

I'm pretty new at Drupal coding so I'm not a good one to review. There's plenty of time, though. 7.x is likely a year away and it's possible that profile will be replaced in 7.x.

Michelle

mepushpendra’s picture

Thanks a ton for posting this patch....I was in need of this and i am happy to say that it has solved my problem. This patch is working properly. Please try to make this nodereference field multiselect.

catch’s picture

Status: Needs review » Postponed

The patch has a bunch of stuff commented out. Additionally, D7 is very likely to have fields in core, and nodereference can be handled by the various profiles as nodes options in contrib. So while this would be a good thing, I think it's best to get it in after fields in core has landed so it can take advantage of the new API (rather than overloading an old crusty one).

Freso’s picture

Also, for your further education, else if should be elseif and it should be

 }
else { 

not } else { . There's also a bunch of misplaced white-space. Take a look at the Coding standards for what Drupal code should look like. :)

baxterjones’s picture

Issue tags: +Newbie

hi, all
i used the initial first patch posted by jacen6678, and it does exactly what i wanted.
great work, keep it up

for those who don't know what i wanted.
i wanted to reference a node with a profile field :D

aaronelborg’s picture

snowvirus,

What version did you get this to work in?

Also, did you do it manually? Or using 'patch' in the command line?

Thanks.

petermilad’s picture

Status: Postponed » Needs work

I need it for Drupal 6. it's not working with me on drupal 6

michelle’s picture

Status: Needs work » Closed (duplicate)

This won't happen for D6 and it's too late for D7. There's already an issue for making profile in core use fields but that's been pushed off to D8.

Michelle

JayKayAu’s picture

Can this be turned into a contrib module for D6 and D7?

I imagine it'd be a small module, but would be really useful.