| 1 |
<?php |
<?php |
| 2 |
// $Id: content_refresh.module,v 1.6 2008/09/10 20:53:57 yaph Exp $ |
// $Id: content_refresh.module,v 1.7 2008/09/10 21:06:52 yaph Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 101 |
* Implementation of hook_comment(). |
* Implementation of hook_comment(). |
| 102 |
*/ |
*/ |
| 103 |
function content_refresh_comment($a1, $op) { |
function content_refresh_comment($a1, $op) { |
| 104 |
switch ($op) { |
global $user; |
| 105 |
case 'insert': |
// check wheter user is anonymous and is allowed to post comments without approval |
| 106 |
case 'update': |
if (0 == $user->uid && user_access('post comments without approval')) { |
| 107 |
$nid = $a1['nid']; |
switch ($op) { |
| 108 |
break; |
case 'insert': |
| 109 |
case 'unpublish': |
case 'update': |
| 110 |
case 'delete': |
$nid = $a1['nid']; |
| 111 |
$nid = $a1->nid; |
break; |
| 112 |
break; |
case 'unpublish': |
| 113 |
} |
case 'delete': |
| 114 |
if ($nid) { |
$nid = $a1->nid; |
| 115 |
// retrieve the absolute url for the node |
break; |
| 116 |
$options = array('absolute' => TRUE); |
} |
| 117 |
$url = url('node/'. $nid, $options); |
if ($nid) { |
| 118 |
// delete cache entries for that url |
// retrieve the absolute url for the node |
| 119 |
cache_clear_all($url, 'cache_page'); |
$options = array('absolute' => TRUE); |
| 120 |
|
$url = url('node/'. $nid, $options); |
| 121 |
|
// delete cache entries for that url |
| 122 |
|
cache_clear_all($url, 'cache_page'); |
| 123 |
|
} |
| 124 |
} |
} |
| 125 |
} |
} |