A series of changes to push Elgg's approach to themes in a more CSS driven direction...
[elgg.git] / units / users / userdetails_edit.php
blob6dca82ed4f9e2c26396c7b208b8f357c978b8072
1 <?php
3 global $page_owner;
5 if (run("users:type:get",$page_owner) == 'person' && run("permissions:check",array("userdetails:change", $page_owner))) {
7 if ($page_owner == $_SESSION['userid']) {
8 $name = htmlentities($_SESSION['name']);
9 $email = htmlentities($_SESSION['email']);
10 } else {
11 $info = db_query("select * from users where ident = $page_owner");
12 $info = $info[0];
13 $name = htmlentities(stripslashes($info->name));
14 $email = htmlentities(stripslashes($info->email));
17 $changeName = gettext("Change your full name:"); // gettext variable
18 $displayed = gettext("This name will be displayed throughout the system."); // gettext variable
19 $body = <<< END
21 <form action="index.php" method="post">
23 <h2>
24 $changeName
25 </h2>
26 <p>
27 $displayed
28 </p>
30 END;
32 $body .= run("templates:draw", array(
33 'context' => 'databox',
34 'name' => gettext("Your full name "),
35 'column1' => "<input type=\"text\" name=\"name\" value=\"$name\" />"
39 $emailAddress = gettext("Your email address:"); // gettext variable
40 $emailRules = gettext("This will not be displayed to other users; you can choose to make an email address available via the profile screen."); // gettext variable
41 $body .= <<< END
43 <h2>
44 $emailAddress
45 </h2>
46 <p>
47 $emailRules
48 </p>
50 END;
52 $body .= run("templates:draw", array(
53 'context' => 'databox',
54 'name' => gettext("Your email address "),
55 'column1' => "<input type=\"text\" name=\"email\" value=\"$email\" />"
59 $emailReplies = gettext("Make comments public");
60 $emailRules = gettext("Set this to 'yes' if you would like anyone to be able to comment on your resources (by default only logged-in users can). Note that this may make you vulnerable to spam.");
62 $body .= <<< END
64 <h2>$emailReplies</h2>
65 <p>
66 $emailRules
67 </p>
69 END;
71 $emailreplies = run("users:flags:get",array("publiccomments",$page_owner));
72 if ($emailreplies) {
73 $body .= run("templates:draw", array(
74 'context' => 'databox',
75 'name' => gettext("Public comments: "),
76 'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" checked=\"checked\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" /> " . gettext("No") . "</label>"
79 } else {
80 $body .= run("templates:draw", array(
81 'context' => 'databox',
82 'name' => gettext("Public comments: "),
83 'column1' => "<label><input type=\"radio\" name=\"publiccomments\" value=\"yes\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"publiccomments\" value=\"no\" checked=\"checked\" /> " . gettext("No") . "</label>"
88 $emailReplies = gettext("Receive email messages");
89 $emailRules = gettext("Set this to 'yes' if you would like to receive comments, replies and interesting discussion through your email. You can also access them by clicking on <a href=\"". url ."_activity/\">view your activity</a>.");
91 $body .= <<< END
93 <h2>$emailReplies</h2>
94 <p>
95 $emailRules
96 </p>
98 END;
100 $emailreplies = run("users:flags:get",array("emailreplies",$page_owner));
101 if ($emailreplies) {
102 $body .= run("templates:draw", array(
103 'context' => 'databox',
104 'name' => gettext("Receive messages: "),
105 'column1' => "<label><input type=\"radio\" name=\"receiveemails\" value=\"yes\" checked=\"checked\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"receiveemails\" value=\"no\" /> " . gettext("No") . "</label>"
108 } else {
109 $body .= run("templates:draw", array(
110 'context' => 'databox',
111 'name' => gettext("Receive messages: "),
112 'column1' => "<label><input type=\"radio\" name=\"receiveemails\" value=\"yes\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"receiveemails\" value=\"no\" checked=\"checked\" /> " . gettext("No") . "</label>"
117 $password = gettext("Change your password:"); // gettext variable
118 $passwordRules = gettext("Leave this blank if you're happy to leave your password as it is."); // gettext variable
119 $body .= <<< END
121 <h2>
122 $password
123 </h2>
125 $passwordRules
126 </p>
128 END;
130 $body .= run("templates:draw", array(
131 'context' => 'databox',
132 'name' => gettext("Your password: "),
133 'column1' => "<input type=\"password\" name=\"password1\" value=\"\" />"
137 $body .= run("templates:draw", array(
138 'context' => 'databox',
139 'name' => gettext("Again for verification purposes: "),
140 'column1' => "<input type=\"password\" name=\"password2\" value=\"\" />"
144 // Allow plug-ins to add stuff ...
145 $body .= run("userdetails:edit:details");
147 $id = $page_owner;
149 $save = gettext("Save");
151 $body .= <<< END
153 <p align="center">
154 <input type="hidden" name="action" value="userdetails:update" />
155 <input type="hidden" name="id" value="$page_owner" />
156 <input type="hidden" name="profile_id" value="$page_owner" />
157 <input type="submit" value="$save" />
158 </p>
160 </form>
162 END;
164 $run_result .= $body;