Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Move admin "my profile" functionality into com_users #154

Merged
merged 2 commits into from
Jun 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions app/administrator/components/com_admin/admin.php

This file was deleted.

28 changes: 0 additions & 28 deletions app/administrator/components/com_admin/admin.xml

This file was deleted.

21 changes: 0 additions & 21 deletions app/administrator/components/com_admin/controller.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
Expand All @@ -13,10 +13,10 @@
* User profile controller class.
*
* @package Joomla.Administrator
* @subpackage com_admin
* @subpackage com_users
* @since 1.6
*/
class AdminControllerProfile extends JControllerForm
class UsersControllerProfile extends JControllerForm
{
/**
* Method to check if you can edit a record.
Expand Down Expand Up @@ -47,7 +47,7 @@ protected function allowEdit($data = array(), $key = 'id')
*/
public function save($key = null, $urlVar = null)
{
$this->setRedirect(JRoute::_('index.php?option=com_admin&view=profile&layout=edit&id=' . JFactory::getUser()->id, false));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&id=' . JFactory::getUser()->id, false));

$return = parent::save();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@
<form>
<fieldset name="user_details">
<field name="name" type="text"
description="COM_ADMIN_USER_FIELD_NAME_DESC"
label="COM_ADMIN_USER_HEADING_NAME"
description="COM_USERS_USER_FIELD_NAME_DESC"
label="COM_USERS_USER_HEADING_NAME"
required="true"
size="30"
/>

<field name="username" type="text"
description="COM_ADMIN_USER_FIELD_USERNAME_DESC"
label="COM_ADMIN_USER_FIELD_USERNAME_LABEL"
description="COM_USERS_USER_FIELD_USERNAME_DESC"
label="COM_USERS_USER_FIELD_USERNAME_LABEL"
required="true"
size="30"
/>

<field name="password2" type="password"
autocomplete="off"
class="validate-password"
description="COM_ADMIN_USER_FIELD_PASSWORD_DESC"
description="COM_USERS_USER_FIELD_PASSWORD_DESC"
field="password"
filter="raw"
label="JGLOBAL_PASSWORD"
message="COM_ADMIN_USER_FIELD_PASSWORD1_MESSAGE"
message="COM_USERS_USER_FIELD_PASSWORD1_MESSAGE"
size="30"
validate="equals"
/>

<field name="password" type="password"
autocomplete="off"
class="validate-password"
description="COM_ADMIN_USER_FIELD_PASSWORD2_DESC"
description="COM_USERS_USER_FIELD_PASSWORD2_DESC"
filter="raw"
label="COM_ADMIN_USER_FIELD_PASSWORD2_LABEL"
label="COM_USERS_USER_FIELD_PASSWORD2_LABEL"
size="30"
validate="password"
/>

<field name="email" type="email"
class="validate-email"
description="COM_ADMIN_USER_FIELD_EMAIL_DESC"
description="COM_USERS_USER_FIELD_EMAIL_DESC"
label="JGLOBAL_EMAIL"
required="true"
size="30"
Expand All @@ -50,8 +50,8 @@
name="registerDate"
type="calendar"
class="readonly"
label="COM_ADMIN_USER_FIELD_REGISTERDATE_LABEL"
description="COM_ADMIN_USER_FIELD_REGISTERDATE_DESC"
label="COM_USERS_USER_FIELD_REGISTERDATE_LABEL"
description="COM_USERS_USER_FIELD_REGISTERDATE_DESC"
readonly="true"
format="%Y-%m-%d %H:%M:%S"
size="22"
Expand All @@ -62,8 +62,8 @@
name="lastvisitDate"
type="calendar"
class="readonly"
label="COM_ADMIN_USER_FIELD_LASTVISIT_LABEL"
description="COM_ADMIN_USER_FIELD_LASTVISIT_DESC"
label="COM_USERS_USER_FIELD_LASTVISIT_LABEL"
description="COM_USERS_USER_FIELD_LASTVISIT_DESC"
readonly="true"
format="%Y-%m-%d %H:%M:%S"
size="22"
Expand All @@ -86,42 +86,42 @@
<fields name="params">

<!-- Basic user account settings. -->
<fieldset name="settings" label="COM_ADMIN_USER_SETTINGS_FIELDSET_LABEL">
<fieldset name="settings" label="COM_USERS_USER_SETTINGS_FIELDSET_LABEL">

<field name="admin_style" type="templatestyle"
client="administrator"
description="COM_ADMIN_USER_FIELD_BACKEND_TEMPLATE_DESC"
label="COM_ADMIN_USER_FIELD_BACKEND_TEMPLATE_LABEL"
description="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_DESC"
label="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>

<field name="admin_language" type="language"
client="administrator"
description="COM_ADMIN_USER_FIELD_BACKEND_LANGUAGE_DESC"
label="COM_ADMIN_USER_FIELD_BACKEND_LANGUAGE_LABEL"
description="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>

<field name="language" type="language"
client="site"
description="COM_ADMIN_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_ADMIN_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>

<field name="editor" type="plugins" folder="editors"
description="COM_ADMIN_USER_FIELD_EDITOR_DESC"
label="COM_ADMIN_USER_FIELD_EDITOR_LABEL"
description="COM_USERS_USER_FIELD_EDITOR_DESC"
label="COM_USERS_USER_FIELD_EDITOR_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>

<field name="timezone" type="timezone"
label="COM_ADMIN_USER_FIELD_TIMEZONE_LABEL"
description="COM_ADMIN_USER_FIELD_TIMEZONE_DESC"
label="COM_USERS_USER_FIELD_TIMEZONE_LABEL"
description="COM_USERS_USER_FIELD_TIMEZONE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
Expand All @@ -15,10 +15,10 @@
* User model.
*
* @package Joomla.Administrator
* @subpackage com_admin
* @subpackage com_users
* @since 1.6
*/
class AdminModelProfile extends UsersModelUser
class UsersModelProfile extends UsersModelUser
{
/**
* Method to get the record form.
Expand All @@ -33,7 +33,7 @@ class AdminModelProfile extends UsersModelUser
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_admin.profile', 'profile', array('control' => 'jform', 'load_data' => $loadData));
$form = $this->loadForm('com_users.profile', 'profile', array('control' => 'jform', 'load_data' => $loadData));

if (empty($form))
{
Expand All @@ -56,7 +56,7 @@ public function getForm($data = array(), $loadData = true)
{
$form->setFieldAttribute('username', 'required', 'false');
$form->setFieldAttribute('username', 'readonly', 'true');
$form->setFieldAttribute('username', 'description', 'COM_ADMIN_USER_FIELD_NOCHANGE_USERNAME_DESC');
$form->setFieldAttribute('username', 'description', 'COM_USERS_USER_FIELD_NOCHANGE_USERNAME_DESC');
}

// If the user needs to change their password, mark the password fields as required
Expand Down Expand Up @@ -89,7 +89,7 @@ protected function loadFormData()
// Load the users plugins.
JPluginHelper::importPlugin('user');

$this->preprocessData('com_admin.profile', $data);
$this->preprocessData('com_users.profile', $data);

return $data;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
Expand Down Expand Up @@ -31,10 +31,10 @@
}
</script>

<form action="<?php echo JRoute::_('index.php?option=com_admin&view=profile&layout=edit&id=' . $this->item->id); ?>" method="post" name="adminForm" id="profile-form" class="form-validate form-horizontal" enctype="multipart/form-data">
<form action="<?php echo JRoute::_('index.php?option=com_users&view=profile&layout=edit&id=' . $this->item->id); ?>" method="post" name="adminForm" id="profile-form" class="form-validate form-horizontal" enctype="multipart/form-data">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'account')); ?>

<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'account', JText::_('COM_ADMIN_USER_ACCOUNT_DETAILS', true)); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'account', JText::_('COM_USERS_USER_ACCOUNT_DETAILS', true)); ?>
<?php foreach ($this->form->getFieldset('user_details') as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_admin
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
Expand All @@ -13,10 +13,10 @@
* View class to allow users edit their own profile.
*
* @package Joomla.Administrator
* @subpackage com_admin
* @subpackage com_users
* @since 1.6
*/
class AdminViewProfile extends JViewLegacy
class UsersViewProfile extends JViewLegacy
{
protected $form;

Expand Down Expand Up @@ -56,11 +56,11 @@ protected function addToolbar()
{
JFactory::getApplication()->input->set('hidemainmenu', 1);

JToolbarHelper::title(JText::_('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user user-profile');
JToolbarHelper::title(JText::_('COM_USERS_VIEW_PROFILE_TITLE'), 'user user-profile');
JToolbarHelper::apply('profile.apply');
JToolbarHelper::save('profile.save');
JToolbarHelper::cancel('profile.cancel', 'JTOOLBAR_CLOSE');
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_ADMIN_USER_PROFILE_EDIT');
JToolbarHelper::help('JHELP_USERS_USER_PROFILE_EDIT');
}
}
Loading