• Resolved WebHolism

    (@webholism)


    Hi support,

    Since installing the PDF & Print plugin, everything seemed to be going perfectly until I logged out and logged back in again to the WordPress administrator.

    Every time I log in, I’m now greeted by several rows of:

    “Warning: in_array() expects parameter 2 to be array, null given in /xxxxxxxxxx/wp-content/plugins/pdf-print/pdf-print.php on line 656”

    Once I navigate away from the admin dashboard, everything seems to be fine. Unfortunately, as this is a client site, I can’t really just leave the errors to pop up every time the client logs into the admin area (which they do daily). ??

    PDF & Print version: 1.7.2

    Is there something I can tweak to make this error disappear?

    Many thanks for your time!

    https://www.ads-software.com/plugins/pdf-print/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author bestwebsoft

    (@bestwebsoft)

    Hi,

    Does it mean that this error occurs after logging in to the back-end of the site?
    Could you please provide screenshots of the plugin settings page and the error?
    A simple solution: please try via the Editor of the plugin’s files, hosting file manager or ftp, in the file pdf-print.php (wp-content/plugins/pdf-print/pdf-print.php) find line 656

    if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array[‘use_types_posts’] ) )

    and change it for

    if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array[‘use_types_posts’] ) && is_admin() )

    Sincerely,
    BestWebSoft Support Team

    Thread Starter WebHolism

    (@webholism)

    Hi BestWebSoft Support Team,

    Thanks for your response.

    Yes, the error occurs when you log in to the back-end of the website, and then doesn’t appear if you navigate around the admin area. If you log out and log back in again, the error shows again (please see screenshot 1.jpg listed below).

    I tried the suggested code change, but it doesn’t seem to have made any difference to the error appearing ??

    Please find screenshots available here:

    https://www.webholism.com/images/support/1.jpg
    https://www.webholism.com/images/support/2.png
    https://www.webholism.com/images/support/3.png
    https://www.webholism.com/images/support/4.png

    Many thanks in advance for your help.

    I’m having the same problem. The code change unfortunately didn’t fix it for me either. I also wouldn’t care except that I have users that have expressed concern. Thank you!

    Plugin Author bestwebsoft

    (@bestwebsoft)

    Hi,

    Apologies, there was a mistake in the code, please try to change the line for the following one:

    if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array[‘use_types_posts’] ) || is_admin() )

    Sincerely,
    BestWebSoft

    Thread Starter WebHolism

    (@webholism)

    Hi BestWebSoft Support Team,

    Thanks for your amended code update, however even after implementing the new code change, I’m still getting the same error unfortunately.

    One thing I did notice: https://www.example-domain.com/wp-admin/ caused the error to trigger, however https://www.example-domain.com/wp-admin/index.php does not.

    Hopefully this might be some clue into the resolution?

    Many thanks,
    Sara

    Plugin Author bestwebsoft

    (@bestwebsoft)

    Hi Sara,

    We have made the necessary changes in the code of the plugin, please update to the recent version and check if the error is displayed or not.

    Sincerely,
    BestWebSoft Support Team

    Thread Starter WebHolism

    (@webholism)

    Hi BestWebSoft Support Team,

    I’ve upgraded to your latest plugin version – 1.7.3 and the same problem is still occurring.

    Are there any other code changes I can make to resolve this problem?

    Thanks.

    The error is not gone after upgrading

    Plugin Author bestwebsoft

    (@bestwebsoft)

    Hi all,

    Unfortunately, we cannot reproduce the problem locally. Could you please provide credentials to your site so that we could analyze the problem and fix it?
    Please provide details on our support forumhttps://support.bestwebsoft.com/, it will be a private ticket and the information will be available only for the support team.
    Please specify a link to this topic.

    Sincerely,
    BestWebSoft Support Team

    Thread Starter WebHolism

    (@webholism)

    Hi all,

    I managed to get our wonder developer to take a look and he’s made the following change which seems to have fixed the problem:

    TO RESOLVE:
    Modify /wp-content/plugins/pdf-print/pdf-print.php

    Find the below line (roughly line 658):
    if ( ! in_array( get_post_type( $post ), $pdfprnt_options_array[‘use_types_posts’] ) )

    And above it add:
    if (isset ($pdfprnt_options_array[‘use_types_posts’])){

    Then also add a:
    }
    (should be line 661) after the code:
    return $content;

    This problem is caused by the fact that the $pdfprnt_options_array[‘use_types_posts’] command is returning a NULL value and the second parameter of in_array is expected to be an array value.

    Hope this helps!

    Plugin Author bestwebsoft

    (@bestwebsoft)

    Hi again,

    We have found out the cause of the error and it will be fixed in the next update of the plugin.

    Sincerely,
    BestWebSoft Support Team

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Error when logging into WordPress after installing plugin’ is closed to new replies.