2

I have a requirement that I'm not sure how to go about implementing. The flow goes something like this:

  1. User clicks button: share your update
  2. Popup window opens
  3. User fills in form and clicks Save
  4. View is updated immediately to reflect update

I'm thinking I'll need a new content type for updates since the view being updated is for node content, not comments.

Anyway, I think I'll need to AJAX-load the node/add form, then somehow trigger the view to update upon saving the node. Perhaps it will work by using the Overlay module? (Note: I would only want the Overlay to be used in this one specific case.)

Anyone done this that can provide some pointers and/or some links?

Thanks,

Dan

1 Answer 1

2

Wow this was not all that difficult after all.

The following forces the overlay to only be used for my desired node type and admin pages:

<?php
  function yourmodule_admin_paths_alter(&$paths) {
  $paths['node/add/user-update'] = TRUE;
  $paths['user'] = FALSE;
  $paths['user/*'] = FALSE;
  $paths['users/*'] = FALSE;
  $paths['node/*/edit'] = FALSE;
  // Add this for each content type you don't want the overlay to be used for.
  $paths['node/add/other-types'] = FALSE;
?>

Then I needed a rule to redirect to my view (home page in this case) after the content was added:

{ "rules_redirect" : {
"LABEL" : "Redirect to home page",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules" ],
"ON" : [ "node_insert" ],
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "node" ],
      "type" : { "value" : { "user_update" : "user_update" } }
    }
  }
],
"DO" : [ { "redirect" : { "url" : "\/" } } ]
  }
}

The combination of the two makes it appear as if the user is adding a "quick update".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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