Hans, I’m receiving the same thing. Did someone answer you? Were you able to resolve it yourself? Are your emails being sent despite of this warning? Thanks
Hi Lucas,
No I didn’t get answer on this point and the error is still reported in my own log.
Hans
Hi Lucas.
I’ve Looked into the code now and think it isn’t that hard to solve myself. It seems that the plugin developer has just got the arguments of the in_array() function switched.
The warning is generated by the use of in_array in following code:
function mca_email_poked_ones( $comment_id, $approved ) {
if( add_filter( 'mca_send_email_on_mention', true ) && in_array( array( 1, 'approve' ), $approved ) ) {
As you can see the second parameter ($approved) is passed through by the caller of mca_email_poked_ones.
The only call of the function mca_email_poked_ones I could find is in line 277, which says:
mca_email_poked_ones( $comment_id, 1 );
The second parameter being the integer 1.
The syntax of in_array being
in_array(term_to_search_for,array,type)
Changing line 249 to
if( add_filter( 'mca_send_email_on_mention', true ) && in_array( $approved, array( 1, 'approve' ) ) ) {
should do the trick. Line 249 probably just wants to check if $approved is either 1 or ‘approve’.
Hope it helps.
Hans
-
This reply was modified 9 years, 7 months ago by
Hans Schuijff. Reason: typo
Thanks Hans. I applied your fix and I don’t see the warning any more. However, I never receive the email. Did you ever receive the notifications from this plugin?
To be honest, I hadn’t even noticed that functionality in the plugin. Perhaps I test it at some later point. The faq gives some instructions about how to disable that functionality and change the emails, but it should work. I’ll let you know when I find something. Given the lack of respons from the developer, I quess this isn’t a plugin that is actively maintained at the moment.
I have tried one comment with myself as mentioned author, but get a http error 405 now. With the warning it didn’t. I think since the in_array warning was about the first selection in the function that send the emails, the if in the beginning never was true so the functionality was never actually performed. Now it is, it results in a http 405. I guess it should be debugged some more. Perhaps better do that before using it.
I did receive the emails now by the way. So the error doesn’t prevent that. The comment was also added. But it still needs some tlc.