11-11-2016, 09:35 PM
So there's good news. Even though UserSpice 3 wasn't actually using the classes that we use in UserSpice 4, I included them. In fact, you can feel free to grab the latest versions of them from version 4.1.8c if you want.
What makes this particularly good is that you can write all your code in UserSpice 4/5 style and if you upgrade, everything will work. Since it's already included, here's how you would do a query...
Instantiate the database - only needs to be done once per page...can be done in the header
Write a query to search all users and only bring back the one that is logged in.
Echo out whatever db field you want to echo out by putting the column name after the ->
I hope that helps.
What makes this particularly good is that you can write all your code in UserSpice 4/5 style and if you upgrade, everything will work. Since it's already included, here's how you would do a query...
Instantiate the database - only needs to be done once per page...can be done in the header
Code:
$db = DB::getInstance();
Write a query to search all users and only bring back the one that is logged in.
Code:
$findUserQ = $db->query("SELECT * FROM uc_users where id = ?",array($loggedInUser->user_id));
Code:
$u = $findUserQ->first();
Echo out whatever db field you want to echo out by putting the column name after the ->
Code:
echo $u->last_activation_request;
I hope that helps.