22 if ( $oldversion < 162 ) {
23 $GLOBALS[
'xoopsDB']->queryF(
"UPDATE `" .
$GLOBALS[
'xoopsDB']->prefix(
"profile_field") .
" SET field_valuetype=2 WHERE field_name=umode");
26 if ( $oldversion < 100 ) {
29 $sql =
"DROP TABLE " .
$GLOBALS[
'xoopsDB']->prefix(
"profile_category");
33 $sql =
"DROP TABLE " .
$GLOBALS[
'xoopsDB']->prefix(
"profile_fieldcategory");
37 $GLOBALS[
'xoopsDB']->queryFromFile(XOOPS_ROOT_PATH .
"/modules/" .
$module->getVar(
'dirname',
'n') .
"/sql/mysql.sql");
39 include_once dirname(__FILE__) .
"/install.php";
41 $goupperm_handler =& xoops_getHandler(
"groupperm");
45 $skip_fields[] =
'newemail';
46 $skip_fields[] =
'pm_link';
47 $sql =
"SELECT * FROM `" .
$GLOBALS[
'xoopsDB']->prefix(
"user_profile_field") .
"` WHERE `field_name` NOT IN ('" . implode(
"', '", $skip_fields) .
"')";
51 $fields[] = $myrow[
'field_name'];
53 $object->setVars($myrow,
true);
54 $object->setVar(
'cat_id', 1);
55 if ( !empty($myrow[
'field_register']) ) {
56 $object->setVar(
'step_id', 2);
58 if ( !empty($myrow[
'field_options']) ) {
59 $object->setVar(
'field_options', unserialize($myrow[
'field_options']) );
63 $gperm_itemid = $object->getVar(
'field_id');
64 $sql =
"UPDATE " .
$GLOBALS[
'xoopsDB']->prefix(
"group_permission") .
" SET gperm_itemid = " . $gperm_itemid .
65 " WHERE gperm_itemid = " . $myrow[
'fieldid'] .
66 " AND gperm_modid = " .
$module->getVar(
'mid') .
67 " AND gperm_name IN ('profile_edit', 'profile_search')";
70 $groups_visible = $goupperm_handler->getGroupIds(
"profile_visible", $myrow[
'fieldid'],
$module->getVar(
'mid') );
71 $groups_show = $goupperm_handler->getGroupIds(
"profile_show", $myrow[
'fieldid'],
$module->getVar(
'mid') );
72 foreach ($groups_visible as $ugid ) {
73 foreach ($groups_show as $pgid ) {
74 $sql =
"INSERT INTO " .
$GLOBALS[
'xoopsDB']->prefix(
"profile_visibility") .
75 " (field_id, user_group, profile_group) " .
77 " ({$gperm_itemid}, {$ugid}, {$pgid})";
88 $GLOBALS[
'xoopsDB']->queryF(
"UPDATE `" .
$GLOBALS[
'xoopsDB']->prefix(
"profile_profile") .
"` u, `" .
$GLOBALS[
'xoopsDB']->prefix(
"user_profile") .
"` p SET u.{$field} = p.{$field} WHERE u.profile_id=p.profileid");
92 $sql =
"DROP TABLE " .
$GLOBALS[
'xoopsDB']->prefix(
"user_profile");
96 $sql =
"DROP TABLE " .
$GLOBALS[
'xoopsDB']->prefix(
"user_profile_field");
100 $sql =
"DELETE FROM " .
$GLOBALS[
'xoopsDB']->prefix(
"group_permission") .
101 " WHERE `gperm_modid` = " .
$module->getVar(
'mid') .
" AND `gperm_name` IN ('profile_show', 'profile_visible')";
105 if ($oldversion < 162) {
106 $GLOBALS[
'xoopsDB']->queryF(
"UPDATE `" .
$GLOBALS[
'xoopsDB']->prefix(
"profile_field") .
"` SET `field_valuetype`=1 WHERE `field_name`='umode'");
113 $criteria =
new Criteria(
"field_name",
"('" . implode(
"', '", $user_fields) .
"')",
"IN");