Trouble shooting Drupal : Why I can't see my CCK fields & related changes to my content/node forms?

31 Jul

Trouble shooting Drupal : Why I can't see my CCK fields & related changes to my content/node forms?

in Drupal, Drupal Planet, Drupal Planet

0) Try and flush the menu cache, theme cache
Exp:     Many times we go on making the changes and forget to clear the cache. Drupal caches everything in database and until and unless you clear cache, it can not pick new changes done in code. This is must when you do something related to menu in the custom module and theme.
 
1) Check the content-types and it's fields on the admin side
Exp:    Overall, it is the best practice to check the administration side and get confirmed about 'all good' condition.

2) Check the module dependencies
Exp:     If you have created a field and it has some dependency to be fulfilled; the field may not work as desired. e.g. If you have used/imported the field which works based on condition but the actual 'Conditional field module' is missing, then the field will not work.

3) Check the settings involved in CCK fields
Exp:    Check the field created using CCK has all the configurations. This is necessary especially in case where you export and import the content-types. As if you export a feature and import it in other environment, some modules may get installed little later, and here the configurations can be missed out.

4) Check the permissions of CCK fields
Exp:     This is extremely important step in drupal troubleshooting, most of the problems get solved in this step. Check if the content permission module is enabled and if yes go visit /admin/user/user/list. 

        Note which user you are looking at and what roles it has. Now go and visit /admin/users/permissions.
        Get confirmation that the user you are looking at has proper access permissions. While doing this, make sure you are not logged in as user->uid = 1 (i.e. admin), because this user has no restrictions it can see everything.

5) Check the hook_form_alter function
Exp:  If your problem still exists, means there is something wrong in the code. This happens generally while moving the site from dev -> test -> live. Whether you have this function in the module or have you missed the complete file? Make sure you are using '&form' in the arguments to hook_form_alter(). Have you written the most important " case 'content-type-machine-name': "?  

6) Check the machine name of content-type and CCK fields used in hook_form_alter
Exp:     If it is all there please check for the spell difference in content-type machine name set in administration and the machine name used in code. And if your problem fit in this case, please don't bang your head. This is perfectly normal if you are working on big poject or working with big team.

7) Check the weight of your custom module
Exp:    Many times you do all above correct but still your module hooks like hook_form_alter() or hook_user() does not reflect the changes or work as desired. This is because your module is included and hooks are invoked before some of core/necessary modules. So it is always best to set the heavy weight (greater integer number) to your developed custom module, in order to get it invoked at the last of the stack of modules. Most of your worries will go away, benefited your site will be always consistent. If you are not in situation where you can actually uninstall / install module then go to system table, find the module record, set the weight column, reload drupal and clear the cache.

8) Check for the template.php for any hacks, hard codes or preprocessor hooks
Exp:    This does not happen usually, but may happen if some novice is in your team or somebody had to do because of toughest situation. Now you are in driver seat where you do not know much, then please go ahead and check the template.php of the active theme for hooks or hacks.

9) Check for specific CSS rule for the form item / form
Exp:    This is very common, the people beginner in drupal feel this as short and easy way to fullfill the requirement and make some of the fields go away on the form. So if your  CCK field is not showing up at all then this could be a problem and give it a thought.

10) Check for the Javascript/Jquery if the particular element is removed from the page
Exp:    Like I mentioned above this goes same with JavaScript, people used remove the fields on "onload" event from the document to get rid of the field.
       
I hope you agree with my views and findings. If you have some other case which is not covered in this post, please take out a minute and contribute a comment. If you disagree with any of my views please comment and share your knowledge.  

copyright 2012 10jumps Llc.

copyright 2012 10jumps LLC.