• Resolved diegosev

    (@diegosev)


    Hello, I’m using wp-cli to control settings to activate and deactivate comming soon mode, when i use
    “wp –url=url.mainsite.com –allow-root option patch update seedprod_settings ‘{“enable_maintenance_mode”:”false”}’ –format=json” It works

    but when i want to activate the mode I’m getting this error
    “PHP Warning: json_decode() expects parameter 1 to be string array given in /home/pidepaya.com/public_html/wp-content/plugins/coming-soon/app/render-csp-mm.php on line 36”

    Line 36 of that file is “$seedprod_settings = json_decode( $ts, true );”

    Any sollution? thanks in advance for any help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter diegosev

    (@diegosev)

    When I use enable_maintenance_mode”:”false” it seems that the objet containing seedprod settings just dissapears, tha’ts why it gives an error trying to put maintenance_mode true.

    Plugin Author SeedProd

    (@seedprod)

    Hi, you need to pass the entire object, also notice true and false don’t have quotes.

    {  
       "api_key":"",
       "enable_coming_soon_mode":false,
       "enable_maintenance_mode":false,
       "enable_login_mode":false,
       "enable_404_mode":false
     }
    Thread Starter diegosev

    (@diegosev)

    Hello and thanks for the reply.
    Do you mean that i need to pass all the object even if I’m looking just to update one value? How do you pass an entire object wit wp-cli?
    I was trying using
    wp –url=subsite.multisite.com –allow-root option update seedprod_settings ‘{“api_key”:””,”enable_coming_soon_mode”:false,”enable_maintenance_mode”:true,”enable_login_mode”:false,”enable_404_mode”:false}’ –format=json
    PHP Warning: json_decode() expects parameter 1 to be string, array given in /home/multisite.com/public_html/wp-content/plugins/coming-soon/app/render-csp-mm.php on line 36
    Success: Updated ‘seedprod_settings’ option.
    [root@multisite public_html]#”
    But same error, nothing is updated.

    • This reply was modified 2 years, 10 months ago by diegosev.
    Thread Starter diegosev

    (@diegosev)

    It seems to be happening only when i use “enable_maintenance_mode”:true” , if i use the command to deactivate maintenance mode it works perfect.

    This works fine:

    wp –url=milanesasboludas.pidepaya.com –allow-root option update seedprod_settings ‘{“api_key”:””,”enable_coming_soon_mode”:false,”enable_maintenance_mode”:false,”enable_login_mode”:false,”enable_404_mode”:false}’ –format=json

    This doesn’t work:

    wp –url=subsite.multisite.com –allow-root option update seedprod_settings ‘{“api_key”:””,”enable_coming_soon_mode”:false,”enable_maintenance_mode”:true,”enable_login_mode”:false,”enable_404_mode”:false}’ –format=json

    Now i don’t have any visible errors but it is not working. System indicates success but the options of the seedprod_settings are gone from the subsite settings if y try to turn true maintenance_mode using wp-cli.

    • This reply was modified 2 years, 10 months ago by diegosev.
    • This reply was modified 2 years, 10 months ago by diegosev.
    Plugin Author SeedProd

    (@seedprod)

    I’m running this locally and it works fine:

    wp option update seedprod_settings '{"api_key":"","enable_coming_soon_mode":true,"enable_maintenance_mode":false,"enable_login_mode":true,"enable_404_mode":false}'

    Note this is a string, I don’t need to include a format

    Thread Starter diegosev

    (@diegosev)

    You are right ?? , no need to put the format option and everything works! thanks for the quick replys sr.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP Warning: json_decode() expects parameter 1 to be string’ is closed to new replies.