Hope it's a good idea to post this here :x, because it's more a beta test thought
.
I think i found a small improve for the code
(I think you copied it from one of my member color link codes, but its old and had bug in it
), yes i look through the code to find bugs
. (Sorry i can't resist).
In your code stand "SPortal.php":
function sp_loadColors($users = array()) {
global $db_prefix, $scripturl;
if (empty($users))
return false;
$users = !is_array($users) ? array($users) : array_unique($users);
if(empty($color_profile))
$color_profile = array();
else {
foreach($users as $u)
if(isset($color_profile[$u]))
unset($users[$u]);
}
In that way the else part is useless because the $color_profile it's not stored after it goes though the function.
To improve the script a chache the data you could use for example this:
function sp_loadColors($users = array()) {
global $modSettings;
global $color_profile, $db_prefix, $scripturl;
// Can't just look for no users :P.
if (empty($users))
return false;
//New Version? Easier Handling ;D
if(!empty($modSettings['MemberColorLinkInstalled']))
return load_onlineColors($users);
$users = !is_array($users) ? array($users) : array_unique($users);
//First check is it already loaded?
if(empty($color_profile))
$color_profile = array();
else {
foreach($users as $k => $u)
if(isset($color_profile[$u]))
unset($users[$k]);
}
The diffrent now is that the $color_profile is now a global stored variable, and if you load user more than one time it will not be loaded out of the database, because it's allready stored in the $color_profile variable. And this will lower the database loads and speed up the script a little bit
. (And it's integrate the MemberColorLink, as long it is installed.)
It will return the normal $color_profile after the script is finished and work in the same way as before (as long the $color_profile is not a global loaded *g*)
Only a idea to improve 2.0.3 RC1 =).
It's untestet (But i use it in my ssi member color link)
Bye
DIN1031