Would it be possible just to redirect to wp-admin/themes.php after doing the uninstall? That way, WordPress will handle the Theme switching...<div><br></div><div>Chip<br><br><div class="gmail_quote">On Wed, Jan 19, 2011 at 12:24 PM, Muhammad Khairul Syahir Abdul Hakim <span dir="ltr"><<a href="mailto:khairulsyahir@gmail.com">khairulsyahir@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><p>No can't do. The theme needs those settings to be in the database, otherwise it'll throw lots of php undefined index warnings, both in the options page and the front end.</p>
<p>I suppose I could change the code so that it doesn't show those warnings, but that'll be too much trouble for its purpose, I guess.</p>
<p>Well, I could just change it back to switch_theme('default', 'default') and the upload check won't catch the theme as using twentyten textdomain. I suppose that'll have to do until we get that theme uninstall hook.</p>
<p>--<br>
Regards,<br>
Syahir Hakim</p>
<p></p><div class="im">Contact:<br>
<a href="http://www.khairul-syahir.com" target="_blank">http://www.khairul-syahir.com</a><br></div>
+64210333649<p></p><div><div></div><div class="h5">
<div class="gmail_quote">On 20/01/2011 2:08 AM, "Philip M. Hofer (Frumph)" <<a href="mailto:philip@frumph.net" target="_blank">philip@frumph.net</a>> wrote:<br type="attribution">> You should grab the $pagenow value from when someone enters your options <br>
> panel<br>> <br>> as example:<br>> <br>> var_dump($pagenow)<br>> <br>> if (is_admin() && ($pagenow == 'whatwasfoundinthe$pagenow')) {<br>> }<br>> <br>> So that it is only executing your code on that specific options page for <br>
> your theme, maybe?<br>> <br>> <br>> <br>> <br>> ----- Original Message ----- <br>> From: "Syahir Hakim" <<a href="mailto:khairulsyahir@gmail.com" target="_blank">khairulsyahir@gmail.com</a>><br>
> To: <<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a>><br>
> Sent: Wednesday, January 19, 2011 9:48 AM<br>> Subject: Re: [theme-reviewers] Theme-Check plugin and textdomain<br>> <br>> <br>>> Well, that's actually what the Uninstall button in my theme's options page <br>
>> does. Basically,<br>>> Click on uninstall button > Confirm uninstall > delete database entries<br>>> > switch theme > redirect to /themes.php?activated=true<br>>><br>>> As I mentioned, the switch_theme is there so that the theme's <br>
>> functions.php file won't be loaded again whenever the user goes to other <br>>> pages in the admin panel, cause the theme checks for existence of its <br>>> options in the database, and add the default options if it doesn't exist.<br>
>><br>>> -- <br>>> Regards,<br>>> Syahir Hakim<br>>><br>>> Contact:<br>>> <a href="http://www.khairul-syahir.com" target="_blank">http://www.khairul-syahir.com</a><br>>> +6014 753 1883<br>
>><br>
>><br>>> On 20/1/2011 1:42 AM, Philip M. Hofer (Frumph) wrote:<br>>>> An option button in the theme options to 'delete options' for right now <br>>>> is the best option imho.<br>>>><br>
>>><br>>>><br>>>><br>>>><br>>>> ----- Original Message ----- From: "Syahir Hakim" <br>>>> <<a href="mailto:khairulsyahir@gmail.com" target="_blank">khairulsyahir@gmail.com</a>><br>
>>> To: <<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a>><br>>>> Sent: Wednesday, January 19, 2011 9:40 AM<br>>>> Subject: Re: [theme-reviewers] Theme-Check plugin and textdomain<br>
>>><br>>>><br>>>>> It's still showing the warning that the theme is using the twentyten <br>>>>> textdomain. I guess you'd have to include the gettext functions ( __, <br>
>>>> _e, _n, etc.) or exclude 'switch_theme' in the regex.<br>>>>><br>>>>> Anyways, it's not really that big of a deal, but I'm just wondering if <br>>>>> this would cause my theme to fail the upload check at the WP.org <br>
>>>> repository.<br>>>>><br>>>>> And since we're on this topic, how would you guys suggest the best way <br>>>>> to implement an option to delete the theme's options from the database? <br>
>>>> The reason why I use the switch_theme function is so that the user won't <br>>>>> be loading the theme again when the page is reloaded, cause otherwise <br>>>>> the theme will detect that its options entry does not exist in the <br>
>>>> database and will write the default values to the database again.<br>>>>><br>>>>> -- <br>>>>> Regards,<br>>>>> Syahir Hakim<br>>>>><br>>>>> Contact:<br>
>>>> <a href="http://www.khairul-syahir.com" target="_blank">http://www.khairul-syahir.com</a><br>>>>> +6014 753 1883<br>>>>><br>>>>><br>>>>> On 20/1/2011 12:02 AM, Simon Prosser wrote:<br>
>>>>> On 01/19/11 15:49, Syahir Hakim wrote:<br>>>>>>> Erm...so does the theme-check plugin searches for occurrences of the<br>>>>>>> 'twentyten' string, regardless of its context? Clearly in this case my<br>
>>>>>> theme is not using the twentyten textdomain.<br>>>>>> Ive updated the regex to be more strict, its uploaded to SVN but to <br>>>>>> save<br>>>>>> time can you just edit textdomain.php in the checks folder and change <br>
>>>>> to:<br>>>>>><br>>>>>> if ( preg_match( '/(__|_e)\(.*?["|\']twentyten["|\']\s?\)?/', $php ) ) <br>>>>>> {<br>>>>>><br>
>>>>> and see what happens for you, as far as i can tell it still works ok<br>>>>>><br>>>>> _______________________________________________<br>>>>> theme-reviewers mailing list<br>
>>>> <a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>>>>> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
>>>><br>>>><br>>>><br>>>> _______________________________________________<br>>>> theme-reviewers mailing list<br>>>> <a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
>>> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>>>><br>>> _______________________________________________<br>
>> theme-reviewers mailing list<br>>> <a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>>> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
>> <br>> <br>> <br>> _______________________________________________<br>> theme-reviewers mailing list<br>> <a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
> <a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br></div>
</div></div><br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div>