Just checked your wiki page, and how about changing:
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Include needed files
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'config.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
To this:
$phpEx = strrchr(__FILE__, '.');
// Include needed files
include($phpbb_root_path . 'common' . $phpEx);
include($phpbb_root_path . 'config' . $phpEx);
include($phpbb_root_path . 'includes/functions_user' . $phpEx);
include($phpbb_root_path . 'includes/functions_display' . $phpEx);
include($phpbb_root_path . 'includes/functions_privmsgs' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting' . $phpEx);
I think $phpEx should be ‘.php’ and not ‘php’, you’d get less code, and less dots to write in your variables =)
Edit, you can also merge these two:
public function getUserById($userId)
{
global $table_prefix;
$this->CI->db->select('*');
$this->CI->db->from($table_prefix . 'users');
$this->CI->db->where('user_id', $userId);
$this->CI->db->limit(1);
$query = $this->CI->db->get();
if ($query->num_rows() == 1)
{
return $query->row_array();
}
else
{
return FALSE;
}
}
public function getUserByName($username)
{
global $table_prefix;
$this->CI->db->select('*');
$this->CI->db->from($table_prefix . 'users');
$this->CI->db->where('username', $username);
$this->CI->db->limit(1);
$query = $this->CI->db->get();
if ($query->num_rows() == 1)
{
return $query->row_array();
}
else
{
return FALSE;
}
}
To:
public function getUser($data)
{
global $table_prefix;
$this->CI->db->from($table_prefix . 'users');
if (is_int($data))
{
$this->CI->db->where('user_id', $data);
}
else
{
$this->CI->db->where('username', $data);
}
$this->CI->db->limit(1);
$query = $this->CI->db->get();
if ($query->num_rows() == 1)
{
return $query->row_array();
}
else
{
return FALSE;
}
}
$this->db->select(’*’) and nothing is the same thing =)