imgr8 Posted February 28, 2008 Share Posted February 28, 2008 I am using dotproject for designing a project management tool for my internship and in one file instead of showing the username, I want to show the First Name and the Last initial of the person. I was told to modify the user_username in this code to contact_first_name and contact_last_name fields. The code in the file just grabs the usernames to create a drop down list. Here's the code: // prepare the users filter if (isset( $_POST['show_owner'] )) $AppUI->setState( 'ProjIdxowner', intval( $_POST['show_owner'] ) ); $owner = $AppUI->getState( 'ProjIdxowner' ) !== NULL ? $AppUI->getState( 'ProjIdxowner' ) : 0; $bufferUser = '<select name="show_owner" onchange="document.pickUser.submit()" class="text">'; $bufferUser .= "<OPTION VALUE='0'>".$AppUI->_('All Users'); $usersql = " SELECT user_id, user_username, contact_first_name, contact_last_name FROM users, contacts WHERE user_contact = contact_id ORDER BY contact_last_name"; if (($rows = db_loadList( $usersql, NULL ))) { foreach ($rows as $row) { if ( $owner == $row["user_id"]) $bufferUser .= "<OPTION VALUE='".$row["user_id"]."' SELECTED>".$row["contact_last_name"].', '.$row["contact_first_name"]. ' ('. $row["user_username"]. ')'; else $bufferUser .= "<OPTION VALUE='".$row["user_id"]."'>".$row["contact_last_name"].', '.$row["contact_first_name"]. ' ('. $row["user_username"]. ')'; } } AND it shown in the file using this code: <th nowrap="nowrap"> <a href="?m=projects&orderby=user_username" class="hdr"><?php echo $AppUI->_('Owner');?></a> </th> I am a noob to all this, can anyone just point me in the right direction or just help me modify the code? Link to comment https://forums.phpfreaks.com/topic/93597-calling-usernames/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.