In OJS, I would like to sort the list of All Enrolled users not by family name but by the date added (date registered).
I was wondering which is the file and what is the function that I have to modify by SQL query in order to achieve what I want.
The purpose is to be able to easily see which are the latest users to OJS from within the OJS.
The URL of manager/people/all points us to the pages/manager to find the handler . Within the PeopleHandler, we find the definition of the sort:
*/
function people($args) {
$this->validate();
$this->setupTemplate(true);
$roleDao =& DAORegistry::getDAO('RoleDAO');
if (Request::getUserVar('roleSymbolic')!=null) $roleSymbolic = Request::getUserVar('roleSymbolic');
else $roleSymbolic = isset($args[0])?$args[0]:'all';
$sort = Request::getUserVar('sort');
$sort = isset($sort) ? $sort : 'name';
$sortDirection = Request::getUserVar('sortDirection');
$sortDirection = isset($sortDirection) ? $sortDirection : SORT_DIRECTION_ASC;
if ($roleSymbolic != 'all' && String::regexp_match_get('/^(\w+)s$/', $roleSymbolic, $matches)) {
$roleId = $roleDao->getRoleIdFromPath($matches[1]);
if ($roleId == null) {
Request::redirect(null, null, null, 'all');
}
$roleName = $roleDao->getRoleName($roleId, true);
It is passed to the Data Access Object here (for role-specific searches):
} elseif (!empty($searchInitial)) {
$searchInitial = String::strtoupper($searchInitial);
$searchType = USER_FIELD_INITIAL;
$search = $searchInitial;
}
$rangeInfo = $this->getRangeInfo('users');
if ($roleId) {
$users =& $roleDao->getUsersByRoleId($roleId, $journal->getId(), $searchType, $search, $searchMatch, $rangeInfo, $sort, $sortDirection);
$templateMgr->assign('roleId', $roleId);
switch($roleId) {
case ROLE_ID_JOURNAL_MANAGER:
$helpTopicId = 'journal.roles.journalManager';
break;
case ROLE_ID_EDITOR:
$helpTopicId = 'journal.roles.editor';
break;
case ROLE_ID_SECTION_EDITOR:
$helpTopicId = 'journal.roles.sectionEditor';
Or here (for searches not limited by a role):
$helpTopicId = 'journal.roles.reader';
break;
case ROLE_ID_SUBSCRIPTION_MANAGER:
$helpTopicId = 'journal.roles.subscriptionManager';
break;
default:
$helpTopicId = 'journal.roles.index';
break;
}
} else {
$users =& $roleDao->getUsersByJournalId($journal->getId(), $searchType, $search, $searchMatch, $rangeInfo, $sort, $sortDirection);
$helpTopicId = 'journal.users.allUsers';
}
$templateMgr->assign('currentUrl', Request::url(null, null, 'people', 'all'));
$templateMgr->assign('roleName', $roleName);
$templateMgr->assign_by_ref('users', $users);
$templateMgr->assign_by_ref('thisUser', Request::getUser());
$templateMgr->assign('isReviewer', $roleId == ROLE_ID_REVIEWER);
$templateMgr->assign('searchField', $searchType);
The field that you are interested in is probably users.date_registered:
If you wanted to display that on the screen for sorting, note that the Handler calls the manager/people/enrollment.tpl:
$templateMgr->assign('fieldOptions', $fieldOptions);
$templateMgr->assign('rolePath', $roleDao->getRolePath($roleId));
$templateMgr->assign('alphaList', explode(' ', __('common.alphaList')));
$templateMgr->assign('roleSymbolic', $roleSymbolic);
$templateMgr->assign('sort', $sort);
$templateMgr->assign('sortDirection', $sortDirection);
$session =& Request::getSession();
$session->setSessionVar('enrolmentReferrer', Request::getRequestedArgs());
$templateMgr->display('manager/people/enrollment.tpl');
}
/**
* Search for users to enroll in a specific role.
* @param $args array first parameter is the selected role ID
*/
function enrollSearch($args) {
$this->validate();
$roleDao =& DAORegistry::getDAO('RoleDAO');
See that template here:
Dear ctgraham,
Thanks for your explanation, however, I was unable to figure out how to edit all these files. I am not a computer specialist, so only by looking at the code, I was not able to figure how to edit all these files collectively. I tried single file edits that did not seem to work.
Is it possible to request inclusion of a sort button by “users date added” in future ojs release. For a journal manager this makes a lot of sense, because sometimes is it necessary to identify newly registered users without knowing their e-mail or name - one such example may be in case of registration of people who are trying to exploit the OJS in a criminal manner.