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 plc_redirect (l_sites());
31 // attempt to update this person
32 $first_name= $_POST['first_name'];
33 $last_name= $_POST['last_name'];
34 $title= $_POST['title'];
35 $email= $_POST['email'];
36 $phone= $_POST['phone'];
38 $bio= str_replace("\r", "", $_POST['bio']);
39 $password1= $_POST['password1'];
40 $password2= $_POST['password2'];
42 if( $password1 != $password2 ) {
43 $errors[]= "The passwords do not match";
46 if( count($errors) == 0 ) {
47 $update_vals= array();
48 $update_vals['first_name']= $first_name;
49 $update_vals['last_name']= $last_name;
50 $update_vals['title']= $title;
51 $update_vals['email']= $email;
52 $update_vals['phone']= $phone;
53 $update_vals['url']= $url;
54 $update_vals['bio']= $bio;
56 if( $password1 != "" )
57 $update_vals['password']= $password1;
59 $rc= $api->UpdatePerson( intval( $person_id ), $update_vals);
62 plc_redirect(l_person($person_id));
63 } elseif ($rc === NULL) {
64 $errors[] = $api->error();
68 // get details for the user
69 $person_details= $api->GetPersons( array( intval( $person_id ) ), array( "person_id", "first_name", "last_name", "title", "email", "phone", "url", "bio" ) );
70 if ( $person_details === NULL ) {
71 $errors[] = $api->error();
73 $person_detail= $person_details[0];
75 $first_name= $person_detail['first_name'];
76 $last_name= $person_detail['last_name'];
77 $title= $person_detail['title'];
78 $email= $person_detail['email'];
79 $phone= $person_detail['phone'];
80 $url= $person_detail['url'];
81 $bio= $person_detail['bio'];
86 require_once 'plc_drupal.php';
87 drupal_set_title('Update Person');
88 include 'plc_header.php';
92 <h2>Update Account</h2>
95 if( count($errors) > 0 )
97 print( "<p><strong>The following errors occured:</strong>" );
98 print( "<font color='red' size='-1'><ul>\n" );
99 foreach( $errors as $err )
101 print( "<li>$err\n" );
103 print( "</ul></font>\n" );
107 <h3>Personal Information</h3>
109 <form method="post" action="update.php?id=<?php print($person_id); ?>">
110 <input type="hidden" name="submitted" value="1">
112 <table width="100%" cellspacing="0" cellpadding="4" border="0">
116 <td><input type="text" name="first_name"
117 value="<?php print($first_name); ?>" size="30" maxlength="256"></td>
122 <td><input type="text" name="last_name"
123 value="<?php print($last_name); ?>" size="30" maxlength="256"></td>
128 <td><input type="text" name="title"
129 value="<?php print($title); ?>" size="30" maxlength="256"></td>
134 <td><input type="text" name="email"
135 value="<?php print($email); ?>" size="30" maxlength="256"></td>
140 <td><input type="text" name="phone"
141 value="<?php print($phone); ?>" size="30" maxlength="32"></td>
146 <td><input type="text" name="url"
147 value="<?php print($url); ?>" size="30" maxlength="200"></td>
151 <td valign=top>Bio:</td>
152 <td><textarea name="bio" cols="40" rows="5" wrap>
153 <?php print($bio); ?>
158 <td>Password (blank for no change):</td>
159 <td><input type="password" name="password1" size="30" maxlength="256"></td>
163 <td>Repeat Password:</td>
164 <td><input type="password" name="password2" size="30" maxlength="256"></td>
169 <input type="submit" name="Submit" value="Update">
176 include 'plc_footer.php';