Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I recently had a need for a sort of 'extended' node author field. Here's a patch to add a "Set to AUthor on Node Creation" option to userreference fields.
On node creation it ignores whatever the user entered (or, if the field is hidden by the content_permission module) and sets the value to the current user's UID.
Comment | File | Size | Author |
---|---|---|---|
author.patch | 1.8 KB | sean.mtm |
Comments
Comment #1
muschpusch CreditAttribution: muschpusch commentedHey,
i would need same functionality could you provide a patch for the current CCK version?
thanks Volkan
Comment #2
filpet CreditAttribution: filpet commentedYes please,
i need this functionality too!
The old patch does not work with the new version!
Kindly,
Peter
Comment #3
muschpusch CreditAttribution: muschpusch commentedI found another way to do this... Just add custom code to the default value of your CCK reference field:
global $user;
if($user->uid!=1){
return array( 0 => array('uid' => $user->uid) );
}
else return array();
Comment #4
mogop CreditAttribution: mogop commentedbut still shows other users.
any way to show only UID which is creating the node?