Skip to main content

Drupal 7: "Instant Update" for a View Creates "Post to Wall" Feel

Recently we were required to recreate a Facebook-style "Post to Wall" feel for the site's home page view.

Turns out the overlay module can create this nice effect, but you probably don't want to have it in use for all your node add/edits on a busy site, so there's a simple way to disable the overlay module based on paths:

<?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;
}
?>

Next you may want a rule to redirect to your view (home page in this case) after the content was added:

<?php
{ "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" : "\/" } } ]
  }
}
?>