2014-12-09, 10:27 PM
2014-12-10, 12:18 AM
Thank you, but rather than duplicating the entire plugin for two strings I will add admin cp language support and I can then add your new files as a translation.
2014-12-11, 02:29 PM
(2014-12-10, 12:18 AM)Leefish Wrote: [ -> ]Thank you, but rather than duplicating the entire plugin for two strings I will add admin cp language support and I can then add your new files as a translation.
Also, may I ask why you don't take tool of the memprofile variable instead of globals?
Just as a tip,
You could have added memprofile to the global and done
$whorefer_referrals = $lang->no_referrer;
if((int)$memprofile['referrer'] > 0 && ($referral = get_user($memprofile['referrer'])) && $referral['uid'])
$whorefer_referrals = build_profile_link(format_name(htmlspecialchars_uni($referral['username']), $referral['usergroup'], $referral['displaygroup']), $referral['uid']);
(Use it if u want, ignore the variable set in the if statement I like writing with less lines)
But yea, format_name adds the styling, and memprofile gives you an easier way instead of having to search everytime and makes you not have to use a join.
2014-12-11, 02:56 PM
ooh, that is really good thank you
I shall update. Really, this could easily be in the core, especially as it is adding no joins now.
I shall update. Really, this could easily be in the core, especially as it is adding no joins now.
2014-12-12, 01:53 AM
You shouldn't use get_user for this IMO.
2014-12-12, 05:13 AM
Why not Omar? Is it none performant?
2014-12-12, 06:58 AM
2014-12-12, 07:08 AM
Yay thank you I shall go add the translation and of course credit
http://community.mybb.com/mods.php?action=view&pid=311
http://community.mybb.com/mods.php?action=view&pid=311
2014-12-12, 10:13 PM
(2014-12-12, 05:13 AM)Leefish Wrote: [ -> ]Why not Omar? Is it none performant?
Cuz it takes out the whole user row and not just the things you need.
As I said, I wrote it minimal so you'll have to use the db fetch.
Still imo, get_user should have a way to choose what fields you want to take out.
Basically
function get_user($uid, $field = '*')
{
global $mybb, $db;
static $user_cache;
$uid = (int)$uid;
if(!empty($mybb->user) && $uid == $mybb->user['uid'])
{
return $mybb->user;
}
elseif(isset($user_cache[$uid]))
{
return $user_cache[$uid];
}
elseif($uid > 0)
{
$query = $db->simple_select("users", $field, "uid = '{$uid}'");
$user_cache[$uid] = $db->fetch_array($query);
return $user_cache[$uid];
}
return array();
}
As it wouldn't really break anything.
2014-12-13, 10:27 AM
Is possible to style username?