4 require_once 'plc_login.php';
6 // Get session and API handles
7 require_once 'plc_session.php';
11 require_once 'plc_functions.php';
12 require_once 'plc_sorts.php';
15 $_person= $plc->person;
16 $_roles= $_person['role_ids'];
19 $is_submitted= isset($_POST['submitted']) ? $_POST['submitted'] : 0;
21 // show details for the current user.
22 if( isset($_GET['id']) && is_numeric($_GET['id']) ) {
23 $person_id= intval($_GET['id']);
25 header( "location: index.php" );
32 // attempt to update this person
33 $first_name= $_POST['first_name'];
34 $last_name= $_POST['last_name'];
35 $title= $_POST['title'];
36 $email= $_POST['email'];
37 $phone= $_POST['phone'];
39 $bio= str_replace("\r", "", $_POST['bio']);
40 $password1= $_POST['password1'];
41 $password2= $_POST['password2'];
43 if( $password1 != $password2 ) {
44 $errors[]= "The passwords do not match";
47 if( count($errors) == 0 ) {
48 $update_vals= array();
49 $update_vals['first_name']= $first_name;
50 $update_vals['last_name']= $last_name;
51 $update_vals['title']= $title;
52 $update_vals['email']= $email;
53 $update_vals['phone']= $phone;
54 $update_vals['url']= $url;
55 $update_vals['bio']= $bio;
57 if( $password1 != "" )
58 $update_vals['password']= $password1;
60 $rc= $api->UpdatePerson( intval( $person_id ), $update_vals);
63 Header( "Location: /db/persons/index.php?id=$person_id" );
66 elseif ($rc === NULL) {
67 $errors[] = $api->error();
71 // get details for the user
72 $person_details= $api->GetPersons( array( intval( $person_id ) ), array( "person_id", "first_name", "last_name", "title", "email", "phone", "url", "bio" ) );
73 if ( $person_details === NULL ) {
74 $errors[] = $api->error();
76 $person_detail= $person_details[0];
78 $first_name= $person_detail['first_name'];
79 $last_name= $person_detail['last_name'];
80 $title= $person_detail['title'];
81 $email= $person_detail['email'];
82 $phone= $person_detail['phone'];
83 $url= $person_detail['url'];
84 $bio= $person_detail['bio'];
89 require_once 'plc_drupal.php';
90 drupal_set_title('Update Person');
91 include 'plc_header.php';
95 <h2>Update Account</h2>
98 if( count($errors) > 0 )
100 print( "<p><strong>The following errors occured:</strong>" );
101 print( "<font color='red' size='-1'><ul>\n" );
102 foreach( $errors as $err )
104 print( "<li>$err\n" );
106 print( "</ul></font>\n" );
110 <h3>Personal Information</h3>
112 <form method="post" action="update.php?id=<?php print($person_id); ?>">
113 <input type="hidden" name="submitted" value="1">
115 <table width="100%" cellspacing="0" cellpadding="4" border="0">
119 <td><input type="text" name="first_name"
120 value="<?php print($first_name); ?>" size="30" maxlength="256"></td>
125 <td><input type="text" name="last_name"
126 value="<?php print($last_name); ?>" size="30" maxlength="256"></td>
131 <td><input type="text" name="title"
132 value="<?php print($title); ?>" size="30" maxlength="256"></td>
137 <td><input type="text" name="email"
138 value="<?php print($email); ?>" size="30" maxlength="256"></td>
143 <td><input type="text" name="phone"
144 value="<?php print($phone); ?>" size="30" maxlength="32"></td>
149 <td><input type="text" name="url"
150 value="<?php print($url); ?>" size="30" maxlength="200"></td>
154 <td valign=top>Bio:</td>
155 <td><textarea name="bio" cols="40" rows="5" wrap>
156 <?php print($bio); ?>
161 <td>Password (blank for no change):</td>
162 <td><input type="password" name="password1" size="30" maxlength="256"></td>
166 <td>Repeat Password:</td>
167 <td><input type="password" name="password2" size="30" maxlength="256"></td>
172 <input type="submit" name="Submit" value="Update">
179 include 'plc_footer.php';