Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
First off, thank you so much for this module. It does exactly what I need.
I do have an error message that is showing the following on my page.
Notice: Undefined index: module in faq_ask_form_faq_node_form_alter() (line 337 of /home/xxxx/xxxx/sites/all/modules/faq_ask/faq_ask.module).
I installed and then reinstalled your module and my first installation did not show this.
Everything else seems to functioning as it should. Any ideas on how to remove this?
Comment | File | Size | Author |
---|---|---|---|
#18 | Screen Shot 2012-08-03 at 10.09.21 AM.png | 14.55 KB | lilbebel |
#7 | Screen Shot 2012-08-02 at 10.10.07 AM.png | 9.82 KB | lilbebel |
#7 | Screen Shot 2012-08-02 at 10.09.50 AM.png | 6.91 KB | lilbebel |
Comments
Comment #1
stenjo CreditAttribution: stenjo commentedI believe this is a small bug as the code does not check for the existence of the category field enabled in the ask a question box.
Have you configured the module properly and it is working the way you are expecting otherwise?
Comment #2
Vanguardian CreditAttribution: Vanguardian commentedThanks for the response.
Yes, other than that error displaying on pages using the module, everything else is working properly.
Comment #3
stenjo CreditAttribution: stenjo commentedI'm a little curious though... The statements that causes the notice is determining if the Taxonomy module is in place and that the fields are modified to not be too big for the column in which the question block is placed.
When writing the code I was sure this is the way of determining if the taxonomy module is loaded and that the fields from that module is displayed.
I'm wondering if you could do me a favour and add the following line just above line 336 in the faq_ask.module file:
- and then post whatever is displayed in your notice field here?
If nothing else it will help me understand what is different with your installation.
The notice will go away if you change the line at 337 from
to
- also I spotted another small mistake. The whole if-statement should have been enclosed in a set of "{}".
Comment #4
Vanguardian CreditAttribution: Vanguardian commentedThanks,
After changing line 337 like you recommended, the error stopped showing on the main page. However, this error shows after a user submits a question.
Notice: Undefined index: module in _faq_ask_get_terms() (line 579 of /home/xxxxx/xxxxx/sites/all/modules/faq_ask/faq_ask.module).
Again, everything seems to work as it should otherwise.
Here is the response when the code was added to line 336
Comment #5
stenjo CreditAttribution: stenjo commentedYes, that is the same kind of problem really.
Does not seem to be the case that the 'module' property of the display settings of all fields are defined. Do not know why, but a similar fix as the one in #3 will take care of it.
Change line 578 from
to
Comment #6
Vanguardian CreditAttribution: Vanguardian commentedThanks so much, seems to be working perfectly now.
Thanks again for a great module and valuable prompt quality support.
Comment #7
lilbebel CreditAttribution: lilbebel commentedHi there,
I followed the instructions as above. However, when I added the new code to 578, my long array code notice didn't go away. I have attached screenshots of my code alterations. Do you know why it may not be working for me?
Thanks,
M
Comment #8
stenjo CreditAttribution: stenjo commentedWhat error message is that?
Are you able to provide a screenshot of that too?
The code looks right...
Comment #9
lilbebel CreditAttribution: lilbebel commentedSorry, error is not the correct word. I am receiving the same response code as vanguardian posted above. Mine didn't go away though.
Comment #10
stenjo CreditAttribution: stenjo commentedThat's the thing. I do not get what notice message you are getting. Can you copy and paste the notice into this thread please?
Vanguardian is referring to two different notices:
Notice: Undefined index: module in faq_ask_form_faq_node_form_alter() (line 337 of /home/xxxx/xxxx/sites/all/modules/faq_ask/faq_ask.module).
and
Notice: Undefined index: module in _faq_ask_get_terms() (line 579 of /home/xxxxx/xxxxx/sites/all/modules/faq_ask/faq_ask.module).
I am not able to see how either the line numbers or the notices can possibly be identical when the code change is applied the way your screenshots indicates.
Comment #11
lilbebel CreditAttribution: lilbebel commentedArray
(
[body] => Array
(
[label] => Body
[widget] => Array
(
[type] => text_textarea_with_summary
[settings] => Array
(
[rows] => 20
[summary_rows] => 5
)
[weight] => -4
[module] => text
)
[settings] => Array
(
[display_summary] => 1
[text_processing] => 1
[user_register_form] =>
)
[display] => Array
(
[default] => Array
(
[label] => hidden
[type] => text_default
[weight] => 0
[settings] => Array
(
)
[module] => text
)
[teaser] => Array
(
[label] => hidden
[type] => text_summary_or_trimmed
[settings] => Array
(
[trim_length] => 600
)
[module] => text
[weight] => 0
)
)
[required] =>
[description] =>
[id] => 13
[field_id] => 2
[field_name] => body
[entity_type] => node
[bundle] => faq
[deleted] => 0
[default_value] =>
)
[field_language_term] => Array
(
[label] => Language Term
[widget] => Array
(
[weight] => 1
[type] => options_select
[module] => options
[active] => 1
[settings] => Array
(
)
)
[settings] => Array
(
[user_register_form] =>
)
[display] => Array
(
[default] => Array
(
[label] => hidden
[type] => hidden
[weight] => 1
[settings] => Array
(
)
)
[teaser] => Array
(
[type] => hidden
[label] => above
[settings] => Array
(
)
[weight] => 0
)
)
[required] => 1
[description] =>
[default_value] =>
[id] => 75
[field_id] => 46
[field_name] => field_language_term
[entity_type] => node
[bundle] => faq
[deleted] => 0
)
)
Comment #12
stenjo CreditAttribution: stenjo commentedLooks like you have not removed the debugging line I suggested. Does line 336 in the faq_ask.module file look something like this:
If so, remove the code and you should be OK.
/Sten
Comment #13
lilbebel CreditAttribution: lilbebel commentedAbove is the code I get and it doesn't go away when I add 'if (isset($properties['display']['default']['module']) && $properties['display']['default']['module'] != 'taxonomy')' to line 578.
M
Comment #14
lilbebel CreditAttribution: lilbebel commentedHi there,
I removed that line as you suggested. The long code has gone but now I have a red box warning saying 'Notice: Undefined index: module in faq_ask_form_faq_node_form_alter() (line 337 of /home5/tsmacade/public_html/sites/all/modules/faq_ask/faq_ask.module).'
M
Comment #15
stenjo CreditAttribution: stenjo commentedYes. See my comment #12. I missed from your screenshot of the first codechange that you still had the debugging code in place. Remove or comment out line 336 and you will be fine.
Comment #16
lilbebel CreditAttribution: lilbebel commentedI tried both removing the line and un-commenting it but the long code has gone and the red error box remains 'Notice: Undefined index: module in faq_ask_form_faq_node_form_alter() (line 338 of /home5/tsmacade/public_html/sites/all/modules/faq_ask/faq_ask.module).'
Comment #17
stenjo CreditAttribution: stenjo commentedOk, so how does your lines at 335 - 345 in the file /sites/all/modules/faq_ask/faq_ask.module look now?
Comment #18
lilbebel CreditAttribution: lilbebel commentedThis is a screenshot of my code now.
Comment #19
lilbebel CreditAttribution: lilbebel commentedThanks for all this help by the way!
Comment #20
stenjo CreditAttribution: stenjo commentedYes, now the change I suggested in my comment #3 is gone from your code. Please insert the
isset($properties['display']['default']['module'])
piece that you are missing, and you will be OK.I'll make sure to update dev with these modifications some time during the weekend.
Comment #21
lilbebel CreditAttribution: lilbebel commentedSorry, I'm not a PHP expert. On exactly which line should I insert this code? Will it be replacing something that exists there already or will it be in addition to?
Comment #22
stenjo CreditAttribution: stenjo commentedThis is now fixed in the latest dev. Should be available for download tomorrow.
Comment #23
lilbebel CreditAttribution: lilbebel commentedThanks!
Comment #25
alansch CreditAttribution: alansch commentedI'm going to have to re-open this issue. The same error is thrown in line 276...
From the .info file,
And, of course, the same fix as the others. Line 276 becomes
Comment #26
kaizerking CreditAttribution: kaizerking commented#25 fixed this
Comment #27
Colin @ PCMarket CreditAttribution: Colin @ PCMarket commented#25 fixed the error on Line 276 for me too.
Comment #28
izmeez CreditAttribution: izmeez commentedLooks like the fix was committed on 2012-08-04, https://git.drupalcode.org/project/faq_ask/-/commit/be753ca5
But, I won't change the status and leave it for someone else to confirm.
However, I see there is another possibly related issue #2167395: Undefined index.