eigene Tabs/Module
Verfasst: 20.02.2013 18:36
Hallo!
Ich weiss nicht so ganz, ob ich hier in diesem Bereich richtig bin für meine Frage:
Ich habe im Adminpanel unter System fürs UCP ein neues Modul eingerichtet
Da ich nur das Untermodul Profil ändern splitten wollte habe ich in dieser phpb
includes/ucp/info/ucp_profile.php
einfach eine Linie hinzugefügt. Dafür habe ich folgende Linie kopiert
und einfach anders benannt
Dann habe ich natürlich auch die entsprechende HTML in den Templates kopiert und umbenannt
nun musste ich in dieser php
includes/ucp/ucp_profiles.php
noch folgenden Text mit der case profile_details hinzufügen
Allerdings will ich in dem neuen Untermodul nicht mehr die Benutzerdaten anzeigen bzw abfragen, sondern NUR die Custom_Profile-Fields
Was muss ich aus dem Code herauslöschen?
Ich weiss nicht so ganz, ob ich hier in diesem Bereich richtig bin für meine Frage:
Ich habe im Adminpanel unter System fürs UCP ein neues Modul eingerichtet
Da ich nur das Untermodul Profil ändern splitten wollte habe ich in dieser phpb
includes/ucp/info/ucp_profile.php
einfach eine Linie hinzugefügt. Dafür habe ich folgende Linie kopiert
Code: Alles auswählen
'profile_info' => array('title' => 'UCP_PROFILE_PROFILE_INFO', 'auth' => '', 'cat' => array('UCP_PROFILE')),
Code: Alles auswählen
'profile_details' => array('title' => 'UCP_PROFILE_PROFILE_DETAILS', 'auth' => '', 'cat' => array('UCP_PROFILE')),
nun musste ich in dieser php
includes/ucp/ucp_profiles.php
noch folgenden Text mit der case profile_details hinzufügen
Code: Alles auswählen
case 'profile_info':
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
$cp = new custom_profile();
$cp_data = $cp_error = array();
$user->add_lang('mods/skype');
$data = array(
'icq' => request_var('icq', $user->data['user_icq']),
'aim' => request_var('aim', $user->data['user_aim']),
'msn' => request_var('msn', $user->data['user_msnm']),
// skype mod
'skype' => request_var('skype', $user->data['user_skype']),
'skype_type' => request_var('skype_type', $user->data['user_skype_type']),
'yim' => request_var('yim', $user->data['user_yim']),
'jabber' => utf8_normalize_nfc(request_var('jabber', $user->data['user_jabber'], true)),
'website' => request_var('website', $user->data['user_website']),
'location' => utf8_normalize_nfc(request_var('location', $user->data['user_from'], true)),
'occupation' => utf8_normalize_nfc(request_var('occupation', $user->data['user_occ'], true)),
'interests' => utf8_normalize_nfc(request_var('interests', $user->data['user_interests'], true)),
);
if ($config['allow_birthdays'])
{
$data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0;
if ($user->data['user_birthday'])
{
list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']);
}
$data['bday_day'] = request_var('bday_day', $data['bday_day']);
$data['bday_month'] = request_var('bday_month', $data['bday_month']);
$data['bday_year'] = request_var('bday_year', $data['bday_year']);
$data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
}
add_form_key('ucp_profile_info');
if ($submit)
{
$validate_array = array(
'icq' => array(
array('string', true, 3, 15),
array('match', true, '#^[0-9]+$#i')),
'aim' => array('string', true, 3, 255),
'msn' => array('string', true, 5, 255),
// skype mod
'skype' => array('string', true, 6, 32),
'jabber' => array(
array('string', true, 5, 255),
array('jabber')),
'yim' => array('string', true, 5, 255),
'website' => array(
array('string', true, 12, 255),
array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')),
'location' => array('string', true, 2, 100),
'occupation' => array('string', true, 2, 500),
'interests' => array('string', true, 2, 500),
);
if ($config['allow_birthdays'])
{
$validate_array = array_merge($validate_array, array(
'bday_day' => array('num', true, 1, 31),
'bday_month' => array('num', true, 1, 12),
'bday_year' => array('num', true, 1901, gmdate('Y', time()) + 50),
'user_birthday' => array('date', true),
));
}
$error = validate_data($data, $validate_array);
// Birthday duty
// if ($data['bday_day'] == '0' or $data['bday_month'] == '0' or $data['bday_year'] == '0')
// {
// $error[] = $user->lang['NO_BDAY'];
// }
//
// if(($data['bday_day'] == '30' or $data['bday_day'] == '31') and $data['bday_month'] == '2')
// {
// $error[] = $user->lang['NO_BDAY'];
// }
// validate custom profile fields
$cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error);
if (sizeof($cp_error))
{
$error = array_merge($error, $cp_error);
}
if (!check_form_key('ucp_profile_info'))
{
$error[] = 'FORM_INVALID';
}
if (!sizeof($error))
{
$data['notify'] = $user->data['user_notify_type'];
if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')))
{
// User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled)
// Disable notify by Jabber now for this user.
$data['notify'] = NOTIFY_EMAIL;
}
$sql_ary = array(
'user_icq' => $data['icq'],
'user_aim' => $data['aim'],
'user_msnm' => $data['msn'],
// skype mod
'user_skype' => $data['skype'],
'user_skype_type' => $data['skype_type'],
'user_yim' => $data['yim'],
'user_jabber' => $data['jabber'],
'user_website' => $data['website'],
'user_from' => $data['location'],
'user_occ' => $data['occupation'],
'user_interests'=> $data['interests'],
'user_notify_type' => $data['notify'],
);
if ($config['allow_birthdays'])
{
$sql_ary['user_birthday'] = $data['user_birthday'];
}
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
// Update Custom Fields
$cp->update_profile_field_data($user->data['user_id'], $cp_data);
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
if ($config['allow_birthdays'])
{
$s_birthday_day_options = '<option value="0"' . ((!$data['bday_day']) ? ' selected="selected"' : '') . '>--</option>';
for ($i = 1; $i < 32; $i++)
{
$selected = ($i == $data['bday_day']) ? ' selected="selected"' : '';
$s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
}
$s_birthday_month_options = '<option value="0"' . ((!$data['bday_month']) ? ' selected="selected"' : '') . '>--</option>';
for ($i = 1; $i < 13; $i++)
{
$selected = ($i == $data['bday_month']) ? ' selected="selected"' : '';
$s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";
}
$s_birthday_year_options = '';
$now = getdate();
$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';
for ($i = $now['year'] - 100; $i <= $now['year']; $i++)
{
$selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
}
unset($now);
$template->assign_vars(array(
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,
'S_BIRTHDAYS_ENABLED' => true,
));
}
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'ICQ' => $data['icq'],
'YIM' => $data['yim'],
'AIM' => $data['aim'],
'MSN' => $data['msn'],
// skype mod
'SKYPE' => $data['skype'],
'S_SKYPE_TYPE' => $data['skype_type'],
'SKYPE_EXPLAIN' => sprintf($user->lang['SKYPE_EXPLAIN'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=skype') . '">', '</a>'),
'JABBER' => $data['jabber'],
'WEBSITE' => $data['website'],
'LOCATION' => $data['location'],
'OCCUPATION'=> $data['occupation'],
'INTERESTS' => $data['interests'],
));
// Get additional profile fields and assign them to the template block var 'profile_fields'
$user->get_profile_fields($user->data['user_id']);
$cp->generate_profile_fields('profile', $user->get_iso_lang_id());
break;
Allerdings will ich in dem neuen Untermodul nicht mehr die Benutzerdaten anzeigen bzw abfragen, sondern NUR die Custom_Profile-Fields
Was muss ich aus dem Code herauslöschen?