Here is what I am trying to do.
1. Custom UCP Module that lets me show only specific Custom Profile Fields for editing.
2. I am planning to make MANY custom profile fields...in the range of about 30-40 so having them in one place on the "edit profile info" like it is by default is not going to work as it would be too chaotic. So basically I just trying to organize them all.

So far I have built the module and it essentially works fine showing only the specific field I want to show. However, when I submit the data on the new module it for some reason tries to send data for all the other fields which of course all of that data is empty because the fields aren't displayed.
Is there a way to do what I want with only sending data for the fields that I have selected to show in the module?
Here is my code:
includes/ucp
Code: Select all
<?php
/**
*
* @package ucp
* @version $Id: ucp_profile.php 10060 2009-08-28 09:26:43Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* ucp_profile
* Changing profile settings
*
* @todo what about pertaining user_sig_options?
* @package ucp
*/
class ucp_wrestlemation
{
var $u_action;
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
$user->add_lang('posting');
$preview = (!empty($_POST['preview'])) ? true : false;
$submit = (!empty($_POST['submit'])) ? true : false;
$delete = (!empty($_POST['delete'])) ? true : false;
$error = $data = array();
$s_hidden_fields = '';
switch ($mode)
{
case 'wrestlemation':
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
$cp = new custom_profile();
$cp_data = $cp_error = array();
add_form_key('ucp_wrestlemation');
if ($submit)
{
// 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_wrestlemation'))
{
$error[] = 'FORM_INVALID';
}
if (!sizeof($error))
{
// 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);
}
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
));
// 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;
}
$template->assign_vars(array(
'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)],
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_UCP_ACTION' => $this->u_action)
);
// Set desired template
$this->tpl_name = 'ucp_profile_' . $mode;
$this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
}
}
?>
Code: Select all
<?php
/**
*
* @package ucp
* @version $Id: ucp_profile.php 8479 2008-03-29 00:22:48Z naderman $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @package module_install
*/
class ucp_wrestlemation_info
{
function module()
{
return array(
'filename' => 'ucp_wrestlemation',
'title' => 'UCP_WRESTLEMATION',
'version' => '1.0.0',
'modes' => array(
'wrestlemation' => array('title' => 'UCP_WRESTLEMATION', 'auth' => '', 'cat' => array('UCP_WRESTLEMATION')),
),
);
}
function install()
{
}
function uninstall()
{
}
}
?>
Code: Select all
<!-- INCLUDE ucp_header.html -->
<form id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}>
<h2>Wrestlemation.com Services</h2>
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<p>{L_PROFILE_INFO_NOTICE}</p>
<fieldset>
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
<!-- BEGIN profile_fields -->
<!-- IF profile_fields.LANG_NAME eq "WrestleMation.com - Userbars" -->
<dl>
<dt><label<!-- IF profile_fields.FIELD_ID --> for="{profile_fields.FIELD_ID}"<!-- ENDIF -->>{profile_fields.LANG_NAME}:<!-- IF profile_fields.S_REQUIRED --> *<!-- ENDIF --></label>
<!-- IF profile_fields.LANG_EXPLAIN --><br /><span>{profile_fields.LANG_EXPLAIN}</span><!-- ENDIF --></dt>
<!-- IF profile_fields.ERROR --><dd class="error">{profile_fields.ERROR}</dd><!-- ENDIF -->
<dd>{profile_fields.FIELD}</dd>
</dl>
<!-- ENDIF -->
<!-- END profile_fields -->
</fieldset>
<span class="corners-bottom"><span></span></span></div>
</div>
<fieldset class="submit-buttons">
{S_HIDDEN_FIELDS}<input type="reset" value="{L_RESET}" name="reset" class="button2" />
<input type="submit" name="submit" value="{L_SUBMIT}" class="button1" />
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- INCLUDE ucp_footer.html -->
I have NOT edited any of the core files