Fixing a small css issue in the user class.
[elgg.git] / units / users / userdetails_edit.php
blobbfb790e4c16cfbc0ea7ac0b03bb3b9c4ad47a60b
1 <?php
3 global $page_owner, $CFG;
5 if (user_type($page_owner) == 'person' && run("permissions:check",array("userdetails:change", $page_owner))) {
7 $info = get_record('users','ident',$page_owner);
8 $name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8');
9 $email = htmlspecialchars(stripslashes($info->email), ENT_COMPAT, 'utf-8');
11 $changeName = __gettext("Change your full name:"); // gettext variable
12 $displayed = __gettext("This name will be displayed throughout the system."); // gettext variable
13 $body = <<< END
15 <form action="index.php" method="post">
17 <h2>
18 $changeName
19 </h2>
20 <p>
21 $displayed
22 </p>
24 END;
26 $body .= templates_draw(array(
27 'context' => 'databox',
28 'name' => __gettext("Your full name "),
29 'column1' => "<input type=\"text\" name=\"name\" value=\"$name\" />"
33 $emailAddress = __gettext("Your email address:"); // gettext variable
34 $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
35 $body .= <<< END
37 <h2>
38 $emailAddress
39 </h2>
40 <p>
41 $emailRules
42 </p>
44 END;
46 $body .= templates_draw(array(
47 'context' => 'databox',
48 'name' => __gettext("Your email address "),
49 'column1' => "<input type=\"text\" name=\"email\" value=\"$email\" />"
53 $friendAddress = __gettext("Friendship moderation:"); // gettext variable
54 $friendRules = __gettext("This allows you to choose who can list you as a friend."); // gettext variable
55 $body .= <<< END
57 <h2>
58 $friendAddress
59 </h2>
60 <p>
61 $friendRules
62 </p>
64 END;
66 $friendlevel = "<select name=\"moderation\">";
67 $friendlevel .= "<option value=\"no\" ";
68 if ($info->moderation == "no") {
69 $friendlevel .= "selected=\"selected\"";
71 $friendlevel .= ">" . __gettext("No moderation: anyone can list you as a friend. (Recommended)") . "</option>";
72 $friendlevel .= "<option value=\"yes\" ";
73 if ($info->moderation == "yes") {
74 $friendlevel .= "selected=\"selected\"";
76 $friendlevel .= ">" . __gettext("Moderation: friendships must be approved by you.") . "</option>";
77 $friendlevel .= "<option value=\"priv\" ";
78 if ($info->moderation == "priv") {
79 $friendlevel .= "selected=\"selected\"";
81 $friendlevel .= ">" . __gettext("Private: nobody can list you as a friend.") . "</option>";
82 $friendlevel .= "</select>";
84 $body .= templates_draw(array(
85 'context' => 'databox',
86 'name' => __gettext("Friendship moderation"),
87 'column1' => $friendlevel
91 $emailReplies = __gettext("Make comments public");
92 $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.");
94 $body .= <<< END
96 <h2>$emailReplies</h2>
97 <p>
98 $emailRules
99 </p>
101 END;
103 if (!$CFG->disable_publiccomments) {
104 $publiccomments = user_flag_get("publiccomments",$page_owner);
105 if ($publiccomments) {
106 $body .= templates_draw(array(
107 'context' => 'databox',
108 'name' => __gettext("Public comments: "),
109 '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>"
112 } else {
113 $body .= templates_draw(array(
114 'context' => 'databox',
115 'name' => __gettext("Public comments: "),
116 '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>"
122 $emailReplies = __gettext("Receive email notifications");
123 $emailRules = __gettext("Set this to 'yes' if you would like to receive email copies of any messages you receive. This includes blog comments, notifications when people add you as a friend and more. You can always view these online as part of your recent activity page.");
125 $body .= <<< END
127 <h2>$emailReplies</h2>
129 $emailRules
130 </p>
132 END;
134 $emailreplies = user_flag_get("emailnotifications",$page_owner);
135 if ($emailreplies) {
136 $body .= templates_draw(array(
137 'context' => 'databox',
138 'name' => __gettext("Receive notifications: "),
139 'column1' => "<label><input type=\"radio\" name=\"receivenotifications\" value=\"yes\" checked=\"checked\" /> " . __gettext("Yes") . "</label> <label><input type=\"radio\" name=\"receivenotifications\" value=\"no\" /> " . __gettext("No") . "</label>"
142 } else {
143 $body .= templates_draw(array(
144 'context' => 'databox',
145 'name' => __gettext("Receive notifications: "),
146 'column1' => "<label><input type=\"radio\" name=\"receivenotifications\" value=\"yes\" /> " . __gettext("Yes") . "</label> <label><input type=\"radio\" name=\"receivenotifications\" value=\"no\" checked=\"checked\" /> " . __gettext("No") . "</label>"
151 $password = __gettext("Change your password:"); // gettext variable
152 $passwordRules = __gettext("Leave this blank if you're happy to leave your password as it is."); // gettext variable
153 $body .= <<< END
155 <h2>
156 $password
157 </h2>
159 $passwordRules
160 </p>
162 END;
164 $body .= templates_draw(array(
165 'context' => 'databox',
166 'name' => __gettext("Your password: "),
167 'column1' => "<input type=\"password\" name=\"password1\" value=\"\" />"
171 $body .= templates_draw(array(
172 'context' => 'databox',
173 'name' => __gettext("Again for verification purposes: "),
174 'column1' => "<input type=\"password\" name=\"password2\" value=\"\" />"
178 // Allow plug-ins to add stuff ...
179 $body .= run("userdetails:edit:details");
181 $id = $page_owner;
183 $save = __gettext("Save");
185 $body .= <<< END
187 <p align="center">
188 <input type="hidden" name="action" value="userdetails:update" />
189 <input type="hidden" name="id" value="$page_owner" />
190 <input type="hidden" name="profile_id" value="$page_owner" />
191 END;
192 if (context == "admin") {
193 $body .= '<input type="hidden" name="context" value="admin" />';
195 $body .= <<< END
196 <input type="submit" value="$save" />
197 </p>
199 </form>
201 END;
203 $run_result .= $body;