Im using drupal 7 and created a content type abc. In abc there is a CCK field called seller. When a logged in user create a new item for content type abc, the value of the seller field would be the name of the person who is logged in. So what I want is a default value for the sellers fiels or you can say that a small piece of php code. But I am not able to find the place for the php code to enter in drupal 7. In drupal 6 there is text area for the php code to enter. But how can this be done with the drupal 7. Any ideas?


4 Answers 4


This functionality is not part of the Field UI in Drupal 7. You'll need to install the CCK module.


Enable PHP filter module, that's core module of drupal 7.

  • I have enabled tha module. But that doesn't solve my problem. Im still not getting the text area field for php code. Commented Jun 22, 2011 at 3:50
  • Do you have admin (first user) role?
    – Nikit
    Commented Jun 23, 2011 at 22:11

(I assume Drupal 7)
May be a bit late answer ...
As @Nikit said, you have to enable the PHP filter module.
But also, beware of a trap that cost me some time : you will have to set permissions to admin for this module as default permissions are empty (may be because this module is rather on the dev side, so even admin should not have this permission by default ?).
Then, in the visibility settings for pages, you will have a third options (radio button) that allows you to add PHP for :

Pages on which this PHP code returns TRUE (experts only)

PS : i don't get the answer from Dylan as CCK was mostly incorporated to D7 core...

  • See the linked CCK module page for what was not incorporated into core and relevant for this question: some miscellaneous helpers to do things that core will not do, like maintain the PHP code snippets some fields may have been using to define allowed values (partially working) Commented May 3, 2012 at 4:19

I'm using Drupal 7. I had also same issue.

Even though most of CCK has moved to core in the Drupal 7 version, we cant see the option to include PHP code / PHP function until you install cck module.

After installing this module only, we can see the options to include PHP function.

I have created select list to display city data. For this i have used one function to fetch all city data from my custom table.

For more details see this image : (city_list_from_maxmind - PHP function)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.