Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Override a Functionfunction in a Contrib Modulecontrib module

deleted 55 characters in body
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

My company received a maintenance contract for a website developed in Drupal 7. The Drupal 7 website uses the Quiz contrib module, ver. 7.x-4.0-rc10. The module is used to implement a feature where authenticated users answer questions to tests.

When an authenticated user completes the test and views his result, the following notice errors are displayed on the results page,

  • Notice: Undefined index: nid in quiz_take_quiz() (line 2078 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Undefined index: vid in quiz_take_quiz() (line 2078 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Trying to get property 'type' of non-object in quiz_take_quiz() (line 2082 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Undefined index: in quiz_take_quiz() (line 2082 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Trying to get property 'is_valid' of non-object in quiz_take_quiz() (line 2084 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).

The Quiz module has a function, quiz_take_quiz($quiz).

As part of contract signed by my company, I have to resolve all notices. Therefore, what I intend to do is override this function and modify the exact line which is responsible for throwing the above notices (line no. 2078) and add a variable validation there.

However being a newbie to Drupal development I don't know where to start and what to do. I do know that modifying the code in a contrib module is not the best practice. I have hidden the path to the .module file with ........ to maintain privacy.

Can anyone please provide me the solution to this? Early replies will be highly appreciated.

Thank you.

My company received a maintenance contract for a website developed in Drupal 7. The Drupal 7 website uses the Quiz contrib module, ver. 7.x-4.0-rc10. The module is used to implement a feature where authenticated users answer questions to tests.

When an authenticated user completes the test and views his result, the following notice errors are displayed on the results page,

  • Notice: Undefined index: nid in quiz_take_quiz() (line 2078 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Undefined index: vid in quiz_take_quiz() (line 2078 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Trying to get property 'type' of non-object in quiz_take_quiz() (line 2082 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Undefined index: in quiz_take_quiz() (line 2082 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Trying to get property 'is_valid' of non-object in quiz_take_quiz() (line 2084 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).

The Quiz module has a function, quiz_take_quiz($quiz).

As part of contract signed by my company, I have to resolve all notices. Therefore, what I intend to do is override this function and modify the exact line which is responsible for throwing the above notices (line no. 2078) and add a variable validation there.

However being a newbie to Drupal development I don't know where to start and what to do. I do know that modifying the code in a contrib module is not the best practice. I have hidden the path to the .module file with ........ to maintain privacy.

Can anyone please provide me the solution to this? Early replies will be highly appreciated.

Thank you.

My company received a maintenance contract for a website developed in Drupal 7. The Drupal 7 website uses the Quiz contrib module, ver. 7.x-4.0-rc10. The module is used to implement a feature where authenticated users answer questions to tests.

When an authenticated user completes the test and views his result, the following notice errors are displayed on the results page,

  • Notice: Undefined index: nid in quiz_take_quiz() (line 2078 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Undefined index: vid in quiz_take_quiz() (line 2078 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Trying to get property 'type' of non-object in quiz_take_quiz() (line 2082 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Undefined index: in quiz_take_quiz() (line 2082 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).
  • Notice: Trying to get property 'is_valid' of non-object in quiz_take_quiz() (line 2084 of C:\wamp64\www\........\modules\contrib\quiz\quiz.module).

The Quiz module has a function, quiz_take_quiz($quiz).

As part of contract signed by my company, I have to resolve all notices. Therefore, what I intend to do is override this function and modify the exact line which is responsible for throwing the above notices (line no. 2078) and add a variable validation there.

However being a newbie to Drupal development I don't know where to start and what to do. I do know that modifying the code in a contrib module is not the best practice. I have hidden the path to the .module file with ........ to maintain privacy.

Can anyone please provide me the solution to this?

typo fix
Source Link
No Sssweat
  • 31.6k
  • 14
  • 55
  • 91
Loading
Source Link
razor
  • 125
  • 6
Loading