Basically the idea is that I would like to allow users to edit their nodes, but only give them a fixed amount of time to do so. The reason is being that a user can fix typos or make small changes within a given time, while not allowing them to make any changes... say after a day or two.

Comments

lyubchick’s picture

I need this also, for drupal 6.x version.

walker2238’s picture

Hey lyubchick... I did manage to get this done. Although I'm sure theres a better way to do this, such as making a module of by overriding a theme function. But here is what I did.

I basically created a view to show a user his or her nodes. in the view I used a field to edit and another to delete each node. so say after x amount of time the edit link gets replaced by the delete link. You also either have to apply this to all other links. I did this just by only showing tabs for admin users only.


global $user;

$node = node_load($node->nid);

if ($node->created > (time() - (36000)) && $user->uid != 0 && $user->uid == ($GLOBALS['user']->uid) || $user->uid == 1) { 

php print $edit;

} elseif ($node->created <= (time() - (36000)) && ($GLOBALS['user']->uid) != 0 && $user->uid == ($GLOBALS['user']->uid)) { 

php print $delete;

} 

thanks basically it. all you need is the node created time, and you can replace 36000 with whatever time you wish.

If you have any questions just ask, but basically just create a view.... theme the view. add the snippet to the edit or delete links and test it out. I used this for D5 but have since moved on to D6 and have converted this, although I'm not sure in this case you need to change anyhting. I'm not sure I'll take a look at my other snippet if this doesn't work. You have to change the user variable to account though.