Support Forum

Simple:Press > The Events Calendar sp_get_option(), response

TH Thorsten
Thorsten
Member

Just a quick note that I posted in the TEC support forum concerning this error (when activating S:P after TEC):

Fatal error: Cannot redeclare sp_get_option() in public_html/ecourses/wp-content/plugins/simple-press/sp-api/sp-api-primitives.php on line 81

Here’s what they had to say:

Howdy, Thank you for reporting this. You have activated the plugins in the correct order and should be in good sorts going forward. Upon activation our plugin checks to see if there there is a conflict and resolves it. Unfortunately the S:P plugin does not check for conflicts. So if S:P is activated second it will generate an error. Only S:P would be able to detect/problem-with-post-edit-buttonandle that error. Does that make sense? Definitely let us know if you experience any issues resulting from this, but now that you have activated it in the right order you should be fine. – Brook

Alas, they are saying this isn’t their problem.

4 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Thorsten B said
Alas, they are saying this isn’t their problem.

That is NOT how I read that response. What they seem to me to be saying is that as long as you activate plugins in the right order then things will be fine. Order is actually important but something that rarely gets discussed. WordPress will ‘include’ the code form each plugin in the order in which they are activated. Changing that order can often clear up minor issues.

So – they say that in the right order it self-detects the issue. This means they perform a ‘function-exists’ check. How they then run the functions they wanted to run I have no idea of course – without looking at their code. But clearly they state they do this. And they are right. We do not. If we put one of these checks around every function it would seriously add to the bulk of the code as well as take a performance hit.

MP Mr Papa
Mr Papa
Member

sorry, check if the function exists makes no sense either…  if we checked and did not declare our function, we would instead call their function and you would have a whole slew of new problems…  we would not get the data returned needed… and frankly, that would be very hard troubleshoot – much easier to get a duplicate error and know what the problem is…

unfortunately, with plugins and themes, you will always run the risk of duplicate functions – thats the reason most plugins prefix the functions, variables, etc… in this case, bad luck, we both prefixed it the same… 

TH Thorsten
Thorsten
Member

My question rather is why a plugin called The Events Calendar prefixes a function with sp_ and not, say, tec_. Oh well. I’ll just keep the activation order in mind for future troubleshooting.

YS Yellow Swordfish
Yellow Swordfish
Member

Only they could tell you that. The WP recommendation is to use the initials of the plugin name but it is just a guideline. As Steve said – clashes and conflicts of this nature will happen even if rarely.