its because he is using the UID for the query, it should be using the session ID. try this:
(2011-04-28, 02:38 PM)pavemen Wrote: [ -> ]if ($mybb->user['usergroup'] == 4)
{
$query = $db->simple_select("sessions", "useragent", "sid='{$user['sid']}'");
$useragent = $db->fetch_field($query, "useragent");
$user['useragents'] = '<span style="float: right; font-size: 9px;">Useragent: '.$user['useragent'].'</span>';
}
Thank you very much. This code works. You are amazing
Nice work yaldaram..Its possible to put this on their profile?
(2011-04-30, 04:32 AM)kadhafi Wrote: [ -> ]Nice work yaldaram..Its possible to put this on their profile?
Yes, you've to edit member.php file and add the above php code near memprofile_start hook. After that, add the {$useragents} variable in member_profile template.
Hmm ok i will try it on my test site..
I dont know which part of member.php file i will put those codes..Can you tell me which part? I cant find the memprofile_start hook..
lol all user agent are all desame...
(2012-01-26, 05:33 AM)rzoneph Wrote: [ -> ]lol all user agent are all desame...
URL or any screenshot ?
(2011-04-28, 02:38 PM)pavemen Wrote: [ -> ]for performance reasons, I would put the query inside the usergroup check as well. no point in running a query that you wont be using
if ($mybb->user['usergroup'] == 4)
{
$query = $db->simple_select("sessions", "useragent", "uid='{$user['uid']}'");
$useragent = $db->fetch_field($query, "useragent");
$user['useragents'] = '<span style="float: right; font-size: 9px;">Useragent: '.$user['useragent'].'</span>';
}
I was gonna say...
It doesn't work when I permit a special usergroup to see the user agents. There is only "Useragent: " displayed. With the orignal code from the first post however it works. Why is that?