About Webdrips

Webdrips is a Web Development and Digital Consulting Agency specializing in the design and development of websites using Drupal and Wordpress technology. Our focus is to support the Open Source community and businesses community with helpful contributions in business and technology.

Let's Work Together

[email protected] 

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

  • Dan Harris

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:

Drupal rules example code

<?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;
}
?>
<br />
<p>Next you may want a rule to redirect to your view (home page in this case) after the content was added:</p>
<?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" : "\/" } } ]
 }
}
?>

TAGS : Code Example | Drupal