Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7176077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:26:07+00:00 2026-05-28T16:26:07+00:00

i have a cck custom type that is created by people and the fields

  • 0

i have a cck custom type that is created by people and the fields are filled.
Then someone else edit those nodes and adds more data. I want to save the username of the user editing the content into an hidden field.

i know i can get the user with this:

global $user;
$a = $user->name;
return array(
  0 => array('value' => $a)
);

and i have put this as default code for the hidden field, but the field now is filled with the creator of the node, and then is not replaced with the editor.
How can i solve my issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:26:08+00:00Added an answer on May 28, 2026 at 4:26 pm

    i do research on your problem, here is a solution enjoy!!!

    Create a custom module and use the following code.

    //Implementation of hook_nodeapi()
    function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
      switch($op) {
        case 'presave':
            if($node->type == "Your content type name")
            {
              global $user;
              //In my case
              //$node->field_username[0]['value'] = $user->name;
              //In your case it will be like
              $node->hidden_field_name[0]['value'] = $user->name;
            }
          break;
      }    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have mastered creating custom data types and adding fields with CCK. Then I
I am using CCK on a custom node type. I have created a field
I have a content type which is created using CCK's(Establishment). I have used $form['#redirect']
I have a custom 'Player' node type in Drupal with a CCK file field
I've created a custom content type: product This product has an image (cck file
I have 2 custom type made with CCK : Reunion Title Description Node reference
Using cck I've created a new content type, Contact. A contact can have 1
I have a node with many CCK fields. I want to hide a field
I have a field in a CCK node form that is hidden, and has
I have the following in Drupal 6: A Master CCK type which contains a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.