| 1 |
<?php |
|---|
| 2 |
function profile_pagesetup() { |
|---|
| 3 |
|
|---|
| 4 |
global $profile_id; |
|---|
| 5 |
global $PAGE; |
|---|
| 6 |
global $CFG; |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
// local $pgowner instead for clarity |
|---|
| 10 |
$pgowner = $profile_id; |
|---|
| 11 |
|
|---|
| 12 |
if (isloggedin()) { |
|---|
| 13 |
if (defined("context") && context == "profile" && $pgowner == $_SESSION['userid']) { |
|---|
| 14 |
$PAGE->menu[] = array ( |
|---|
| 15 |
'name' => 'profile', |
|---|
| 16 |
'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/profile/" class="selected">' . __gettext("Your Profile") . '</a></li>'); |
|---|
| 17 |
} else { |
|---|
| 18 |
$PAGE->menu[] = array ( |
|---|
| 19 |
'name' => 'profile', |
|---|
| 20 |
'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/profile/">' . __gettext("Your Profile") . '</a></li>'); |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
if (profile_permissions_check("profile") && defined("context") && context == "profile") { |
|---|
| 24 |
|
|---|
| 25 |
if (user_type($pgowner) == "person") { |
|---|
| 26 |
$PAGE->menu_sub[] = array ( |
|---|
| 27 |
'name' => 'profile:edit', |
|---|
| 28 |
'html' => '<a href="' . $CFG->wwwroot . 'profile/edit.php?profile_id=' . $pgowner . '">' . __gettext("Edit this profile") . '</a>'); |
|---|
| 29 |
|
|---|
| 30 |
$PAGE->menu_sub[] = array ( |
|---|
| 31 |
'name' => 'profile:picedit', |
|---|
| 32 |
'html' => '<a href="' . $CFG->wwwroot . '_icons/?context=profile&profile_id=' . $pgowner . '">' . __gettext("Change site picture") . '</a>'); |
|---|
| 33 |
if (!empty ($CFG->uses_YUI)) { |
|---|
| 34 |
$PAGE->menu_sub[] = array ( |
|---|
| 35 |
'name' => 'profile:widget:manage', |
|---|
| 36 |
'html' => '<a href="' . $CFG->wwwroot . 'mod/widget/manage_widgets.php">' . __gettext("Manage widgets") . '</a>'); |
|---|
| 37 |
} else { |
|---|
| 38 |
$PAGE->menu_sub[] = array ( |
|---|
| 39 |
'name' => 'profile:widget:add', |
|---|
| 40 |
'html' => '<a href="' . $CFG->wwwroot . 'mod/profile/add.php?owner=' . $pgowner . '">' . __gettext("Add widget") . '</a>'); |
|---|
| 41 |
} |
|---|
| 42 |
} |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
$PAGE->search_menu[] = array ( |
|---|
| 47 |
'name' => __gettext("People"), 'user_type' => 'person'); |
|---|
| 48 |
|
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
function profile_init() { |
|---|
| 52 |
|
|---|
| 53 |
global $CFG, $messages, $function, $metatags, $data; |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
if (!isset ($CFG->profilelocation)) { |
|---|
| 57 |
$CFG->profilelocation = $CFG->dirroot . "mod/profile/"; |
|---|
| 58 |
} else { |
|---|
| 59 |
|
|---|
| 60 |
if (!file_exists($CFG->profilelocation . "profile.config.php")) { |
|---|
| 61 |
if (!copy($CFG->dirroot . "mod/profile/profile.config.php", $CFG->profilelocation . "profile.config.php")) { |
|---|
| 62 |
$CFG->profilelocation = $CFG->dirroot . "mod/profile/"; |
|---|
| 63 |
} |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
$css = file_get_contents($CFG->dirroot . "mod/profile/css"); |
|---|
| 69 |
$css = str_replace("{{url}}", $CFG->wwwroot, $css); |
|---|
| 70 |
$metatags .= $css; |
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
$function['profile:init'][] = dirname(__FILE__) . "/lib/function_init.php"; |
|---|
| 75 |
|
|---|
| 76 |
$function['profile:init'][] = dirname(__FILE__) . "/lib/function_upload_foaf.php"; |
|---|
| 77 |
$function['profile:init'][] = $CFG->profilelocation . "profile.config.php"; |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
$function['search:init'][] = dirname(__FILE__) . "/lib/function_init.php"; |
|---|
| 81 |
$function['search:init'][] = $CFG->profilelocation . "profile.config.php"; |
|---|
| 82 |
|
|---|
| 83 |
$function['search:all:tagtypes'][] = dirname(__FILE__) . "/lib/function_search_all_tagtypes.php"; |
|---|
| 84 |
$function['search:all:tagtypes:rss'][] = dirname(__FILE__) . "/lib/function_search_all_tagtypes_rss.php"; |
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
$function['search:display_results'][] = dirname(__FILE__) . "/lib/function_search.php"; |
|---|
| 88 |
$function['search:display_results:rss'][] = dirname(__FILE__) . "/lib/function_search_rss.php"; |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
$function['profile:editfield:display'][] = dirname(__FILE__) . "/lib/function_editfield_display.php"; |
|---|
| 92 |
$function['profile:field:display'][] = dirname(__FILE__) . "/lib/function_field_display.php"; |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
$function['profile:edit'][] = dirname(__FILE__) . "/lib/function_edit.php"; |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
$function['profile:view'][] = dirname(__FILE__) . "/lib/function_view.php"; |
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
$function['profile:display:name'][] = dirname(__FILE__) . "/lib/function_display_name.php"; |
|---|
| 102 |
|
|---|
| 103 |
$function['profile:user:info'][] = dirname(__FILE__) . "/lib/profile_user_info.php"; |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
$function['content:profile:edit'][] = dirname(__FILE__) . "/lib/content_edit.php"; |
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
$function['permissions:check'][] = dirname(__FILE__) . "/lib/permissions_check.php"; |
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
$function['foaf:generate:fields'][] = dirname(__FILE__) . "/lib/generate_foaf_fields.php"; |
|---|
| 113 |
$function['vcard:generate:fields:adr'][] = dirname(__FILE__) . "/lib/generate_vcard_adr_fields.php"; |
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
$function['groups:delete'][] = dirname(__FILE__) . "/lib/groups_delete.php"; |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
$function['profile:rss:publish'][] = dirname(__FILE__) . "/lib/function_rss_publish.php"; |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
listen_for_event("user", "delete", "profile_user_delete"); |
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
//$CFG->widgets->display['profile'] = "profile_widget_display"; |
|---|
| 126 |
//$CFG->widgets->edit['profile'] = "profile_widget_edit"; |
|---|
| 127 |
$CFG->widgets->list[] = array ( |
|---|
| 128 |
'name' => __gettext("Profile widget"), |
|---|
| 129 |
'description' => __gettext("Displays the contents of a profile field."), |
|---|
| 130 |
'type' => "profile::profile"); |
|---|
| 131 |
|
|---|
| 132 |
$CFG->widgets->list[] = array ( |
|---|
| 133 |
'name' => __gettext("Friends widget"), |
|---|
| 134 |
'description' => __gettext("Displays the icons of your most recently logged-in friends."), |
|---|
| 135 |
'type' => "profile::friends"); |
|---|
| 136 |
|
|---|
| 137 |
$CFG->widgets->list[] = array( |
|---|
| 138 |
'name' => __gettext("Files widget"), |
|---|
| 139 |
'description' => __gettext("Displays images of some of your files."), |
|---|
| 140 |
'type' => "profile::files" |
|---|
| 141 |
); |
|---|
| 142 |
*/ |
|---|
| 143 |
} |
|---|
| 144 |
|
|---|
| 145 |
function profile_permissions_check($object) { |
|---|
| 146 |
global $page_owner; |
|---|
| 147 |
|
|---|
| 148 |
if ($object === "profile" && ($page_owner == $_SESSION['userid'] || user_flag_get("admin", $_SESSION['userid']))) { |
|---|
| 149 |
return true; |
|---|
| 150 |
} |
|---|
| 151 |
return false; |
|---|
| 152 |
} |
|---|
| 153 |
|
|---|
| 154 |
function profile_widget_display($widget) { |
|---|
| 155 |
|
|---|
| 156 |
global $CFG, $profile_id, $data, $page_owner, $db; |
|---|
| 157 |
static $profile; |
|---|
| 158 |
|
|---|
| 159 |
if ($widget->type == 'profile::profile') { |
|---|
| 160 |
|
|---|
| 161 |
$profile_id = $page_owner; |
|---|
| 162 |
|
|---|
| 163 |
require_once ($CFG->dirroot . 'profile/profile.class.php'); |
|---|
| 164 |
|
|---|
| 165 |
$profile_field = widget_get_data("profile_widget_field", $widget->ident); |
|---|
| 166 |
$profile_id = $widget->owner; |
|---|
| 167 |
|
|---|
| 168 |
$title = __gettext("Profile widget"); |
|---|
| 169 |
$body = "<p>" . __gettext("This profile box is undefined.") . "</p>"; |
|---|
| 170 |
|
|---|
| 171 |
if (!isset ($profile)) { |
|---|
| 172 |
$profile = new ElggProfile($profile_id); |
|---|
| 173 |
} |
|---|
| 174 |
|
|---|
| 175 |
$field = null; |
|---|
| 176 |
|
|---|
| 177 |
$user_type = user_info("user_type", $widget->owner); |
|---|
| 178 |
|
|---|
| 179 |
foreach ($data['profile:details'] as $field_row) { |
|---|
| 180 |
if ($field_row->internal_name == $profile_field && (empty ($field_row->user_type) || $field_row->user_type == $user_type)) { |
|---|
| 181 |
$field = $field_row; |
|---|
| 182 |
} |
|---|
| 183 |
} |
|---|
| 184 |
|
|---|
| 185 |
$title = $field->name; |
|---|
| 186 |
$value = get_record_sql("select * from " . $CFG->prefix . "profile_data where owner = " . $widget->owner . " and name = " . $db->qstr($field->internal_name)); |
|---|
| 187 |
if (run("users:access_level_check", $value->access)) { |
|---|
| 188 |
$body = display_output_field(array ( |
|---|
| 189 |
$value->value, |
|---|
| 190 |
$field->field_type, |
|---|
| 191 |
$field->internal_name, |
|---|
| 192 |
$field->name, |
|---|
| 193 |
$value->ident |
|---|
| 194 |
)); |
|---|
| 195 |
} else { |
|---|
| 196 |
$body = ""; |
|---|
| 197 |
} |
|---|
| 198 |
|
|---|
| 199 |
return array ( |
|---|
| 200 |
'title' => $title, |
|---|
| 201 |
'content' => $body |
|---|
| 202 |
); |
|---|
| 203 |
} |
|---|
| 204 |
elseif ($widget->type == 'profile::friends') { |
|---|
| 205 |
return profile_friends_widget_display($widget->owner); |
|---|
| 206 |
} |
|---|
| 207 |
elseif ($widget->type == 'profile::files') { |
|---|
| 208 |
return profile_files_widget_display($widget->owner); |
|---|
| 209 |
} |
|---|
| 210 |
|
|---|
| 211 |
} |
|---|
| 212 |
|
|---|
| 213 |
function profile_show_thumbs($id_list, $list_type) { |
|---|
| 214 |
global $profile_id, $page_owner; |
|---|
| 215 |
global $CFG, $USER; |
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
// $parameter[0] is the title of the box; $parameter[1..n] is the user ID |
|---|
| 219 |
|
|---|
| 220 |
$body = ""; |
|---|
| 221 |
$body .= "<table>\n\t<tr>\n"; |
|---|
| 222 |
$cellnum = -1; |
|---|
| 223 |
if ($list_type == 'files') { |
|---|
| 224 |
$in_a_row = 3; |
|---|
| 225 |
} else { |
|---|
| 226 |
$in_a_row = 5; |
|---|
| 227 |
} |
|---|
| 228 |
|
|---|
| 229 |
foreach ($id_list as $key => $ident) { |
|---|
| 230 |
|
|---|
| 231 |
if ($list_type == 'files') { |
|---|
| 232 |
if ($info = get_record_sql('SELECT folder, title, originalname FROM ' . $CFG->prefix . 'files ' . |
|---|
| 233 |
'WHERE ident = ?', array ($page_owner,$ident))) { |
|---|
| 234 |
$displayname = $info->title; |
|---|
| 235 |
$icon_url = $CFG->wwwroot . '_icon/file/' . $ident; |
|---|
| 236 |
$username = user_info('username', $page_owner); |
|---|
| 237 |
$object_url = $CFG->wwwroot . $username . '/files/' . $info->folder . '/' . $ident . '/' . $info->originalname; |
|---|
| 238 |
} |
|---|
| 239 |
} else { |
|---|
| 240 |
|
|---|
| 241 |
$ident = (int) $ident; |
|---|
| 242 |
$info = get_record('users', 'ident', $ident); |
|---|
| 243 |
$_SESSION['user_info_cache'][$ident] = $info; |
|---|
| 244 |
|
|---|
| 245 |
$icon = user_info('icon', $ident); |
|---|
| 246 |
$icon_url = $CFG->wwwroot . '_icon/user/' . $icon . '/w/50'; |
|---|
| 247 |
|
|---|
| 248 |
$info = $_SESSION['user_info_cache'][$ident]; |
|---|
| 249 |
$displayname = run("profile:display:name", $info->ident); |
|---|
| 250 |
$usermenu = ''; |
|---|
| 251 |
$object_url = $CFG->wwwroot . $info->username . '/'; |
|---|
| 252 |
} |
|---|
| 253 |
|
|---|
| 254 |
if ($info) { |
|---|
| 255 |
$cellnum++; |
|---|
| 256 |
if ($cellnum % $in_a_row == 0 && $cellnum > 0) { |
|---|
| 257 |
$body .= "</tr><tr>"; |
|---|
| 258 |
} |
|---|
| 259 |
if ($list_type == 'files') { |
|---|
| 260 |
$body .=<<< END |
|---|
| 261 |
<td> |
|---|
| 262 |
<a href="$object_url"> |
|---|
| 263 |
<img border="0" src="$icon_url" alt="{$displayname}" title="{$displayname}" /> |
|---|
| 264 |
</a> |
|---|
| 265 |
</td> |
|---|
| 266 |
END; |
|---|
| 267 |
} else { |
|---|
| 268 |
$body .=<<< END |
|---|
| 269 |
<td> |
|---|
| 270 |
<div style="clear:right;"> |
|---|
| 271 |
<a href="$object_url"> |
|---|
| 272 |
<img border="0" src="$icon_url" alt="{$displayname}" title="{$displayname}" /> |
|---|
| 273 |
</a> |
|---|
| 274 |
</div> |
|---|
| 275 |
<div> |
|---|
| 276 |
<a href="{$CFG->wwwroot}{$info->username}/">{$info->username}</a> |
|---|
| 277 |
</div> |
|---|
| 278 |
</td> |
|---|
| 279 |
END; |
|---|
| 280 |
} |
|---|
| 281 |
} |
|---|
| 282 |
} |
|---|
| 283 |
|
|---|
| 284 |
$body .= "\t</tr>\n</table>\n"; |
|---|
| 285 |
|
|---|
| 286 |
return $body; |
|---|
| 287 |
} |
|---|
| 288 |
|
|---|
| 289 |
function profile_files_widget_display($userid) { |
|---|
| 290 |
global $CFG; |
|---|
| 291 |
$file_list = array (); |
|---|
| 292 |
$where1 = run("users:access_level_sql_where", $_SESSION['userid']); |
|---|
| 293 |
if ($files = get_records_sql('SELECT * FROM ' . $CFG->prefix . 'files WHERE files_owner = ' . $userid . ' AND ' . $where1 . ' LIMIT 9')) { |
|---|
| 294 |
$file_count = count_records('files', 'files_owner', $userid); |
|---|
| 295 |
foreach ($files as $file) { |
|---|
| 296 |
|
|---|
| 297 |
$file_list[] = (int) $file->ident; |
|---|
| 298 |
|
|---|
| 299 |
} |
|---|
| 300 |
} |
|---|
| 301 |
if ($file_list) { |
|---|
| 302 |
$username = user_info('username', $userid); |
|---|
| 303 |
$title = __gettext('Files'); |
|---|
| 304 |
$menu = array ( |
|---|
| 305 |
array ( |
|---|
| 306 |
'text' => __gettext('View all' |
|---|
| 307 |
), |
|---|
| 308 |
'link' => $CFG->wwwroot . $username . '/files', |
|---|
| 309 |
'title' => $file_count . ' ' . ($file_count == 1 ? __gettext("file" |
|---|
| 310 |
) : __gettext("files")))); |
|---|
| 311 |
$content = profile_show_thumbs($file_list, 'files'); |
|---|
| 312 |
$widget_array = array ( |
|---|
| 313 |
'title' => $title, |
|---|
| 314 |
'menu' => $menu, |
|---|
| 315 |
'content' => $content |
|---|
| 316 |
); |
|---|
| 317 |
} else { |
|---|
| 318 |
$widget_array = array (); |
|---|
| 319 |
} |
|---|
| 320 |
return $widget_array; |
|---|
| 321 |
} |
|---|
| 322 |
|
|---|
| 323 |
function profile_friends_widget_display($userid) { |
|---|
| 324 |
global $CFG; |
|---|
| 325 |
|
|---|
| 326 |
$html = ''; |
|---|
| 327 |
$friends = array (); |
|---|
| 328 |
if ($result = get_records_sql('SELECT DISTINCT u.ident,1 FROM ' . $CFG->prefix . 'friends f |
|---|
| 329 |
JOIN ' . $CFG->prefix . 'users u ON u.ident = f.friend |
|---|
| 330 |
WHERE f.owner = ? AND u.user_type = ? order by u.last_action desc LIMIT 9', array ( |
|---|
| 331 |
$userid, |
|---|
| 332 |
'person' |
|---|
| 333 |
))) { |
|---|
| 334 |
$friend_count = get_record_sql('SELECT count(*) as count FROM ' . $CFG->prefix . 'friends f |
|---|
| 335 |
JOIN ' . $CFG->prefix . 'users u ON u.ident = f.friend |
|---|
| 336 |
WHERE f.owner = ? AND u.user_type = ?', array ( |
|---|
| 337 |
$userid, |
|---|
| 338 |
'person' |
|---|
| 339 |
)); |
|---|
| 340 |
foreach ($result as $row) { |
|---|
| 341 |
$friends[] = (int) $row->ident; |
|---|
| 342 |
} |
|---|
| 343 |
if ($userid != $_SESSION['userid']) { |
|---|
| 344 |
$link = url . "_friends/?owner=$userid"; |
|---|
| 345 |
} else { |
|---|
| 346 |
$link = url . $_SESSION['username'] . "/friends/"; |
|---|
| 347 |
} |
|---|
| 348 |
$title = __gettext('Friends'); |
|---|
| 349 |
$menu_array = array ( |
|---|
| 350 |
array ( |
|---|
| 351 |
'text' => __gettext('View all Friends'), |
|---|
| 352 |
'link' => $link, |
|---|
| 353 |
'title' => $friend_count->count . ' ' . ($friend_count->count == 1 ? __gettext("friend") : __gettext("friends")))); |
|---|
| 354 |
$content = profile_show_thumbs($friends, 'users'); |
|---|
| 355 |
$widget_array = array ( |
|---|
| 356 |
'title' => $title, |
|---|
| 357 |
'menu' => $menu_array, |
|---|
| 358 |
'content' => $content |
|---|
| 359 |
); |
|---|
| 360 |
} else { |
|---|
| 361 |
$widget_array = array (); |
|---|
| 362 |
} |
|---|
| 363 |
return $widget_array; |
|---|
| 364 |
} |
|---|
| 365 |
|
|---|
| 366 |
function profile_widget_edit($widget) { |
|---|
| 367 |
|
|---|
| 368 |
global $CFG, $profile_id, $data, $page_owner; |
|---|
| 369 |
static $profile; |
|---|
| 370 |
|
|---|
| 371 |
if ($widget->type == 'profile::profile') { |
|---|
| 372 |
|
|---|
| 373 |
$profile_id = $page_owner; |
|---|
| 374 |
|
|---|
| 375 |
require_once ($CFG->dirroot . 'profile/profile.class.php'); |
|---|
| 376 |
|
|---|
| 377 |
$profile_field = widget_get_data("profile_widget_field", $widget->ident); |
|---|
| 378 |
|
|---|
| 379 |
if (!isset ($profile)) { |
|---|
| 380 |
$profile = new ElggProfile($profile_id); |
|---|
| 381 |
} |
|---|
| 382 |
|
|---|
| 383 |
$body = "<h2>" . __gettext("Profile widget") . "</h2>"; |
|---|
| 384 |
$body .= "<p>" . __gettext("Select a profile field below; the widget will then display the profile content from this field.") . "</p>"; |
|---|
| 385 |
|
|---|
| 386 |
$body .= "<select name=\"widget_data[profile_widget_field]\">"; |
|---|
| 387 |
|
|---|
| 388 |
$user_type = user_info("user_type", $widget->owner); |
|---|
| 389 |
|
|---|
| 390 |
foreach ($data['profile:details'] as $field_row) { |
|---|
| 391 |
|
|---|
| 392 |
if (empty ($field_row->user_type) || $field_row->user_type == $user_type) { |
|---|
| 393 |
if ($field_row->internal_name == $profile_field) { |
|---|
| 394 |
$selected = "selected=\"selected\""; |
|---|
| 395 |
} else { |
|---|
| 396 |
$selected = ""; |
|---|
| 397 |
} |
|---|
| 398 |
|
|---|
| 399 |
$body .= "<option value=\"" . $field_row->internal_name . $selected . "\">" . $field_row->name . "</option>\n"; |
|---|
| 400 |
} |
|---|
| 401 |
} |
|---|
| 402 |
|
|---|
| 403 |
$body .= "</select>"; |
|---|
| 404 |
|
|---|
| 405 |
} |
|---|
| 406 |
elseif ($widget->type == 'profile::friends') { |
|---|
| 407 |
|
|---|
| 408 |
$body = ''; |
|---|
| 409 |
} |
|---|
| 410 |
elseif ($widget->type == 'profile::files') { |
|---|
| 411 |
|
|---|
| 412 |
$body = ''; |
|---|
| 413 |
} |
|---|
| 414 |
|
|---|
| 415 |
return $body; |
|---|
| 416 |
|
|---|
| 417 |
} |
|---|
| 418 |
function profile_page_owner() { |
|---|
| 419 |
if ($profile_name = optional_param('profile_name')) { |
|---|
| 420 |
if ($profile_id = user_info_username('ident', $profile_name)) { |
|---|
| 421 |
return $profile_id; |
|---|
| 422 |
} |
|---|
| 423 |
} |
|---|
| 424 |
if ($profile_id = optional_param("profile_id", 0, PARAM_INT)) { |
|---|
| 425 |
return $profile_id; |
|---|
| 426 |
} |
|---|
| 427 |
|
|---|
| 428 |
} |
|---|
| 429 |
|
|---|
| 430 |
function profile_user_delete($object_type, $event, $object) { |
|---|
| 431 |
|
|---|
| 432 |
global $CFG, $data; |
|---|
| 433 |
if (!empty ($object->ident) && $object_type == "user" && $event == "delete") { |
|---|
| 434 |
if (is_array($data['profile:details']) && !empty ($data['profile:details'])) { |
|---|
| 435 |
foreach ($data['profile:details'] as $profiletype) { |
|---|
| 436 |
if ($profiletype->field_type == "keywords") { |
|---|
| 437 |
delete_records('tags', 'owner', $object->ident, 'tagtype', $profiletype->internal_name); |
|---|
| 438 |
} |
|---|
| 439 |
} |
|---|
| 440 |
} |
|---|
| 441 |
delete_records('profile_data', 'owner', $object->ident); |
|---|
| 442 |
} |
|---|
| 443 |
return $object; |
|---|
| 444 |
|
|---|
| 445 |
} |
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
|
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
function get_profile_item($userid, $profile_field) { |
|---|
| 457 |
|
|---|
| 458 |
global $CFG, $db, $data; |
|---|
| 459 |
$body = ""; |
|---|
| 460 |
|
<