Requirement: a user views another user, and then creates a node of a specific type while still viewing the user's profile page (I'm envisioning some modal form for the node creation but I'll work this out later...).

Is there a way to tie together the two users and the created node? Is this something relation can do, perhaps using Rules as well?

Will be grateful for all comments/suggestions. Thanks

Comments

freality’s picture

I imagine you'll be creating a custom module for your modal page. In that case, your hook_menu could be:

function example_menu() {
  $items['example-custom-modal/%user/%ctools_js'] = array(
    'page callback' => 'example_ctools_modal_page',
    'page arguments' => array(1, 2),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

You can generate your modal url's to include the profile page's user id; like http://example.com/example-custom-modal/<profile-page-user-id>/nojs. From there, it's the same as any form processing. Check out http://deeson-online.co.uk/labs/insert-form-pop-modal-ctools-and-drupal-7 for example modal code.

bunthorne’s picture

Your question is not very specific. You mention "tying together" 3 pieces of data, but there are many ways to tie together data. You mention two users and a content page; as far as I can tell, you only need two Entity Reference fields on the Content type for the two Users you are linking to the page. You haven't described a reason that you need to make some relationship between two nodes that has its own fields to describe it.

You can use Views to pull items together for display, obviously. So ask yourself, what is this new Entity Type I am trying to create that links two users and a Content page?

mttjn’s picture

Status: Active » Closed (fixed)