Fix for Cp::set_variable() add-on errors in EE 2.10.1

Update 13 May 2015: updated versions of SH Member Group Tabs 1.4, Republic Variables 2.0.7 and Developer Info are now available. The info below may still be useful for fixing other add-ons.

In ExpressionEngine 2.10.1 we found some add-on screens in the control panel no longer worked, giving the error message "Fatal error: Call to undefined method Cp::set_variable()".

There’s a quick and easy fix for this. The error arises because the method of checking the EE version has changed, so you just need to update any lines where this happens.

User Rakesh posted the fix on Stack Exchange for Member Group Tabs and the same type of fix has worked for other add-ons we use.

How to fix “Call to undefined method Cp::set_variable()” error:

  1. Go to the file & line number referenced in the error message
    e.g. for Developer Info, go to developer_info/libraries/developer_info_helper.php line 52

  2. Find a line with APP_VER in it near this
    e.g. for Developer Info, it’s APP_VER >= ‘2.6.0’ on line 46

  3. Update the version check to use the version_compare function instead
    e.g. for Developer Info, replace APP_VER >= ‘2.6.0’ with version_compare(APP_VER, ‘2.6.0’, ‘>=’)

Hopefully this quick fix should work for any affected add-ons.

Comments

avatar

13 May 2015 14:20:51

Thanks Janine!

avatar

14 May 2015 09:57:38

Thank you Marc for maintaining this free add-on for the EE community :)

Leave a comment