This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem:
WP Client can't be activated due to following error "Fatal error: Uncaught TypeError: Argument 1 passed to WPML_Custom_Columns::__construct() must be an instance of SitePress, instance of wpdb given"

Solution:
- Go to wp-content/plugins/wp-client/includes/class-wpc-3p-compatibility.php on line 153 and replace the following code

global $sitepress;
$custom_columns = new WPML_Custom_Columns( $sitepress->wpdb, $sitepress );

with

global $sitepress;
$custom_columns = new WPML_Custom_Columns( $sitepress );

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by kalinL 1 year ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
September 28, 2018 at 3:57 pm #2774368

kalinL

Hi, we use WP-Client on our website. When updating plugins we got the reporting error. See below.

After some research I made the edits below:

But the plugin still doesn't work. What more can be done?

EDITS MADE
Locate line 153 in wp-client/includes/class-wpc-3p-compatibility.php an initialize the class. The code probably looks like this:

1
WPML_Custom_Columns( $this->wpdb, $this->sitepress )
and you need to change it to this (just add new in front):

1
new WPML_Custom_Columns( $this->wpdb, $this->sitepress )

-----

ERROR

Fatal error: Uncaught TypeError: Argument 1 passed to WPML_Custom_Columns::__construct() must be an instance of SitePress, instance of wpdb given, called in /home/sqbyvsj5c51s/public_html/wp-content/plugins/wp-client/includes/class-wpc-3p-compatibility.php on line 153 and defined in /home/sqbyvsj5c51s/public_html/wp-content/plugins/sitepress-multilingual-cms1/classes/menu-elements/class-wpml-custom-columns.php:19 Stack trace: #0 /home/sqbyvsj5c51s/public_html/wp-content/plugins/wp-client/includes/class-wpc-3p-compatibility.php(153): WPML_Custom_Columns->__construct(Object(wpdb), Object(SitePress)) #1 /home/sqbyvsj5c51s/public_html/wp-content/plugins/wp-client/includes/class-hooks-handler.php(59): WPC_3P_Compatibility->wpml_portalhub_columns('') #2 /home/sqbyvsj5c51s/public_html/wp-includes/class-wp-hook.php(286): WPC_Hooks->__call('WPC_3P_Compatib...', Array) #3 /home/sqbyvsj5c51s/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #4 /home/sqbyvsj5c51s/public_html/wp-includes/plugin.php(45 in /home/sqbyvsj5c51s/public_html/wp-content/plugins/sitepress-multilingual-cms1/classes/menu-elements/class-wpml-custom-columns.php on line 19

October 1, 2018 at 6:09 am #2777184

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Thank you for contacting WPML support. I'd be happy to assist you further on this issue.

Could you please use the following code and let me know if this helps?

global $sitepress;
$custom_columns = new WPML_Custom_Columns( $sitepress );

Look forward to your reply.

Thanks

October 1, 2018 at 12:03 pm #2777956

kalinL

Should I use it here? Locate line 153 in wp-client/includes/class-wpc-3p-compatibility.php and replace what I added?

October 1, 2018 at 12:08 pm #2778044

kalinL

My issue is resolved now. Thank you!