Code Monkey home page Code Monkey logo

Comments (40)

retlehs avatar retlehs commented on May 18, 2024

also add options to

  • delete first post (wp_delete_post(1, true);)
  • delete sample page
  • delete hello.php plugin

from sage.

johnraz avatar johnraz commented on May 18, 2024

I will try to fix this one this week.

from sage.

colorful-tones avatar colorful-tones commented on May 18, 2024

Yeah, I would steer clear of modifying the .htaccess. Leave this type of stuff to plugins, or at least return .htaccess to default after uninstalling theme. I tried Roots theme, but then decided it wasn't for me, but now my .htaccess is ruined. Of course, I didn't realize that my .htaccess was going to be touched in the first place, but guess I should of read more carefully before testing theme. Not for me.

from sage.

retlehs avatar retlehs commented on May 18, 2024

html5 boilerplate's .htaccess contains many goodies and we're trying to keep as much html5 boilerplate as possible in roots.

sorry that it currently doesn't warn you before doing it (we're working on it) but it's really meant to be used from a new install that you're starting from scratch on -- if you switch to roots from another theme it will modify lots of existing settings as documented on the wiki under theme activation

from sage.

johnraz avatar johnraz commented on May 18, 2024

Yep, the management of the .htaccess file has to be improved and secured. This is a sensible file that could lock un-aware people out of their blog easily.

I was thinking of a way to backup the existing one to maybe be able to restore it later (rename the file or whatever on demand or on theme deactivation).

Enable the edition of the .htaccess file directly in the backend could be a nice addition too but again, people need to be warned of what they may break.

What do you think ?

from sage.

johnraz avatar johnraz commented on May 18, 2024

@retlehs : just got your message now after submitting mine -- should we stick with the warning thing only or should I look into the backup thingy too ?

from sage.

retlehs avatar retlehs commented on May 18, 2024

i agree on all of the above -- i'd like to have editing the .htaccess as part of #5 as well

from sage.

colorful-tones avatar colorful-tones commented on May 18, 2024

I would suggest taking a hybrid approach, and consider dropping some of the html5 boilerplate in order to encourage a larger user (and possibly developer) base. The beauty of Wordpress is the flexibility of user-experience...one can import/export data and doesn't have to be locked in. In a way, you're creating a theme that could make users have to re-install Wordpress every time they want to use a different theme :-/ This is a bit of exaggeration, but I think you get the point. Sorry for harsh criticism, but trying to be helpful and not discouraging. Good luck!

from sage.

retlehs avatar retlehs commented on May 18, 2024

roots = html5 boilerplate + blueprint / 960 / 1140 (soon) + others to come

..but the whole point is that it's based on html5 boilerplate. if someone doesn't want that they really shouldn't even be considering trying roots, but we're definitely going to add in activation options (and theme settings) so that people can choose to enable/disable the htaccess enhancements

from sage.

colorful-tones avatar colorful-tones commented on May 18, 2024

I would recommend making a plugin out of it, and clearly documenting what the plugin is going to do so the user knows beforehand. Then you can say something like: "We highly recommend our plugin..." on the Roots site. And yes I would also recommend backing up the user's existing .htaccess and providing clear instructions on how to return to previous state.

from sage.

johnraz avatar johnraz commented on May 18, 2024

@colorful-tones : I think that as far as we "optionize" and deliver a way to get back to original settings (at least for important file like .htaccess), flexibility and user-experience should be safe ;-)

from sage.

retlehs avatar retlehs commented on May 18, 2024

it's not going to be moved to a plugin... there's lots of other plugin-type functionality in roots that also will be kept in the theme. it's simply going to be made an option.

we clearly document everything that's done in the wiki.

from sage.

johnraz avatar johnraz commented on May 18, 2024

I've been looking into this deeper today.

I was thinking of using a page that would replace the options page.

The theme wouldn't do anything until that page as been reached and submitted.

Then the regular option page would appear in its place.

We should be able to redirect to the "initial setup" page after activation and to display a notice until the initial setup is done.

Sounds good to you ?

from sage.

retlehs avatar retlehs commented on May 18, 2024

sounds great :)

from sage.

johnraz avatar johnraz commented on May 18, 2024

Now that we left the options framework idea behind us, I think I can spend some time on this one.

from sage.

johnraz avatar johnraz commented on May 18, 2024

Ok its shaping gently. I'm still in the process of implementing everything - nothing quite tested yet.

So the flow for now is :

At the "very first" activation --> roots page is set to the activation page.
Once the activation is submitted at least once --> its replaced by the usual options page.

My problem actually is that it seems that redefining the page while the post action is done leads to the replacing page not being ready aka "you don't have sufficient right to access this page" message.

If someone knows a way around this, or maybe something cleaner than what I'm doing now please give it a look in my activation-options branch.

It's time for me to get a walk and enjoy the sun ;-)

from sage.

johnraz avatar johnraz commented on May 18, 2024

Ok back from the park ... Gave me time to think about the bug --> for now I just redirect to the main admin page (dashboard). It does its job.
I was thinking of adding a "message" in the upper part of the screen like the "check that your .htaccess file is writeable" message. It may come later.

from sage.

johnraz avatar johnraz commented on May 18, 2024

Feedback ? ;-)

from sage.

retlehs avatar retlehs commented on May 18, 2024

it's good, thx john

one thing to add is a redirect to the activation page upon activating the theme (using wp_redirect)

i'll change up the ui a bit once i pull it in (but will wait until options page is changed so it'll all be the same)

from sage.

johnraz avatar johnraz commented on May 18, 2024

I'll try to find some spare time this week --- hopefully I'll succeed :p

from sage.

johnraz avatar johnraz commented on May 18, 2024

