Making a New Color Scheme
February 14, 2016
How Permission Levels Work
September 2, 2016
Making a New Color Scheme
February 14, 2016
How Permission Levels Work
September 2, 2016

Upgrading from UserSpice 3.x to 4.0

 
 
This tool will allow you to upgrade from UserSpice 3.x to UserSpice 4.0.0c.  That 4.0.0c is really important, because you can upgrade FROM any version of UserSpice 3 with this tool, but you must go TO version 4.0.0c.  From there, you can install any patches or upgrades, but this tool is very complicated and I don't want to break it, so it stays where it is. The good news is that once you get on the platform of version 4, all the database migrations and upgrades are much simpler.  Just download this package and follow the instructions. 

What will not break...

Anything that is UserSpice related. All the pages for administrating anything. All of the pages that come with UserSpice will work. They'll work because they're all new. Your database will work fine, however it will not work immediately if you try to roll back to version 3.x (There is help for that below). Anything you coded in PHP will work fine as well. Your big change is how you connect to the database. We'll cover that too.

What will break...

UserSpice 4 was completely rewritten from the ground up to be more efficient, more secure, and more object-oriented. Most of the functions of UserSpice 3 and UserCake have been replicated in one way or another, there just might be a different way of doing things. So, what will break? Much of that depends on how you were using UserSpice. If you created your own project and used UserSpice just to control access and page security, pretty much nothing will break, but here are the most common things to look out for.

1. There is a new way of looking for the "logged in user." If you were doing things to echo out the user's code using the old UserSpice function

if(isUserLoggedIn()) {

You need to switch to the more OOP style of

if($user->isLoggedIn()) {

2.

You need to bring your database connection with you. By default UserSpice uses a database class that is object-oriented. If your site used a bunch of mysqli queries, then you need to bring that "connection" over to UserSpice. I would suggest creating it in a separate file in /users/includes/frontend and including it in your header. If you need help with this, just ask in the forums, but it will look something like this...

$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);

3. If you were using the default UserSpice menus as your project's menus, those will be gone and you will have to rebuild them.

Rolling back your database

Ideally, you backed up your database because we told you to do that a few times. However, if you didn't, you can still make UserSpice 4.x database work with your old installation. Just do these two things...

1. Put the database prefix (usually uc_) back on your tables. Add it to users, permissions, permission_page_matches, user_permission_matches, and pages. 2. In the users table, rename the column username to user_name. That's it. There was a lot to do to convert your database to 4.x style, but it's simple to roll it back. You can even make use of the other information that has been added to your tables.