true, 'local'=>true) ); global $template, $prefixeTable; $template->set_prefilter('profile_content', 'aun2'); $template->set_filename('profile_aun', realpath(USERNOTES_PATH.'profile_addusersnotes.tpl')); if (isset($_GET['user_id'])) { $query = ' select user_id,note FROM ' . USERNOTES_TABLE . ' WHERE user_id = '.$_GET['user_id'].' ;'; $result = pwg_query($query); $row = mysql_fetch_array($result); $note=$row['note']; $template->assign( array( 'NOTESID' => $_GET['user_id'], 'NOTESCONTENT' => htmlspecialchars($note), )); } $template->assign_var_from_handle('PROFILE_AUN', 'profile_aun'); } function aun2($content, &$smarty) { $search = '

'; return str_replace($search, '{$PROFILE_AUN}'."\n".$search, $content); } add_event_handler('save_profile_from_post', 'aun3'); function aun3() { global $prefixeTable; $query = ' DELETE FROM ' . USERNOTES_TABLE . ' WHERE user_id = '.$_POST['inserID2'].' ;'; $result = pwg_query($query); $q = ' INSERT INTO ' . $prefixeTable . 'user_notes(user_id,note)VALUES ("'.$_POST['inserID2'].'","'.$_POST['inseraun'].'");'; pwg_query($q); } add_event_handler('delete_user', 'aun4'); function aun4($user_id) { global $prefixeTable; $query = ' DELETE FROM ' . USERNOTES_TABLE . ' WHERE user_id = '.$user_id.' ;'; $result = pwg_query($query); } add_event_handler('loc_visible_user_list', 'aun5'); function aun5($visible_user_list) { global $template; $template->append('plugin_user_list_column_titles', l10n('Notes')); $user_ids = array(); foreach ($visible_user_list as $i => $user) { $user_ids[$i] = $user['id']; } $user_nums = array_flip($user_ids); if (!empty($user_ids)) { $query = ' select u.id, un.note FROM ' . USERS_TABLE . ' AS u LEFT JOIN '.USERNOTES_TABLE.' AS un on u.id = un.user_id WHERE u.id IN ('.implode(',', $user_ids).') ;'; $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { if (!empty($row['note'])) { $visible_user_list[$user_nums[$row['id']]]['plugin_columns'][] =$row['note'].' '; } if (empty($row['note'])) { load_language('plugin.lang', USERNOTES_PATH); load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); $noempty=l10n('no note'); $visible_user_list[$user_nums[$row['id']]]['plugin_columns'][] =$noempty; } } } return $visible_user_list; } ?>