[wp-hackers] Upgrading a plugin that works on WP 2.9.2 to work with WP 3.0.1+

Dustin Shea demonicpagan at gmail.com
Thu Sep 9 05:41:11 UTC 2010


I've added the if (!function_exists('somefucntion') { ... } before every function which stopped cannot redeclare function errors, now when I try to activate it, it just says Plugin could not be activated because it triggered a fatal error. No other information is provided about it.

-Dustin

On 9/9/2010 12:04 AM, Ryan Bilesky wrote:
> should be
>
> if( !function_exists( 'ffxi_install' ) ){
>      //Your function here
> }
>
> Also as a side note I had the same error before when trying to execute a
> function in a separate file that I had requires, changing that to
> require_once fixed that.
>
> On Wed, Sep 8, 2010 at 9:58 PM, Dustin Shea<demonicpagan at gmail.com>  wrote:
>
>> I used that in my code, now after activation it throws this error now:
>>
>> Parse error: syntax error, unexpected T_STRING, expecting '(' in
>> /home/demonicpagan/wp-testing/wp-content/plugins/ffxi/ffxi.php on line 59
>>
>> Updated code at http://stelth2000inc.com/ffxi.phps
>>
>> -Dustin
>>
>>
>> On 9/8/2010 10:33 PM, Brent Shepherd (Prospress) wrote:
>>
>>> Check to make sure the plugin has previously been properly deactivated by
>>> looking at the wp_options table. Find the option_name "active_plugins" and
>>> make sure ffxi.php is not in that array when the plugin has been
>>> deactivated. Not properly deactivating is what I've found to cause this
>>> for
>>> me.
>>>
>>> If that fails, then you can always test if the function is already
>>> declared
>>> before declaring it:
>>>
>>> if( !function_exists( 'ffxi_install' ) )
>>> function ffxi_install() {
>>>      ...
>>> }
>>>
>>> That is really a bandaid more than a solution though.
>>>
>>>
>>>
>>> On Thu, Sep 9, 2010 at 10:24 AM, Dustin Shea<demonicpagan at gmail.com>
>>>   wrote:
>>>
>>> I've been trying to upgrade a plugin of mine that I wrote so that it works
>>>> with WP 3.0+. The problem I run into is that when I go to activate the
>>>> plugin, it displays the following error
>>>>   Plugin could not be activated because it triggered a *fatal error*
>>>>
>>>> *Fatal error*: Cannot redeclare ffxi_install() (previously declared in
>>>> */home/demonicpagan/wp-testing/wp-content/plugins/ffxi/ffxi.php:60) in
>>>> /home/demonicpagan/wp-testing/wp-content/plugins/ffxi/ffxi.php* on line
>>>> *353*
>>>>
>>>> Despite that error being presented, the plugin does activate, however, if
>>>> I
>>>> can figure out what is triggering the error to display, I'd prefer it.
>>>>
>>>> The code for this can be found here: http://stelth2000inc.com/ffxi.phps
>>>>
>>>> I thank anyone who can help me figure out what's going on.
>>>>
>>>> -Dustin
>>>>
>>>> --
>>>> This message contains confidential information and is intended only for
>>>> the
>>>> individual named. If you are not the named addressee you should not
>>>> disseminate, distribute or copy this e-mail. Please notify the sender
>>>> immediately by e-mail if you have received this e-mail by mistake and
>>>> delete
>>>> this e-mail from your system. E-mail transmission cannot be guaranteed to
>>>> be
>>>> secure or error-free as information could be intercepted, corrupted,
>>>> lost,
>>>> destroyed, arrive late or incomplete, or contain viruses. The sender
>>>> therefore does not accept liability for any errors or omissions in the
>>>> contents of this message, which arise as a result of e-mail transmission.
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>
>> --
>>   This message contains confidential information and is intended only for
>> the individual named. If you are not the named addressee you should not
>> disseminate, distribute or copy this e-mail. Please notify the sender
>> immediately by e-mail if you have received this e-mail by mistake and delete
>> this e-mail from your system. E-mail transmission cannot be guaranteed to be
>> secure or error-free as information could be intercepted, corrupted, lost,
>> destroyed, arrive late or incomplete, or contain viruses. The sender
>> therefore does not accept liability for any errors or omissions in the
>> contents of this message, which arise as a result of e-mail transmission.
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

-- 
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.


More information about the wp-hackers mailing list