I want to modify a contrib module in such a way that I don't lose my customizations whenever I update the module. Below is my git diff from the changes I want to make. I use git and drush.

What I am wondering is, how can I add something to my own custom help module that will have the same affect?

The change I had made was to disable the function in this Facebook connect module that grabs the user's picture and adds it to the profile.

enter image description here

+// Disable facebook profile picture integration (CH)
     // If user pictures are enabled, try to get the profile picture from FB.
-    if (variable_get('user_pictures', 0)) {
-      $fid = simple_fb_connect_get_fb_profile_pic($fb_session);
-      if ($fid) {
-        $fields['picture'] = $fid;
-      }
-    }
+//    if (variable_get('user_pictures', 0)) {
+//      $fid = simple_fb_connect_get_fb_profile_pic($fb_session);
+//      if ($fid) {
+//        $fields['picture'] = $fid;
+//      }
+//    }
  • 2
    Having a worklow that supports patches like Composer or Drush Make (7?) would do this. Create an issue and add the patch or you can pull the patch from a local folder. You just have to keep up with the branch it applies to, so it continutes to apply with updates (or pin it to a specific commit hash).
    – Kevin
    Commented May 14, 2018 at 20:45
  • Hi Kevin. I love the idea of doing a patch, however, would I still need to recreate and apply a patch every time I update the module? If so, then what is the difference between that and just editing the module?
    – Christia
    Commented May 16, 2018 at 5:17
  • Because you should have a build process in place that does this automatically before deploying it. This is easy in 8, but it’s also doable in 7. Look at drush make files.
    – Kevin
    Commented May 16, 2018 at 11:56

1 Answer 1


You should not modify the contrib module directly and save it. You should create a patch file and use that patch file in the project. This way every time if there is any update in that module, you run drush command and your changed will be safely applied. Please refer this page to create a patch file if you don't know How to create Drupal patch with git.


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.