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

Share this post

Comments (0)

Leave a comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Image CAPTCHA
Enter the characters shown in the image.