da ich viele Benutzer nachziehen und Daten prüfen muss, habe ich für die adm_program/modules/profile.php (Version 2.4.7) eine Navigation zum vorherigen/letzten (aktiven) Mitglied eingebaut. Wäre schön, wenn das so oder so ähnlich mal in den Hauptcode wandert.
Den Codebereich einfach in der profile.php nach der Zeile
Code: Alles auswählen
require(SERVER_PATH. '/adm_program/system/overall_header.php');
Hier der Code:
Code: Alles auswählen
// *******************************************************************************
// END Navigate to Prev / Next Member
// *******************************************************************************
//only active members
$memberCondition = ' AND EXISTS
(SELECT 1
FROM '. TBL_MEMBERS. ', '. TBL_ROLES. ', '. TBL_CATEGORIES. '
WHERE mem_usr_id = usr_id
AND mem_rol_id = rol_id
AND mem_begin <= \''.DATE_NOW.'\'
AND mem_end > \''.DATE_NOW.'\'
AND rol_valid = 1
AND rol_cat_id = cat_id
AND ( cat_org_id = '. $gCurrentOrganization->getValue('org_id'). '
OR cat_org_id IS NULL )) ';
//Common request
$neighborsCommon = 'SELECT usr_id, last_name.usd_value as last_name, first_name.usd_value as first_name,
email.usd_value as email, website.usd_value as website,
usr_login_name, COALESCE(usr_timestamp_change, usr_timestamp_create) as timestamp,
(SELECT count(*)
FROM '. TBL_ROLES. ', '. TBL_CATEGORIES. ', '. TBL_MEMBERS. '
WHERE rol_valid = 1
AND rol_cat_id = cat_id
AND ( cat_org_id = '. $gCurrentOrganization->getValue('org_id'). '
OR cat_org_id IS NULL )
AND mem_rol_id = rol_id
AND mem_begin <= \''.DATE_NOW.'\'
AND mem_end > \''.DATE_NOW.'\'
AND mem_usr_id = usr_id) as member_this_orga,
(SELECT count(*)
FROM '. TBL_ROLES. ', '. TBL_CATEGORIES. ', '. TBL_MEMBERS. '
WHERE rol_valid = 1
AND rol_cat_id = cat_id
AND cat_org_id <> '. $gCurrentOrganization->getValue('org_id'). '
AND mem_rol_id = rol_id
AND mem_begin <= \''.DATE_NOW.'\'
AND mem_end > \''.DATE_NOW.'\'
AND mem_usr_id = usr_id) as member_other_orga
FROM '. TBL_USERS. '
JOIN '. TBL_USER_DATA. ' as last_name
ON last_name.usd_usr_id = usr_id
AND last_name.usd_usf_id = '. $gProfileFields->getProperty('LAST_NAME', 'usf_id'). '
JOIN '. TBL_USER_DATA. ' as first_name
ON first_name.usd_usr_id = usr_id
AND first_name.usd_usf_id = '. $gProfileFields->getProperty('FIRST_NAME', 'usf_id'). '
LEFT JOIN '. TBL_USER_DATA. ' as email
ON email.usd_usr_id = usr_id
AND email.usd_usf_id = '. $gProfileFields->getProperty('EMAIL', 'usf_id'). '
LEFT JOIN '. TBL_USER_DATA. ' as website
ON website.usd_usr_id = usr_id
AND website.usd_usf_id = '. $gProfileFields->getProperty('WEBSITE', 'usf_id'). '
WHERE usr_valid = 1'.$memberCondition.$searchCondition.'';
//Previous Neighbor
$sql=$neighborsCommon.'AND ((last_name.usd_value < \''.$user->getValue('LAST_NAME').'\')
OR (last_name.usd_value = \''.$user->getValue('LAST_NAME').'\')AND (first_name.usd_value < \''.$user->getValue('FIRST_NAME').'\') )
ORDER BY last_name.usd_value DESC, first_name.usd_value DESC
LIMIT 1';
$result_prevUser=$gDb->fetch_array($gDb->query($sql));
//Following Neighbor
$sql=$neighborsCommon.'AND ((last_name.usd_value > \''.$user->getValue('LAST_NAME').'\')
OR (last_name.usd_value = \''.$user->getValue('LAST_NAME').'\')AND (first_name.usd_value > \''.$user->getValue('FIRST_NAME').'\') )
ORDER BY last_name.usd_value, first_name.usd_value LIMIT 1';
$result_nextUser=$gDb->fetch_array($gDb->query($sql));
//output
if(!empty($result_prevUser) && $gCurrentUser ->editUsers())
{
$prevUser=$result_prevUser['first_name'].' '.$result_prevUser['last_name'];
echo'<div style="text-align:left; float:left;">
<a href="'.$g_root_path.'/adm_program/modules/profile/profile.php?user_id='.$result_prevUser['usr_id'].'"><img
src="'.THEME_PATH.'/icons/back.png" alt="'.$prevUser.'" /></a>
<a href="'.$g_root_path.'/adm_program/modules/profile/profile.php?user_id='.$result_prevUser['usr_id'].'">'.$prevUser.'</a>
</div>';
}
echo $gCurrentUser->viewProfile($result_prevUser['usr_id']);
if(!empty($result_nextUser) && $gCurrentUser ->editUsers())
{
$nextUser=$result_nextUser['first_name'].' '.$result_nextUser['last_name'];
echo '<div style="text-align: right;float:right;">
<a href="'.$g_root_path.'/adm_program/modules/profile/profile.php?user_id='.$result_nextUser['usr_id'].'">'.$nextUser.'</a> <a href="'.$g_root_path.'/adm_program/modules/profile/profile.php?user_id='.$result_nextUser['usr_id'].'"><img
src="'.THEME_PATH.'/icons/forward.png" alt="'.$nextUser.'" /></a>
</div>';
}
// *******************************************************************************
// END Navigate to Prev / Next Member
// *******************************************************************************
Warum wird eigentlich der Navigationsverlauf zurückgesetzt(Zeile 109) und der Zurück-Button nicht angezeigt, wenn man auf seinem eigenen Profil ist?
Gruß red