MyBB Community Forums

Full Version: Who Referred ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
persian Translate

update to V:1.3
All Right Reserved By Parsian Team Heart 

[attachment=33232]
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-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.
ooh, that is really good thank you Big Grin

I shall update. Really, this could easily be in the core, especially as it is adding no joins now.
You shouldn't use get_user for this IMO.
Why not Omar? Is it none performant?
v 1.3 translate

All right reserved Heart 

[attachment=33268]
Yay thank you Big Grin I shall go add the translation and of course credit


http://community.mybb.com/mods.php?action=view&pid=311
(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.
Is possible to style username?
Pages: 1 2 3