-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe_module.php
More file actions
28 lines (26 loc) · 901 Bytes
/
e_module.php
File metadata and controls
28 lines (26 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
if (!defined('e107_INIT'))
{
exit;
}
$e_event->register("postuserset", "kbase_postuserset");
function kbase_postuserset($data)
{
if (!empty($data['username']))
{
// make sure we have a user name
global $tp, $sql;
if ($sql->db_Select("user", "user_id", "where user_name = '" . $tp->toDB($data['username']) . "'", "nowhere", false))
{
// if we find the user in the user table then get their details
$row = $sql->db_Fetch();
if ($row['user_id'] > 0)
{
// if the user id is greater than 0 then update the posters details
$newname = $row['user_id'] . "." . $data['username'];
$sql->db_Update("kbase", "kbase_author ='" . $tp->toDB($newname) . "' where SUBSTRING_INDEX(kbase_author,'.',1)='" . $row['user_id'] . "'", false);
}
}
}
}
?>