Citation :
bendenice a écrit:
Super je vais tester ca rapidement.
Sinon vu que tu va t'ennuyer maintenant blueteen
Pense tu que l'on pourrait faire la même chose pour le module système en effet je voudrait mettre un petit logo avec le sexe de l'user dans le block en ligne et dans le bloc nouveau inscrit. J'ai essayer d'adapter les code précédent pou ce module mais ça ne donne rien soit je vois la variable (donc ça marche pas ) soit j'ai une redondance qui me declanche une page blanche
Bon j'ai continuer a avancer dans cette voie (ca me teins a coeur comme affichage

)
Donc voici ce que j'ai fait
modification de la fonction b_system_online_show dans le fichier modules/system/blocks/system_blocks.php
function b_system_online_show()
{
global $xoopsUser, $xoopsModule;
$online_handler =& xoops_gethandler('online');
mt_srand((double)microtime()*1000000);
// set gc probabillity to 10% for now..
if (mt_rand(1, 100) < 11) {
$online_handler->gc(300);
}
if (is_object($xoopsUser)) {
$uid = $xoopsUser->getVar('uid');
$uname = $xoopsUser->getVar('uname');
$sexe = '';
$certification = 0;
} else {
$uid = 0;
$uname = '';
$sexe = '';
$certification = 0;
}
if (is_object($xoopsModule)) {
$online_handler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), $_SERVER['REMOTE_ADDR']);
} else {
$online_handler->write($uid, $uname, time(), 0, $_SERVER['REMOTE_ADDR']);
}
$onlines = $online_handler->getAll();
if (false != $onlines) {
$total = count($onlines);
$block = array();
$guests = 0;
$members = '';
$sexe = '';
$certification = 0;
for ($i = 0; $i < $total; $i++) {
if ($onlines[$i]['online_uid'] > 0) {
$members .= ' <a href="' . XOOPS_URL . '/modules/yogurt/index.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_uname'] . '">' . $onlines[$i]['online_uname'] . '</a>,';
$sexe .= ' <a href="' . XOOPS_URL . '/modules/yogurt/index.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_sexe'] . '">' . $onlines[$i]['online_sexe'] . '</a>,';
$certification .= ' <a href="' . XOOPS_URL . '/modules/yogurt/index.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_certification'] . '">' . $onlines[$i]['online_certification'] . '</a>,';
} else {
$guests++;
}
}
$block['online_total'] = sprintf(_ONLINEPHRASE, $total);
if (is_object($xoopsModule)) {
$mytotal = $online_handler->getCount(new Criteria('online_module', $xoopsModule->getVar('mid')));
$block['online_total'] .= ' ('.sprintf(_ONLINEPHRASEX, $mytotal, $xoopsModule->getVar('name')).')';
}
$block['lang_members'] = _MEMBERS;
$block['lang_guests'] = _GUESTS;
$block['online_sexe'] = _SEXE;
$block['online_certification'] = _CERTIFICATION;
$block['online_names'] = $members;
$block['online_members'] = $total - $guests;
$block['online_guests'] = $guests;
$block['online_sexe'] = $sexe;
$block['online_certification'] = $certification;
$block['lang_more'] = _MORE;
return $block;
} else {
return false;
}
}
a la place de
function b_system_online_show()
{
global $xoopsUser, $xoopsModule;
$online_handler =& xoops_gethandler('online');
mt_srand((double)microtime()*1000000);
// set gc probabillity to 10% for now..
if (mt_rand(1, 100) < 11) {
$online_handler->gc(300);
}
if (is_object($xoopsUser)) {
$uid = $xoopsUser->getVar('uid');
$uname = $xoopsUser->getVar('uname');
$sexe = '';
$certification = 0;
} else {
$uid = 0;
$uname = '';
$sexe = '';
$certification = 0;
}
if (is_object($xoopsModule)) {
$online_handler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), $_SERVER['REMOTE_ADDR']);
} else {
$online_handler->write($uid, $uname, time(), 0, $_SERVER['REMOTE_ADDR']);
}
$onlines = $online_handler->getAll();
if (false != $onlines) {
$total = count($onlines);
$block = array();
$guests = 0;
$members = '';
$sexe = '';
$certification = 0;
for ($i = 0; $i < $total; $i++) {
if ($onlines[$i]['online_uid'] > 0) {
$members .= ' <a href="' . XOOPS_URL . '/modules/yogurt/index.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_uname'] . '">' . $onlines[$i]['online_uname'] . '</a>,';
} else {
$guests++;
}
}
$block['online_total'] = sprintf(_ONLINEPHRASE, $total);
if (is_object($xoopsModule)) {
$mytotal = $online_handler->getCount(new Criteria('online_module', $xoopsModule->getVar('mid')));
$block['online_total'] .= ' ('.sprintf(_ONLINEPHRASEX, $mytotal, $xoopsModule->getVar('name')).')';
}
$block['lang_members'] = _MEMBERS;
$block['lang_guests'] = _GUESTS;
$block['online_names'] = $members;
$block['online_members'] = $total - $guests;
$block['online_guests'] = $guests;
$block['lang_more'] = _MORE;
return $block;
} else {
return false;
}
}
J'ai aussi rajouter ce code dans le fichier modules/system/admin.php juste avant
xoops_cp_footer();
}
?>
//hack insertion profil
//sexe
$profile_handler =& xoops_getmodulehandler('profile','profile');
$uidsystem = intval($_GET['uid']); //get uid from url
if ($uidsystem <= 0) { //if no valid uid passed to url
if (is_object($xoopsUser)) {//if member
$profile = $profile_handler->get($xoopsUser->getVar('uid'));} //get uid for the connected member
else {
header('location: ' . XOOPS_URL); //back to homepage - redirect wherever you want
exit();}
}
else {//if a correct uid passed to url - eg. : index.php?uid=12
$profile = $profile_handler->get($uidsystem);}//get uid passed to url to take right data from profile
$sexe = $profile->getVar('sexe');
$xoopsTpl->assign('sexe',$sexe);
//certification
$profile_handler =& xoops_getmodulehandler('profile','profile');
$uidsystem = intval($_GET['uid']); //get uid from url
if ($uidsystem <= 0) { //if no valid uid passed to url
if (is_object($xoopsUser)) {//if member
$profile = $profile_handler->get($xoopsUser->getVar('uid'));} //get uid for the connected member
else {
header('location: ' . XOOPS_URL); //back to homepage - redirect wherever you want
exit();}
}
else {//if a correct uid passed to url - eg. : index.php?uid=12
$profile = $profile_handler->get($uidsystem);}//get uid passed to url to take right data from profile
$ma_variable = $profile->getVar('ma_variable_texte');
$xoopsTpl->assign('ma_variable_texte',$ma_variable);
//fin hack
mais ca ne marche pas
je suis a cours d'idée la si quelqu'un pouvait m'aiguiller cela serait au top