Mmm I've been pretty busy lately... I have some days off by the end of this week. ;-)

from sage.

retlehs avatar retlehs commented on May 18, 2024

i've had this bookmarked for a while.. https://gist.github.com/857430 (example code for doing activate/deactivate/uninstall hooks)

from sage.

johnraz avatar johnraz commented on May 18, 2024

Yap. But sadly I think it's only applicable to plugins.

from sage.

retlehs avatar retlehs commented on May 18, 2024

started work on this yesterday.. i've got the theme activation page mostly ready (just like how @johnraz had it in his earlier activation branch) but there's still a lot of functionality that needs to be done

found this as well: http://www.krishnakantsharma.com/2011/01/activationdeactivation-hook-for-wordpress-theme/

from sage.

johnraz avatar johnraz commented on May 18, 2024

Yeah ! Looks pretty sexy :-) I like the link too ! I'm gonna give this one a look.

from sage.

eriteric avatar eriteric commented on May 18, 2024

This will take it to the next level

from sage.

retlehs avatar retlehs commented on May 18, 2024

i want this so bad.

just made a new branch called activation and added the theme activation options page that i showed in my last comment but it's not functional at all at this point

+@swalkinshaw

from sage.

retlehs avatar retlehs commented on May 18, 2024

as mentioned in #100 by @r3df:

Are you still thinking of initialization options? Perhaps copying page.php to front-page.php during set-up could be done if "custom front page" is selected as an option? You could even have it selected by default, but that way if you don't want it, you un-check that option and you don't have to worry about it anymore on updates. and if you do have a custom front-page.php it won't get overwritten id you do an update, 'cause it's not in the source.

the copying could be done using the wordpress filesystem api (example in roots-htaccess.php)

from sage.

iRedEarth avatar iRedEarth commented on May 18, 2024

WordPress subdirectories.... on the earlier version I manually changed the code to account for WordPress being installed in a subdirectory. With this update I added a new variable:
$wp_subdir = ltrim( str_replace( get_bloginfo('siteurl') , '' , get_bloginfo('wpurl') ) , '/' ).'/';
then in the array:
$roots_new_non_wp_rules = array(
'css/(.*)' => $wp_subdir.'wp-content/themes/'. $theme_name . '/css/$1',...
but with this code, without the added code, and with the manual changes, I am get 404 errors all over the place, no css, etc. The .htaccess file looks the same as a backed up copy and when I switch back to an older roots based theme, I only get the 3 404 errors I've always gotten (which I expect are the wp-ecommerce peoples fault.) !?? Any suggestions ?

from sage.

retlehs avatar retlehs commented on May 18, 2024

@red-earth that's not related to this ticket or a roots issue since that's something you made on your own, please post over on http://groups.google.com/group/roots-theme

from sage.

johnraz avatar johnraz commented on May 18, 2024

@retlehs : Shouldn't we finally kill this as a wish for 2012 ? :-) Can you sum what's left to do on this ?

from sage.

johnraz avatar johnraz commented on May 18, 2024

Ok I started working on this again.
I think I found a nice way to work around this issue.

My idea is the following:

  • set up an option to know if the theme has been activated yet.
  • if that option is false, create the activation page only (no option page for the theme yet).
  • once the user has saved the activation page, create the regular option page and redirect to it.
    (this is what you can see for now in my fork's master branch)
  • next step is to execute the actual activation based on the options set when saving the activation page (the trick here is to only execute this once, I think this can be achieved by settings each 'activation option' back to false, so they ain't executed).
  • and that's it basically.

I'll put some time to finish this tomorrow (hopefully).

Let me know how you feel about this solution ;-)

from sage.

retlehs avatar retlehs commented on May 18, 2024

@johnraz i'm going to check this out shortly, but based on the commit i see on your activation branch it looks pretty good :)

from sage.

retlehs avatar retlehs commented on May 18, 2024

fyi it looks like your fork is a little behind, specifically the functions.php file

Fatal error: Cannot redeclare roots_robots() (previously declared in functions.php:61) in inc/roots-cleanup.php on line 395

from sage.

johnraz avatar johnraz commented on May 18, 2024

Just fixed that a few minutes ago, I just pushed, should be ok now.

from sage.

retlehs avatar retlehs commented on May 18, 2024

awesome :)

so on a fresh wordpress install i went and activated the theme. i see the new 'theme activation' menu link but i'm not redirected to that page after activating the theme. this is the code we should use for that (slightly tweaked from what you have in there currently):

if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
    wp_redirect(admin_url('themes.php?page=theme_options'));
    exit;
}

also, rather than creating a new menu item for 'theme activation' i think it might be better to just utilize the theme options page but show the activation page instead of regular theme options if that option hasn't been set/saved yet. thoughts?

from sage.

johnraz avatar johnraz commented on May 18, 2024

The redirect was there to redirect to the option page after you submited the activation form ;-).
The code you suggest can be used too to redirect after switching to roots. Both plays well together.

I kinda liked the idea of having a different title in the menu for the activation page (having an item "Theme activation" makes more sens than having "Theme options" but that's my view).

Also I'm thinking of having a separated option array like "roots_activation" or something to make things clearer and better separated.

Agree ?

from sage.

retlehs avatar retlehs commented on May 18, 2024

ahhh. yeah we should use both

okay, keeping 'theme activation' makes sense

separated option array sounds good!

from sage.

johnraz avatar johnraz commented on May 18, 2024

Perfect!

I'd love to see this closed by the end of the week!
I'll do what I can ;-)

from sage.

johnraz avatar johnraz commented on May 18, 2024

New pull request has been made ... Should fix it and merge nicely in master ;-)

from sage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.