Location: PHPKode > projects > ProjectPress > projectpress/pm-admin/edit_member.php
<?php
/**
 * ProjectPress edit member form
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();

define('access',true);

include(dirname(dirname(__FILE__)) . '/config.inc.php');
include(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');

// User is logged in and is an admin.
is_admin();

// Enable for error checking and troubleshooting.
//display_errors();

if (isset($_POST['manage']) && $_POST['manage'] == 'Submit') {
	 
	$first_name = pmdb::connect()->escape($_POST['first_name']);
	$last_name = pmdb::connect()->escape($_POST['last_name']);
	$twitter = pmdb::connect()->escape($_POST['twitter']);
	$facebook = pmdb::connect()->escape($_POST['facebook']);
	$privacy = pmdb::connect()->escape($_POST['privacy']);
	$level = pmdb::connect()->escape($_POST['level']);
	$active = pmdb::connect()->escape($_POST['active']);

	$sql = pmdb::connect()->query("UPDATE ". DB ."members SET first_name='$first_name',last_name='$last_name',twitter='$twitter',facebook='$facebook',
	privacy='$privacy',level='$level',active='$active' WHERE username = '".$_GET['username']."' LIMIT 1");	
}

	$results = pmdb::connect()->get_row("SELECT * FROM ". DB ."members WHERE username = '".$_GET['username']."'");
	//$row = $result->fetch_array();
	
	// User level variables to be used in template setup.
	$level1 = '1';
	$level2 = '2';
	$level3 = '3';
	$level4 = '4';
	$level5 = '5';

	/**
	 * Creates a new template for the add member page.
	 */
	$editmember = new Template(PM_DIR . "pm-includes/tpl/edit_member.tpl");
	$editmember->set("pmurl", get_pm_option('siteurl'));
	$editmember->set("username", $_GET['username']);
	$editmember->set("firstname", $results->first_name);
	$editmember->set("lastname", $results->last_name);
	$editmember->set("twitter", $results->twitter);
	$editmember->set("facebook", $results->facebook);
	$editmember->set("level1", $level1);
	$editmember->set("level2", $level2);
	$editmember->set("level3", $level3);
	$editmember->set("level4", $level4);
	$editmember->set("level5", $level5);
	
	if (defined('PRIVACY')) {
		if($results->privacy == 1) {
	$editmember->set("privacy", 'checked=checked');
		}
	}
	
	if($results->level == $level1) {
	$editmember->set("level1a", 'selected=selected');
		} elseif($results->level == $level2) {
	$editmember->set("level2a", 'selected=selected');
		} elseif($results->level == $level3) {
	$editmember->set("level3a", 'selected=selected');
		} elseif($results->level == $level4) {
	$editmember->set("level4a", 'selected=selected');
		} elseif($results->level == $level5) {
	$editmember->set("level5a", 'selected=selected');
	}
	
	if($results->active == 1) {
	$editmember->set("active", 'checked=checked');
	}

	/**
	 * Outputs the page with add member form.
	 */
	echo $editmember->output();

include(PM_DIR . 'pm-includes/footer.php');
Return current item: ProjectPress