Menu

MOD - Theme Switcher

Help
Mark Jones
2013-07-25
2015-07-23
1 2 > >> (Page 1 of 2)
  • Mark Jones

    Mark Jones - 2013-07-25

    I made a theme switcher for my pickem site, as previewed here: https://sourceforge.net/p/phppickem/discussion/998894/thread/239f8739

    I have made a little how-to for this. All the files and Instructions are included in the zip file.

     
    • WDjoe

      WDjoe - 2013-08-14

      thanks for this theme switcher.
      I have a problem with it though.
      It seems when one person sets a theme, everyone in the database gets their theme changed automatically to the theme of the last person that chose a theme.

      Anyone else have this problem?

       
      • Mark Jones

        Mark Jones - 2013-08-14

        Joe, unfortunately I cannot figure out a way to have this stored in the database for each user. So it just uses cookies. If User1 logs in on a pc, and changes the theme to say, the Bears... then logs out and User2 logs in on the SAME computer... it will still be the Bears theme because it is stored in the cookies.

        If User2 went to a different computer and changed the theme to the Dolphins, it would stay as the Dolphins for his computer.

        If anyone knows how I can store this in the database so the theme follows users no matter what they use to login with, that'd be great.

         
        • WDjoe

          WDjoe - 2013-08-17

          I think I can make it work.
          I will work on it this week when I have extra time.
          I am thinking about adding a row in the users table to hold the template file name then using the user session to call the correct css file when they are logged in.
          Keep you posted.

           
        • WDjoe

          WDjoe - 2013-08-23

          I have done it. I will have to post a more detailed instructions later on when I have time but I will quickly show how I did it below. Sorry I don't have time now to give it in more detail. I have included my files for those that want to take a look at them.

          The only files needed to upload is the "teams" folder (from Mark Jones themes switcher) into the css folder and the "backgrounds" folder.

          You then have to edit your database.

          In the "nflp_users" table on the database add a row named "template_name" I made mine with a varchar(10).

          There are just three files you have to edit. I have attached them to this post. They are the header.php signup.php and the user_edit.php

          ALWAYS BACKUP YOUR FILES THAT YOU WILL BE MESSING WITH*

           

          Last edit: WDjoe 2013-08-24
          • Mark Jones

            Mark Jones - 2013-08-24

            DUDE, nice! I appreciate it. I am about to test it on my site. After that, I'll update my original post to include your instructions and give you credit as well if that's cool with you.

             
            • WDjoe

              WDjoe - 2013-08-24

              By all means go ahead. You did by far most of the work, all I did was add my two cents worth.
              You can see it on my website www.my-nfl.com
              I adjusted it so at the signup page people can choose their favorite theme, then afterwards if they want to ever change it again they can do it from the useredit page.

              I tweaked a couple of files the user_edit.php and the signup.php

              Here are the newer files to use.

               

              Last edit: WDjoe 2013-08-24
              • Jon

                Jon - 2013-08-24

                WDjoe; thanks for taking the time to do this. I've been wanting to make some changes/additions but haven't had a whole lot of time and after setting up the theme switcher I wanted to add it to the DB.

                I used your setup last night but noticed you can't change it in user_edit.php without also setting a new (or entering your current 2x) password. I took a dirty approach and added a condition to the form if the password field is blank, to submit the form without password information.

                My edited user_edit.php file is here:

                edit, i broke it. I'll repost when fixed

                double edit -- i forgot to remove a line, it's fixed
                http://pastebin.com/vQPTuJZd

                 

                Last edit: Jon 2013-08-24
                • WDjoe

                  WDjoe - 2013-08-24

                  Yes that is better than having to add your password each time. I noticed that as well and was going to tackle it when I had more time. I was just happy to have the theme work off the database :-)
                  Seems like time is at a premium for all of us...lol.

                   
  • Mark Jones

    Mark Jones - 2013-07-25

    Here is the zip file.

     
  • Teleute

    Teleute - 2013-07-25

    That's awesome - thanks!

     
  • Mark Jones

    Mark Jones - 2013-07-25

    No problem, if you implement it, let me know how it works for ya.

    With what I have given, it should only take about 10 minutes to install... now, creating all the CSS, php, and images... that's another story LOL.

     
  • Mark Jones

    Mark Jones - 2013-07-30

    I also made some new menus to go along with this, if anyone wants. So basically I have made 2 menu options for the theme switcher. Note, the "modern" menus do require a tiny bit of editing to the "header.php" file. It is real easy though. Instructions included in the zip file.

    The menu works a little differently, but I think it is much more efficient and modern. The entry form, results, and standings pages are located in a sub menu under the "Pick 'Em" menu. The schedule and teams pages are in a submenu located under the "NFL Schedules" menu.

    The right side of the menu has the "Welcome, (logged in user) and "Logout" right next to that.

    I will post only the new menu in a different thread here if that is all that you are interested in.

     
    • WDjoe

      WDjoe - 2013-09-04

      I made a slight change to your menu, see the topic "Allow users to delete their own account."
      It just adds a drop down menu when you click on the 'Welcome, NAME" to include the edit user option page as well as a new option I made so users can delete their account if they don't want to play anymore for whatever reason.

       
  • Mark Jones

    Mark Jones - 2013-07-30

    Here is the zip for the new menus and theme switcher. (This forum only allows 1 attachment per post)

     
    • James Weldon

      James Weldon - 2013-08-21

      Any reason in particular that when i select the team is does NOT apply the team css?

       
      • Mark Jones

        Mark Jones - 2013-08-22

        Not sure... I would go back and double check everything. Make sure you have all the teams CSS files in the right location, etc.

         
        • James Weldon

          James Weldon - 2013-09-01

          They are all in the right place. I have checked everything. submit button doesn't appear to be submitting the command to refresh the page with the new template.

          I went to "my account" and selected it there no change visually, but i did notice that the css was recorded in the DB.

           
          • WDjoe

            WDjoe - 2013-09-01

            Hi,
            Did you edit the code in the includes/header.php file?

            I TRIED TO PLACE THE CODE HERE PUT FOR SOME REASON IT WON'T SHOW UP SO I HAVE INCLUDED THE HEADER.PHP FILE TO THIS POST.

             

            Last edit: WDjoe 2013-09-01
            • James Weldon

              James Weldon - 2013-09-02

              I did edit the header, but for some reason i had 9 more lines of code than you. I copied and pasted it into my header.php and that fixed the problem. Now all i need to do is get my FB comment box to appear to the right and not bottom of the picks and get an NFL Twitter feed in.

              Thank you so much. Have any of you gotten a better "lock until you pay" system in place? Presently I have a paypal button up, but it really requires me to make sure I have money from all the people who are playing for a week. I had old perl based (and asp) that had a great Paypal/accounting system built in. Just got too clunky.

               
  • Robert Leo

    Robert Leo - 2013-08-22

    So, the problem from post #2

    "everyone in the database gets their theme changed automatically to the theme of the last person that chose a theme."

    is fixed?

     
    • Mark Jones

      Mark Jones - 2013-08-22

      Not everyone in the database gets it changed... it is stored in the cookies of the browser. So it isn't "user-related", it is computer/browser related.

      I would like to incorporate it into the databse for each user, but I have not figured it out and have not worked on it since Pre-Season started.

       
  • Robert Leo

    Robert Leo - 2013-08-23

    OK, thanks Mark. I won't use it when and until that's fixed. To me it makes no sense too. Thank you for your efforts. I appreciate it!

     
    • Jon

      Jon - 2013-08-23

      As far as I know there is nothing to fix. The theme selector works as intended. It's a cookie based setting. I used what Mark did and it works fine.

      To clarify on what Mark said when he said "computer/browser" related he meant that the "cookie" setting means it's a setting that is only set to the particular browser you are using on a particular computer. If you log in at work and set it - it will not be there when you get home and use your home computer until you set it there, too.
      At the same time, if you log in once in IE and then again in Chrome/Firefox, the setting will not be there until set in those browsers.

      WDJoe mentions above that he made it a setting stored in the database for each user. This takes away the "issue" (it's not an issue, but I don't know what else to call it) and once you set it, the setting will be saved in the database. From there no matter where you log in from the setting will persist.

      I have not tested what WDJoe did but you're welcome to try it out.

      However, back to my original point; there is no "issue" - If you follow Mark's instructions for his modification, it will work just as it should.

       
  • Mark Jones

    Mark Jones - 2013-08-26

    Simply awesome. You guys (WDjoe, Jon) are great. Thanks for making it work with the database (works great) WDjoe, and thanks Jon for the code that makes it so users don't have to enter their password again.

    I did a lot of work on this, and you guys did your fair share of it too. You guys have helped me make it exactly what I wanted it to be.

    I (and "we" including the rest of the mods posted in this forum) have made so many changes, and it's awesome! I could never imagine going back to the default design/working order of this site, although the original is great as well as serves as our backbone, which we are very thankful for.

    I almost want to repackage the .zip for the site with all of our mods so new guys can have it all by default!

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.