[theme-reviewers] Note to theme reviewers about settings in themes

Syahir Hakim khairulsyahir at gmail.com
Mon Jun 13 05:34:27 UTC 2011


Er...why not just delete_option('option_name'); ?

-- 
Regards,
Syahir Hakim

Contact:
http://www.khairul-syahir.com
+6421 0333 649


On 13/6/2011 5:26 PM, Emil Uzelac wrote:
> Just out of the curiosity.
>
> Would simple reset button via wpdb query 
> http://codex.wordpress.org/Class_Reference/wpdb be an easier idea to 
> clean/delete data set in Theme Options? Similar to 
> http://themeshaper.com/2010/06/03/sample-theme-options/#comment-57597 
> which is:
>
> if( isset( $_REQUEST['reset'] )) {
> global $wpdb;
> $query = "DELETE FROM $wpdb->options WHERE option_name LIKE 
> 'option_name'";
> $wpdb->query($query);
> header("Location: themes.php?page=theme_options");
> die;
> }
>
> This is copy pasted not sure if this works, but you'll get the idea.
>
> Cheers,
> Emil
>
> ----
> *Emil Uzelac* | ThemeID | T: 224-444-0006 | Twitter: @EmilUzelac | E: 
> emil at themeid.com <mailto:emil at themeid.com> | http://themeid.com 
> <http://themeid.com/>
> Make everything as simple as possible, but not simpler. - Albert Einstein
>
>
>
> On Sun, Jun 12, 2011 at 11:43 PM, Chip Bennett <chip at chipbennett.net 
> <mailto:chip at chipbennett.net>> wrote:
>
>     Themes ideally would use a *delete* hook, not a deactivation hook, for
>     database cleanup.
>
>     Chip
>
>     On 6/12/11, Sayontan Sinha <sayontan at gmail.com
>     <mailto:sayontan at gmail.com>> wrote:
>     > I would like to add to Justin's suggestion and highlight that
>     the uninstall
>     > hook should be treated differently from the deactivation hook.
>     >
>     > The problem with forcing cleanup on a deactivation hook is that
>     occasionally
>     > the WP servers hand out bad copies of themes (I have had that
>     happen quite a
>     > few times on my theme, where users sporadically report broken
>     downloads -
>     > the fix involved Otto rebuilding the download on the faulty server).
>     > Depending on what got downloaded, WP either automatically
>     deactivates the
>     > theme (e.g. missing or broken style.css) and defaults to
>     TwentyTen, or the
>     > user gets a white screen (missing or broken functions.php). In
>     the former at
>     > least, having a deactivation hook do cleanups is fraught with
>     the user
>     > losing hours of work, because the switch to TwentyTen happens
>     without the
>     > user intending to do it.
>     >
>     > Hence cleanup of options should be introduced only upon
>     uninstall, and not
>     > deactivation.
>     >
>     > On Mon, Jun 13, 2011 at 8:10 PM, Justin Tadlock
>     > <justin at justintadlock.com <mailto:justin at justintadlock.com>>wrote:
>     >
>     >> **
>     >> The problem with themes cleaning up after themselves is simply that
>     >> there's
>     >> no uninstall hook.  Once we get that (plus some activate/deactivate
>     >> hooks),
>     >> I'd have no problem in setting some repository rules for themes
>     to delete
>     >> options on uninstall.
>     >>
>     >> As far as using the $default parameter of get_option() and not
>     setting
>     >> defaults, that can be good practice.  However, I see no reason
>     themes
>     >> shouldn't be setting up some defaults using add_option().  Of
>     course,
>     >> there's no activation hook, so some theme authors are just
>     dropping some
>     >> code into functions.php instead of using a hook
>     (load-themes.php might be
>     >> a
>     >> good one) to auto-set default options.
>     >>
>     >>
>     >> On 6/12/2011 10:06 PM, Emil Uzelac wrote:
>     >>
>     >> Or for future release of WP when Theme is deleted all that was
>     associated
>     >> with that specific Theme gets deleted as well. Not all Authors
>     will comply
>     >> with WP guides and not all Themes are downloaded from the
>     repository.
>     >>
>     >>  ----
>     >> *Emil Uzelac* | ThemeID | T: 224-444-0006 | Twitter:
>     @EmilUzelac | E:
>     >> emil at themeid.com <mailto:emil at themeid.com> | http://themeid.com
>     >> Make everything as simple as possible, but not simpler. -
>     Albert Einstein
>     >>
>     >>
>     >>
>     >> On Sun, Jun 12, 2011 at 10:03 PM, Angelo Bertolli <
>     >> angelo.bertolli at gmail.com <mailto:angelo.bertolli at gmail.com>>
>     wrote:
>     >>
>     >>> On 6/12/2011 10:59 PM, Syahir Hakim wrote:
>     >>>
>     >>>> I don't think it's only the theme reviewers who are
>     installing and
>     >>>> trying a lot of themes. It is not unusual at all for regular or
>     >>>> first-timer WP users to try a lot of themes before they
>     settle on one
>     >>>> that they really like. Trying more than 10 themes is quite
>     normal for a
>     >>>> first-timer WP user, I think, and some of my theme users even
>     reported
>     >>>> that they've tried 40+ themes.
>     >>>>
>     >>>
>     >>>  It sounds like WP should have a way of forcing options to be
>     associated
>     >>> with their themes, and cleanup options that are independant of
>     theme
>     >>> code.
>     >>>  For example add_option would automatically associate the
>     option with a
>     >>> particular theme, maybe by directory name.  Then after such a
>     theme no
>     >>> longer exists or is deactivated, WP presents an option to
>     "clean up theme
>     >>> options for theme X"
>     >>>
>     >>>
>     >>>
>     >>> _______________________________________________
>     >>> theme-reviewers mailing list
>     >>> theme-reviewers at lists.wordpress.org
>     <mailto:theme-reviewers at lists.wordpress.org>
>     >>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>     >>>
>     >>
>     >>
>     >> _______________________________________________
>     >> theme-reviewers mailing
>     >>
>     listtheme-reviewers at lists.wordpress.orghttp://lists.wordpress.org/mailman/listinfo/theme-reviewers
>     <http://lists.wordpress.org/mailman/listinfo/theme-reviewers>
>     >>
>     >>
>     >> _______________________________________________
>     >> theme-reviewers mailing list
>     >> theme-reviewers at lists.wordpress.org
>     <mailto:theme-reviewers at lists.wordpress.org>
>     >> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>     >>
>     >>
>     >
>     >
>     > --
>     > Sayontan Sinha
>     > http://mynethome.net | http://mynethome.net/blog
>     > --
>     > Beating Australia in Cricket is like killing a celebrity. The
>     death gets
>     > more coverage than the crime.
>     >
>
>     --
>     Sent from my mobile device
>     _______________________________________________
>     theme-reviewers mailing list
>     theme-reviewers at lists.wordpress.org
>     <mailto:theme-reviewers at lists.wordpress.org>
>     http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers


More information about the theme-reviewers mailing list