/** * Display the settings page (only one so far) * * @return null * @access public */ public function display_settings() { $sql = 'SELECT user_change, only_title FROM ' . $this->tables->get_table('settings'); $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $active = $row['user_change']; $only_title = $row['only_title']; $this->db->sql_freeresult($result); $user_id = $this->user->data['user_id']; $username = $this->user->data['username']; // Get lastname and firstname from the phpbb_users or the extern table if (\kommodore\secondname\tables::$externTable == true) { $sql = 'SELECT ' . \kommodore\secondname\tables::$column['firstname'] . ' AS firstname, ' . \kommodore\secondname\tables::$column['lastname'] . ' AS lastname FROM ' . \kommodore\secondname\tables::$tableName . ' WHERE ' . \kommodore\secondname\tables::$externUsername . ' = "' . $this->db->sql_escape($username) . '"'; } else { $sql = 'SELECT ' . \kommodore\secondname\tables::$column['firstname'] . ', ' . \kommodore\secondname\tables::$column['lastname'] . ' FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $user_id; } $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); // Pass the second set of variables to the template $this->template->assign_vars(array('U_FIRSTNAME' => $row['firstname'], 'U_LASTNAME' => $row['lastname'], 'U_USERNAME' => $u_c, 'U_ONLY_TITLE' => $only_title == 1 ? false : true, 'S_ACTIVATED' => $active == 1 ? true : false, 'S_NOT_ACTIVATED' => $active == 0 ? true : false)); // Get all titles from the database where the user is a member of the assigned group $sql = 'SELECT name, id FROM ' . $this->tables->get_table('titles') . ' INNER JOIN ' . USER_GROUP_TABLE . ' ON group_id = groups'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $this->template->assign_block_vars('title_block', array('NAME' => $row['name'], 'ID' => $row['id'])); } }
/** * Delete a title * * @param int id The ID of the title to be deleted * @return null * @access public */ public function delete_title($id) { $sql = 'DELETE FROM ' . $this->tables->get_table("titles") . ' WHERE id = ' . (int) $id; $res = $this->db->sql_query($sql); }