0

I have a view with appointments displayed at the user profile page (using pages for this) that is specific to that user.

While adding a node (appointment type) I can select the user(user reference) that the appointment is made with.

Now, I would like to add a link at the bottom of that view so I can add a new appointment and at the same time pass in the user id/name of the current viewed user, so I don't have to manually select the user again.

Any suggestions?

1

If you're using "Entity reference" module for the user reference field, you could use http://drupal.org/project/entityreference_prepopulate module which allows to set the entity id with an URL parameter.

For example, if the field name is "field_user_reference", and the entity you're creating is "appointment", you'll have to generate a simple link like:

node/add/article?field_user_reference=UID

Instead, if you're using "References" module, you can install and enable http://drupal.org/project/userreference_url which does the same, although the syntax is a bit different:

node/add/article?user_reference=UID

I hope this will help.

  • I second these two options. – filmoreha Mar 26 '14 at 8:59
0

I was going to make a similar suggestion as FiNeX, suggesting that you place a "Global: Text area" in the footer (or header if you prefer), using tokens to drop in field values, such as the user id, and thus form your own URL. I believe it would be also possible (perhaps preferable) to use the Global PHP via the Views PHP module. so you can select the current user's UID, or add any other data that you can pull in via PHP and the Drupal API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.