|
modification de xoopsmembers |
|
Régulier
Inscrit: 16/04/2004 12:12
|
Bonjour j'ai sur un intranet xoops avec le module xoopsmembers je voudrait à partir du fichier index.php faire 4 autres fichier. j'ai dans les infos complémentaires des utilisateurs le nom du site auquel il est rataché ( j'ai 4 sites )je voudrait faire 4 page php dérivé de l'index.php j'ai bien essayé de modifié le fichier en mettant au debut :
$op = "submit"; à la place de $op = "form";
et plus loin j'ai :
if ( !empty($HTTP_POST_VARS['bio']) ) {
$match = (!empty($HTTP_POST_VARS['bio'])) ? intval($HTTP_POST_VARS['bio_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('bio', $myts->addSlashes(trim($HTTP_POST_VARS['bio'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('bio', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['bio'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('bio', $myts->addSlashes(trim($HTTP_POST_VARS['bio']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('bio', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['bio'])).'%', 'LIKE'));
break;
}
}
mais la ca depasse mes compétence actuel car je n'arrive pas à forcer pour que le script utilise le cas "XOOPS_MATCH_CONTAIN" : avec comme valeur pour 'bio' site1 ( par exemple ) si quelqu'un pouvait m'aider merci par avance @++ Ayou42
Posté le : 15/12/2005 10:50
Edité par ayou42 sur 16/12/2005 16:23:34
|
|
|
Re: modification de xoopsmembers |
|
Xoops accro
Inscrit: 15/07/2004 11:16
|
salut, partir du fichier index.php est une bonne chose, et tu as juste à rajouter une condition aux requêtes. je viens de tester, et voici ce que ça donne : Liste de tous les membresListe des membres ayant renseigné la cellule 'résidence' avec site1Liste des membres ayant renseigné la cellule 'résidence' avec site2Liste des membres n'ayant pas renseigné la cellule 'résidence'si ça te convient, la manip' à faire est très simple en fait : fais une copie de ton fichier index.php renomme la par exemple : site1.php à l'intérieur de ce fichier, remplace tous les index.php par site1.php (pour conserver une cohérence des liens) ensuite, nous avons 3 requêtes à modifier légèrement. pour mon exemple, j'ai procédé comme suis : vers la ligne 118
$min = $pagesize * ($page - 1);
$max = $pagesize;
$count = "SELECT COUNT(uid) AS total FROM ".$xoopsDB->prefix("users")." "; // Count all the users in the db..
$select = "SELECT uid, name, uname, email, url, user_avatar, user_regdate, user_icq, user_from, user_aim, user_yim, user_msnm, user_viewemail, last_login FROM ".$xoopsDB->prefix("users")." ";
if ( ( $letter != _ML_OTHER ) AND ( $letter != _ML_ALL ) ) {
$where = "WHERE level>0 AND uname LIKE '".$letter."%' AND user_from="site1" ";
} else if ( ( $letter == _ML_OTHER ) AND ( $letter != _ML_ALL ) ) {
$where = "WHERE level>0 AND uname REGEXP '^[1-9]' AND user_from="site1" ";
} else {
$where = "WHERE level>0 AND user_from="site1" ";
}
$sort = "order by $sortby $orderby";
comme tu peux le voir, par 3 fois, après
$where = "WHERE level>0
j'ai rajouté
AND user_from="site1"
Bien respecter les espaces, et les noms. C'est tout, tu sauvegardes, mets en ligne, et testes Tu peux bien entendu faire le test sur d'autres champs de la table users. et sur les valeurs que tu veux.
Posté le : 15/12/2005 12:54
|
|
|
Re: modification de xoopsmembers |
|
Régulier
Inscrit: 16/04/2004 12:12
|
merci bien je vais essayer dans l'aprem super ton aide champagne champagne je vous dirais si c ok @++ Ayou42
Posté le : 15/12/2005 14:50
|
|
|
Re: modification de xoopsmembers |
|
Régulier
Inscrit: 16/04/2004 12:12
|
bon ben je doit etre mal réveillé mais je ne trouve pas dans mon index.php de xoopsmembers la section
min = $pagesize * ($page - 1);
$max = $pagesize;
$count = "SELECT COUNT(uid) AS total FROM ".$xoopsDB->prefix("users")." "; // Count all the users in the db..
$select = "SELECT uid, name, uname, email, url, user_avatar, user_regdate, user_icq, user_from, user_aim, user_yim, user_msnm, user_viewemail, last_login FROM ".$xoopsDB->prefix("users")." ";
if ( ( $letter != _ML_OTHER ) AND ( $letter != _ML_ALL ) ) {
$where = "WHERE level>0 AND uname LIKE '".$letter."%' AND user_from="site1" ";
} else if ( ( $letter == _ML_OTHER ) AND ( $letter != _ML_ALL ) ) {
$where = "WHERE level>0 AND uname REGEXP '^[1-9]' AND user_from="site1" ";
} else {
$where = "WHERE level>0 AND user_from="site1" ";
}
$sort = "order by $sortby $orderby";
je n'est pas du tout la meme structure de plus lorsque je clique sur l'index.php j'arrive de base sur sur un formulaire ou je peut définir des critères de choix merci quand meme pour ce debut d'aide blueteen je vais essayer de me replonger dans la xoopsses pour voir si ce matin je suis plus inspiré si quelqu'un à une idée... @++ Ayou42
Posté le : 16/12/2005 09:01
|
|
|
Re: modification de xoopsmembers |
|
Régulier
Inscrit: 16/04/2004 12:12
|
alors pour l'instant j'essaye de mettre ca au debut :
$op = "submit";
plus loin :
if ( $op == "submit" ) {
$xoopsOption['template_main'] = 'xoopsmembers_searchresults.html';
include XOOPS_ROOT_PATH."/header.php";
$iamadmin = $xoopsUserIsAdmin;
$myts =& MyTextSanitizer::getInstance();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('bio', 'site1', 'LIKE'));
$criteria->add(new Criteria('level', 0, '>'));
j'essaye d'utiliser la fonction "new criteria" avec :
$criteria->add(new Criteria('bio', 'site1', 'LIKE'));
mais je doit mal l'utilisé car je n'est aucun membre en résultat je voudrait en clair que l'élement bio ( commentaire ... ) contienne "site1" mais la je bloque si quelqu'un à une idée ?? @++ Ayou42
Posté le : 16/12/2005 09:30
|
|
|
Re: modification de xoopsmembers |
|
Xoops accro
Inscrit: 15/07/2004 11:16
|
colle nous ici le contenu de ton fichier index.php (entre les balises code) je le testerai chez moi
Posté le : 16/12/2005 10:07
|
|
|
Re: modification de xoopsmembers |
|
Régulier
Inscrit: 16/04/2004 12:12
|
Citation : blueteen a écrit: colle nous ici le contenu de ton fichier index.php (entre les balises code) je le testerai chez moi
merci encore pour ton aide alors voici le code de l'index.php :
<?php
// $Id: index.php,v 1.18 2004/12/26 19:12:10 onokazu Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <http://www.xoops.org/> ... nbsp; //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
include "../../mainfile.php";
$op = "form";
if ( isset($HTTP_POST_VARS['op']) && $HTTP_POST_VARS['op'] == "submit" ) {
$op = "submit";
}
if ( $op == "form" ) {
$xoopsOption['template_main'] = 'xoopsmembers_searchform.html';
include XOOPS_ROOT_PATH."/header.php";
$member_handler =& xoops_gethandler('member');
$total = $member_handler->getUserCount(new Criteria('level', 0, '>'));
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
$uname_text = new XoopsFormText("", "user_uname", 30, 60);
$uname_match = new XoopsFormSelectMatchOption("", "user_uname_match", $value=3);
$uname_tray = new XoopsFormElementTray(_MM_UNAME, " ");
$uname_tray->addElement($uname_match);
$uname_tray->addElement($uname_text);
$name_text = new XoopsFormText("", "user_name", 30, 60);
$name_match = new XoopsFormSelectMatchOption("", "user_name_match", $value=3);
$name_tray = new XoopsFormElementTray(_MM_REALNAME, " ");
$name_tray->addElement($name_match);
$name_tray->addElement($name_text);
$email_text = new XoopsFormText("", "user_email", 30, 60);
$email_match = new XoopsFormSelectMatchOption("", "user_email_match", $value=3);
$email_tray = new XoopsFormElementTray(_MM_EMAIL, " ");
$email_tray->addElement($email_match);
$email_tray->addElement($email_text);
$url_text = new XoopsFormText(_MM_URLC, "user_url", 30, 100);
//$theme_select = new XoopsFormSelectTheme(_MM_THEME, "user_theme");
//$timezone_select = new XoopsFormSelectTimezone(_MM_TIMEZONE, "user_timezone_offset");
$icq_text = new XoopsFormText("", "user_icq", 30, 100);
$icq_match = new XoopsFormSelectMatchOption("", "user_icq_match", $value=3);
$icq_tray = new XoopsFormElementTray(_MM_ICQ, " ");
$icq_tray->addElement($icq_match);
$icq_tray->addElement($icq_text);
$aim_text = new XoopsFormText("", "user_aim", 30, 100);
$aim_match = new XoopsFormSelectMatchOption("", "user_aim_match", $value=3);
$aim_tray = new XoopsFormElementTray(_MM_AIM, " ");
$aim_tray->addElement($aim_match);
$aim_tray->addElement($aim_text);
$yim_text = new XoopsFormText("", "user_yim", 30, 100);
$yim_match = new XoopsFormSelectMatchOption("", "user_yim_match", $value=3);
$yim_tray = new XoopsFormElementTray(_MM_YIM, " ");
$yim_tray->addElement($yim_match);
$yim_tray->addElement($yim_text);
$msnm_text = new XoopsFormText("", "user_msnm", 30, 100);
$msnm_match = new XoopsFormSelectMatchOption("", "user_msnm_match", $value=3);
$msnm_tray = new XoopsFormElementTray(_MM_MSNM, " ");
$msnm_tray->addElement($msnm_match);
$msnm_tray->addElement($msnm_text);
$bio_text = new XoopsFormText("", "bio", 30, 100);
$bio_match = new XoopsFormSelectMatchOption("", "bio_match", $value=3);
$bio_tray = new XoopsFormElementTray(_MM_BIO, " ");
$bio_tray->addElement($bio_match);
$bio_tray->addElement($bio_text);
$location_text = new XoopsFormText(_MM_LOCATION, "user_from", 30, 100);
$occupation_text = new XoopsFormText(_MM_OCCUPATION, "user_occ", 30, 100);
$interest_text = new XoopsFormText(_MM_INTEREST, "user_intrest", 30, 100);
//$bio_text = new XoopsFormText(_MM_EXTRAINFO, "user_bio", 30, 100);
$lastlog_more = new XoopsFormText(_MM_LASTLOGMORE, "user_lastlog_more", 10, 5);
$lastlog_less = new XoopsFormText(_MM_LASTLOGLESS, "user_lastlog_less", 10, 5);
$reg_more = new XoopsFormText(_MM_REGMORE, "user_reg_more", 10, 5);
$reg_less = new XoopsFormText(_MM_REGLESS, "user_reg_less", 10, 5);
$posts_more = new XoopsFormText(_MM_POSTSMORE, "user_posts_more", 10, 5);
$posts_less = new XoopsFormText(_MM_POSTSLESS, "user_posts_less", 10, 5);
$sort_select = new XoopsFormSelect(_MM_SORT, "user_sort");
$sort_select->addOptionArray(array("uname"=>_MM_UNAME,"email"=>_MM_EMAIL,"last_login"=>_MM_LASTLOGIN,"user_regdate"=>_MM_REGDATE,"posts"=>_MM_POSTS));
$order_select = new XoopsFormSelect(_MM_ORDER, "user_order");
$order_select->addOptionArray(array("ASC"=>_MM_ASC,"DESC"=>_MM_DESC));
$limit_text = new XoopsFormText(_MM_LIMIT, "limit", 6, 2);
$op_hidden = new XoopsFormHidden("op", "submit");
$submit_button = new XoopsFormButton("", "user_submit", _SUBMIT, "submit");
$form = new XoopsThemeForm("", "searchform", "index.php");
$form->addElement($uname_tray);
$form->addElement($name_tray);
$form->addElement($email_tray);
//$form->addElement($theme_select);
//$form->addElement($timezone_select);
$form->addElement($icq_tray);
$form->addElement($aim_tray);
$form->addElement($yim_tray);
$form->addElement($msnm_tray);
$form->addElement($bio_tray);
$form->addElement($url_text);
$form->addElement($location_text);
$form->addElement($occupation_text);
$form->addElement($interest_text);
//$form->addElement($bio_text);
$form->addElement($lastlog_more);
$form->addElement($lastlog_less);
$form->addElement($reg_more);
$form->addElement($reg_less);
$form->addElement($posts_more);
$form->addElement($posts_less);
$form->addElement($sort_select);
$form->addElement($order_select);
$form->addElement($limit_text);
$form->addElement($op_hidden);
$form->addElement($submit_button);
$form->assign($xoopsTpl);
$xoopsTpl->assign('lang_search', _MM_SEARCH);
$xoopsTpl->assign('lang_totalusers', sprintf(_MM_TOTALUSERS, '<span style="color:#ff0000;">'.$total.'</span>'));
}
if ( $op == "submit" ) {
$xoopsOption['template_main'] = 'xoopsmembers_searchresults.html';
include XOOPS_ROOT_PATH."/header.php";
$iamadmin = $xoopsUserIsAdmin;
$myts =& MyTextSanitizer::getInstance();
$criteria = new CriteriaCompo();
if ( !empty($HTTP_POST_VARS['user_uname']) ) {
$match = (!empty($HTTP_POST_VARS['user_uname_match'])) ? intval($HTTP_POST_VARS['user_uname_match']) : XOOPS_MATCH_START;
switch ( $match ) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('uname', $myts->addSlashes(trim($HTTP_POST_VARS['user_uname'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('uname', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_uname'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('uname', $myts->addSlashes(trim($HTTP_POST_VARS['user_uname']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('uname', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_uname'])).'%', 'LIKE'));
break;
}
}
if ( !empty($HTTP_POST_VARS['user_name']) ) {
$match = (!empty($HTTP_POST_VARS['user_name_match'])) ? intval($HTTP_POST_VARS['user_name_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('name', $myts->addSlashes(trim($HTTP_POST_VARS['user_name'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('name', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_name'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('name', $myts->addSlashes(trim($HTTP_POST_VARS['user_name']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('name', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_name'])).'%', 'LIKE'));
break;
}
}
if ( !empty($HTTP_POST_VARS['user_email']) ) {
$match = (!empty($HTTP_POST_VARS['user_email_match'])) ? intval($HTTP_POST_VARS['user_email_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('email', $myts->addSlashes(trim($HTTP_POST_VARS['user_email'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('email', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_email'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('email', $myts->addSlashes(trim($HTTP_POST_VARS['user_email']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('email', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_email'])).'%', 'LIKE'));
break;
}
if ( !$iamadmin ) {
$criteria->add(new Criteria('user_viewemail', 1));
}
}
if ( !empty($HTTP_POST_VARS['user_url']) ) {
$url = formatURL(trim($HTTP_POST_VARS['user_url']));
$criteria->add(new Criteria('url', $myts->addSlashes($url).'%', 'LIKE'));
}
if ( !empty($HTTP_POST_VARS['user_icq']) ) {
$match = (!empty($HTTP_POST_VARS['user_icq_match'])) ? intval($HTTP_POST_VARS['user_icq_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('user_icq', $myts->addSlashes(trim($HTTP_POST_VARS['user_icq'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_icq'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('user_icq', $myts->addSlashes(trim($HTTP_POST_VARS['user_icq']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('user_icq', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_icq'])).'%', 'LIKE'));
break;
}
}
if ( !empty($HTTP_POST_VARS['user_aim']) ) {
$match = (!empty($HTTP_POST_VARS['user_aim_match'])) ? intval($HTTP_POST_VARS['user_aim_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('user_aim', $myts->addSlashes(trim($HTTP_POST_VARS['user_aim'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('user_aim', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_aim'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('user_aim', $myts->addSlashes(trim($HTTP_POST_VARS['user_aim']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('user_aim', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_aim'])).'%', 'LIKE'));
break;
}
}
if ( !empty($HTTP_POST_VARS['user_yim']) ) {
$match = (!empty($HTTP_POST_VARS['user_yim_match'])) ? intval($HTTP_POST_VARS['user_yim_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('user_yim', $myts->addSlashes(trim($HTTP_POST_VARS['user_yim'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('user_yim', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_yim'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('user_yim', $myts->addSlashes(trim($HTTP_POST_VARS['user_yim']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('user_yim', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_yim'])).'%', 'LIKE'));
break;
}
}
if ( !empty($HTTP_POST_VARS['user_msnm']) ) {
$match = (!empty($HTTP_POST_VARS['user_msnm_match'])) ? intval($HTTP_POST_VARS['user_msnm_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('user_msnm', $myts->addSlashes(trim($HTTP_POST_VARS['user_msnm'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_msnm'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('user_msnm', $myts->addSlashes(trim($HTTP_POST_VARS['user_msnm']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_msnm'])).'%', 'LIKE'));
break;
}
}
if ( !empty($HTTP_POST_VARS['bio']) ) {
$match = (!empty($HTTP_POST_VARS['bio'])) ? intval($HTTP_POST_VARS['bio_match']) : XOOPS_MATCH_START;
switch ($match) {
case XOOPS_MATCH_START:
$criteria->add(new Criteria('bio', $myts->addSlashes(trim($HTTP_POST_VARS['bio'])).'%', 'LIKE'));
break;
case XOOPS_MATCH_END:
$criteria->add(new Criteria('bio', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['bio'])), 'LIKE'));
break;
case XOOPS_MATCH_EQUAL:
$criteria->add(new Criteria('bio', $myts->addSlashes(trim($HTTP_POST_VARS['bio']))));
break;
case XOOPS_MATCH_CONTAIN:
$criteria->add(new Criteria('bio', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['bio'])).'%', 'LIKE'));
break;
}
}
if ( !empty($HTTP_POST_VARS['user_from']) ) {
$criteria->add(new Criteria('user_from', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_from'])).'%', 'LIKE'));
}
if ( !empty($HTTP_POST_VARS['user_intrest']) ) {
$criteria->add(new Criteria('user_intrest', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_intrest'])).'%', 'LIKE'));
}
if ( !empty($HTTP_POST_VARS['user_occ']) ) {
$criteria->add(new Criteria('user_occ', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_occ'])).'%', 'LIKE'));
}
if ( !empty($HTTP_POST_VARS['user_lastlog_more']) && is_numeric($HTTP_POST_VARS['user_lastlog_more']) ) {
$f_user_lastlog_more = intval(trim($HTTP_POST_VARS['user_lastlog_more']));
$time = time() - (60 * 60 * 24 * $f_user_lastlog_more);
if ( $time > 0 ) {
$criteria->add(new Criteria('last_login', $time, '<'));
}
}
if ( !empty($HTTP_POST_VARS['user_lastlog_less']) && is_numeric($HTTP_POST_VARS['user_lastlog_less']) ) {
$f_user_lastlog_less = intval(trim($HTTP_POST_VARS['user_lastlog_less']));
$time = time() - (60 * 60 * 24 * $f_user_lastlog_less);
if ( $time > 0 ) {
$criteria->add(new Criteria('last_login', $time, '>'));
}
}
if ( !empty($HTTP_POST_VARS['user_reg_more']) && is_numeric($HTTP_POST_VARS['user_reg_more']) ) {
$f_user_reg_more = intval(trim($HTTP_POST_VARS['user_reg_more']));
$time = time() - (60 * 60 * 24 * $f_user_reg_more);
if ( $time > 0 ) {
$criteria->add(new Criteria('user_regdate', $time, '<'));
}
}
if ( !empty($HTTP_POST_VARS['user_reg_less']) && is_numeric($HTTP_POST_VARS['user_reg_less']) ) {
$f_user_reg_less = intval($HTTP_POST_VARS['user_reg_less']);
$time = time() - (60 * 60 * 24 * $f_user_reg_less);
if ( $time > 0 ) {
$criteria->add(new Criteria('user_regdate', $time, '>'));
}
}
if ( isset($HTTP_POST_VARS['user_posts_more']) && is_numeric($HTTP_POST_VARS['user_posts_more']) ) {
$criteria->add(new Criteria('posts', intval($HTTP_POST_VARS['user_posts_more']), '>'));
}
if ( !empty($HTTP_POST_VARS['user_posts_less']) && is_numeric($HTTP_POST_VARS['user_posts_less']) ) {
$criteria->add(new Criteria('posts', intval($HTTP_POST_VARS['user_posts_less']), '<'));
}
$criteria->add(new Criteria('level', 0, '>'));
$validsort = array("uname", "email", "last_login", "user_regdate", "posts");
$sort = (!in_array($HTTP_POST_VARS['user_sort'], $validsort)) ? "uname" : $HTTP_POST_VARS['user_sort'];
$order = "ASC";
if ( isset($HTTP_POST_VARS['user_order']) && $HTTP_POST_VARS['user_order'] == "DESC") {
$order = "DESC";
}
$limit = (!empty($HTTP_POST_VARS['limit'])) ? intval($HTTP_POST_VARS['limit']) : 20;
if ( $limit == 0 || $limit > 50 ) {
$limit = 50;
}
$start = (!empty($HTTP_POST_VARS['start'])) ? intval($HTTP_POST_VARS['start']) : 0;
$member_handler =& xoops_gethandler('member');
$total = $member_handler->getUserCount($criteria);
$xoopsTpl->assign('lang_search', _MM_SEARCH);
$xoopsTpl->assign('lang_results', _MM_RESULTS);
$xoopsTpl->assign('total_found', $total);
if ( $total == 0 ) {
$xoopsTpl->assign('lang_nonefound', _MM_NOFOUND);
} elseif ( $start < $total ) {
$xoopsTpl->assign('lang_username', _MM_UNAME);
$xoopsTpl->assign('lang_realname', _MM_REALNAME);
$xoopsTpl->assign('lang_avatar', _MM_AVATAR);
$xoopsTpl->assign('lang_email', _MM_EMAIL);
$xoopsTpl->assign('lang_bio', _MM_BIO);
$xoopsTpl->assign('lang_privmsg', _MM_PM);
$xoopsTpl->assign('lang_regdate', _MM_REGDATE);
$xoopsTpl->assign('lang_lastlogin', _MM_LASTLOGIN);
$xoopsTpl->assign('lang_posts', _MM_POSTS);
$xoopsTpl->assign('lang_url', _MM_URL);
$xoopsTpl->assign('lang_admin', _MM_ADMIN);
if ( $iamadmin ) {
$xoopsTpl->assign('is_admin', true);
}
$criteria->setSort($sort);
$criteria->setOrder($order);
$criteria->setStart($start);
$criteria->setLimit($limit);
$foundusers =& $member_handler->getUsers($criteria, true);
foreach (array_keys($foundusers) as $j) {
$userdata['avatar'] = $foundusers[$j]->getVar("user_avatar") ? "<img src='".XOOPS_UPLOAD_URL."/".$foundusers[$j]->getVar("user_avatar")."' alt='' />" : " ";
$userdata['realname'] = $foundusers[$j]->getVar("name") ? $foundusers[$j]->getVar("name") : " ";
$userdata['name'] = $foundusers[$j]->getVar("uname");
$userdata['bio'] = $foundusers[$j]->getVar("bio");
$userdata['id'] = $foundusers[$j]->getVar("uid");
if ( $foundusers[$j]->getVar("user_viewemail") == 1 || $iamadmin ) {
$userdata['email'] = "<a href='mailto:".$foundusers[$j]->getVar("email")."'><img src='".XOOPS_URL."/images/icons/email.gif' border='0' alt='".sprintf(_SENDEMAILTO,$foundusers[$j]->getVar("uname", "E"))."' /></a>";
} else {
$userdata['email'] = " ";
}
if ( $xoopsUser ) {
$userdata['pmlink'] = "<a href='javascript:openWithSelfMain("".XOOPS_URL."/pmlite.php?send2=1&to_userid=".$foundusers[$j]->getVar("uid")."","pmlite",450,370);'><img src='".XOOPS_URL."/images/icons/pm.gif' border='0' alt='".sprintf(_SENDPMTO,$foundusers[$j]->getVar("uname", "E"))."' /></a>";
} else {
$userdata['pmlink'] = " ";
}
if ( $foundusers[$j]->getVar("url","E") != "" ) {
$userdata['website'] = "<a href='".$foundusers[$j]->getVar("url","E")."' target='_blank'><img src='".XOOPS_URL."/images/icons/www.gif' border='0' alt='"._VISITWEBSITE."' /></a>";
} else {
$userdata['website'] = " ";
}
$userdata['registerdate'] = formatTimeStamp($foundusers[$j]->getVar("user_regdate"),"s");
if ( $foundusers[$j]->getVar("last_login") != 0 ) {
$userdata['lastlogin'] = formatTimeStamp($foundusers[$j]->getVar("last_login"),"m");
} else {
$userdata['lastlogin'] = " ";
}
$userdata['posts'] = $foundusers[$j]->getVar("posts");
if ( $iamadmin ) {
$userdata['adminlink'] = "<a href='".XOOPS_URL."/modules/system/admin.php?fct=users&uid=".$foundusers[$j]->getVar("uid")."&op=modifyUser'>"._EDIT."</a> | <a href='".XOOPS_URL."/modules/system/admin.php?fct=users&op=delUser&uid=".$foundusers[$j]->getVar("uid")."'>"._DELETE."</a>";
}
$xoopsTpl->append('users', $userdata);
}
$totalpages = ceil($total / $limit);
if ( $totalpages > 1 ) {
$hiddenform = "<form name='findnext' action='index.php' method='post'>";
foreach ( $HTTP_POST_VARS as $k => $v ) {
$hiddenform .= "<input type='hidden' name='".$myts->oopsHtmlSpecialChars($k)."' value='".$myts->makeTboxData4PreviewInForm($v)."' />n";
}
if (!isset($HTTP_POST_VARS['limit'])) {
$hiddenform .= "<input type='hidden' name='limit' value='".$limit."' />n";
}
if (!isset($HTTP_POST_VARS['start'])) {
$hiddenform .= "<input type='hidden' name='start' value='".$start."' />n";
}
$prev = $start - $limit;
if ( $start - $limit >= 0 ) {
$hiddenform .= "<a href='#0' onclick='javascript:document.findnext.start.value=".$prev.";document.findnext.submit();'>"._MM_PREVIOUS."</a> n";
}
$counter = 1;
$currentpage = ($start+$limit) / $limit;
while ( $counter <= $totalpages ) {
if ( $counter == $currentpage ) {
$hiddenform .= "<b>".$counter."</b> ";
} elseif ( ($counter > $currentpage-4 && $counter < $currentpage+4) || $counter == 1 || $counter == $totalpages ) {
if ( $counter == $totalpages && $currentpage < $totalpages-4 ) {
$hiddenform .= "... ";
}
$hiddenform .= "<a href='#".$counter."' onclick='javascript:document.findnext.start.value=".($counter-1)*$limit.";document.findnext.submit();'>".$counter."</a> ";
if ( $counter == 1 && $currentpage > 5 ) {
$hiddenform .= "... ";
}
}
$counter++;
}
$next = $start+$limit;
if ( $total > $next ) {
$hiddenform .= " <a href='#".$total."' onclick='javascript:document.findnext.start.value=".$next.";document.findnext.submit();'>"._MM_NEXT."</a>n";
}
$hiddenform .= "</form>";
$xoopsTpl->assign('pagenav', $hiddenform);
$xoopsTpl->assign('lang_numfound', sprintf(_MM_USERSFOUND, $total));
}
}
}
include_once XOOPS_ROOT_PATH."/footer.php";
?>
Posté le : 16/12/2005 12:48
|
|
|
Re: modification de xoopsmembers |
|
Xoops accro
Inscrit: 15/07/2004 11:16
|
après un test semblant concluant, voilà les modifications que j'ai opéré sur ton code. enregistre le code donné plus haut, sous test.php par exemple dans le code remplace index.php par test.php (ligne 102 et 401) en fait tu remplaceras index.php par le nom que tu donnes au fichier. ensuite, au début du fichier tu intervertis les form et submit pour obtenir ça
$op = "submit";
if ( isset($HTTP_POST_VARS['op']) && $HTTP_POST_VARS['op'] == "form" ) {
$op = "form";
}
puis tu cherches (ligne 283)
if ( !empty($HTTP_POST_VARS['user_from']) ) {
$criteria->add(new Criteria('user_from', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_from'])).'%', 'LIKE'));
}
et tu remplaces par :
$criteria->add(new Criteria('user_from', '%site2%', 'LIKE'));
Ainsi, à l'appel de la page, la requête se fera systématiquement (vu qu'on a enlevé le code de condition), et portera que le champs user_from contenant site2 je te laisse adapter à ton cas (bio), je pense que tu as saisis le truc :o) tu as le lien d'exemple ici http://xoops.romanais.info/modules/xoopsmembers/test.php
Posté le : 16/12/2005 13:32
|
|
|
Re: modification de xoopsmembers |
|
Régulier
Inscrit: 16/04/2004 12:12
|
:banane: merci super ca marche nickel j'ai mis comme tu a mis :
$criteria->add(new Criteria('bio', '%site1%', 'LIKE'));
je suis super content merci encore si quelqu'un pouvait m'expliquer pourquoi on met '%site1%' et pas 'site1' il doit bien avoir une raison ou c'est comme ca et faut pas réfléchir et utiliser les % quand on veut mettre la condition merci encore !!!!! ya pas a dire une réponse aussi rapide ca prouve bien que ya du monde pour aider les newbies sur frxoops !!!! @++ Ayou42
Posté le : 16/12/2005 14:30
|
|
|
Re: modification de xoopsmembers |
|
Xoops accro
Inscrit: 15/07/2004 11:16
|
pour notre exemple, les %, avant et après le code, ça permet de chercher dans le champs indiqué, tout ce qui contient 'site1'. donc attention, car si tu as site12 (ou monsite1 ou lesite123), ça ressortira dans les résultats ! exemple avec cette page, qui cherche %site1% : http://xoops.romanais.info/modules/xoopsmembers/test.phpon trouve le membre 'archives' qui réside sur le site 21. Alors que sur cette autre page http://xoops.romanais.info/modules/xoopsmembers/test2.phpavec ce code
$criteria->add(new Criteria('user_from', 'site2', '='));
on retrouve juste les membres qui sont strictement sur le site 2. (archives n'y est donc plus) tu as bien fait de faire la remarque. si tu as un site de test et phpmyadmin sous la main, tu peux t'amuser à faire des recherche sur ta table. et regarder à quoi ressemble les requêtes utilisées, et les résultats trouvés.
Posté le : 16/12/2005 14:40
|
|
Vous pouvez voir les sujets.
Vous ne pouvez pas débuter de nouveaux sujets.
Vous ne pouvez pas répondre aux contributions.
Vous ne pouvez pas éditer vos contributions.
Vous ne pouvez pas effacez vos contributions.
Vous ne pouvez pas ajouter de nouveaux sondages.
Vous ne pouvez pas voter en sondage.
Vous ne pouvez pas attacher des fichiers à vos contributions.
Vous ne pouvez pas poster sans approbation.
|