|
Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
Bonjour, J'ai modifier les formulaires pour l'ajout et la modification de membre dans l'admin j'ai rajoutez prénom, adresse, code postal, tel, et date de naissance. Bon alors pour l'ajout d'un membre hors admin y'a pas de souci pour la modification hors admin et admin pas de souci non plus. Par contre pour l'ajout d'un membre dans l'admin ça marche pas . C'est à dire que mes champs sont visible mais quand je valide le formulaire mes nouveaux champs sont pas enregistré dans la base. Je vous met mes modifications : fichier : /modules/systeme/admin.php :
Pas de changement
fichier : /modules/systeme/admin/main.php : Ligne 61 :
updateUser($uid, $username, $name, $firstname, $adr, $cp, $tel, $ddn, $url, $email, $user_icq, $user_aim, $user_yim, $user_msnm, $user_from, $user_occ, $user_intrest, $user_viewemail, $user_avatar, $user_sig, $attachsig, $theme, $password, $pass2, $rank, $bio, $uorder, $umode, $notify_method, $notify_mode, $timezone_offset, $user_mailok, $groups);
Et ligne 165 à 169
$newuser->setVar("firstname", $firstname);
$newuser->setVar("adr", $adr);
$newuser->setVar("cp", $cp);
$newuser->setVar("tel", $tel);
$newuser->setVar("ddn", $ddn);
fichier : /modules/systeme/admin/userform.php : Ligne 35 à 39
$firstname_text = new XoopsFormText(_AM_FIRSTNAME, "firstname", 30, 60, $firstname_value);
$adr_text = new XoopsFormText(_AM_ADR, "adr", 30, 100, $adr_value);
$cp_text = new XoopsFormText(_AM_CP, "cp", 30, 10, $cp_value);
$tel_text = new XoopsFormText(_AM_TEL, "tel", 30, 60, $tel_value);
$ddn_text = new XoopsFormText(_AM_DDN, "ddn", 30, 60, $ddn_value);
Et ligne 139 à 143
$form->addElement($firstname_text);
$form->addElement($adr_text);
$form->addElement($cp_text);
$form->addElement($tel_text);
$form->addElement($ddn_text);
fichier /modules/systeme/admin/user.php : lignes 75 à 79 :
$firstname_value = "";
$adr_value = "";
$cp_value = "";
$tel_value = "";
$ddn_value = "";
et lignes 127 à 131 :
$firstname_value = $user->getVar("firstname", "E");
$adr_value = $user->getVar("adr", "E");
$cp_value = $user->getVar("cp", "E");
$tel_value = $user->getVar("tel", "E");
$ddn_value = $user->getVar("ddn", "E");
et ligne 183
function updateUser($uid, $uname, $name, $firstname, $adr, $cp, $tel, $ddn, $url, $email, $user_icq, $user_aim, $user_yim, $user_msnm, $user_from, $user_occ, $user_intrest, $user_viewemail, $user_avatar, $user_sig, $attachsig, $theme, $pass, $pass2, $rank, $bio, $uorder, $umode, $notify_method, $notify_mode, $timezone_offset, $user_mailok, $groups = array())
et ligne 195 à 199 :
$edituser->setVar("firstname", $firstname);
$edituser->setVar("adr", $adr);
$edituser->setVar("cp", $cp);
$edituser->setVar("tel", $tel);
$edituser->setVar("ddn", $ddn);
fichier /modules/systeme/language/french/admin/user.php : lignes 19 à 23 :
define("_AM_FIRSTNAME","Prénom");
define("_AM_ADR","Adresse");
define("_AM_CP","Code Postal");
define("_AM_TEL","Tél.");
define("_AM_DDN","Date de Naissance");
Dite moi si j'ai fais une erreur ou un oubli je pense que ça doit être plus un oubli qu'une erreur mais ne sait ont jamais Merci d'avance A+
Posté le : 23/10/2007 19:52
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
J'oubliai je suis sous xoops 2.0.17
Posté le : 23/10/2007 19:56
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
Un petit coup de main SVP 
Posté le : 24/10/2007 17:38
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Admin Frxoops 
Inscrit: 04/02/2003 07:37
De Belgique
|
As-tu regardé ce que donné le mode debug php et sql ? 
Posté le : 24/10/2007 18:19
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
Merci de ta réponse Voici le insert into
INSERT INTO kju28df_users (uid, uname, name, email, url, user_avatar, user_regdate, user_icq, user_from, user_sig, user_viewemail, actkey, user_aim, user_yim, user_msnm, pass, posts, attachsig, rank, level, theme, timezone_offset, last_login, umode, uorder, notify_method, notify_mode, user_occ, bio, user_intrest, user_mailok) VALUES (0, 'JPD', 'DAVID', 'jpd@orange.fr', '', 'blank.gif', 1193247742, '', 'St George sur la près', '', 1, '', '', '', '', 'd5c78553819a62219e4a48780ef33998', 0, 0, 0, 1, '', 1.00, 0, 'nest', 0, 1, 0, '', '', '', 1)
Donc ça ne m'aide pas beaucoup car ça relate parfaitement mon problème pourtant dans la fonction updateuser (j'ai pas trouver la fonction edituser) j'ai bien mi les nouveau champs sql comme j'ai mi dans mon précédent post
Posté le : 24/10/2007 19:51
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
RHOOO
j'ai bon chercher je vois pas où est ce insert into je vois vraiment pas pourtant j'ai regarder tous les fichiers ou y'avait des includes mais rien je ne vois rien, enfin j'en ai forcement oublié au moins un lol
Posté le : 24/10/2007 20:09
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Régulier 
Inscrit: 06/01/2006 23:55
|
le insert est gere dans la classe XoopsUserHandler (dans kernel/user.php)
Ce que je comprends pas c'est qu'il m'avait semble comprendre que tu avais fait des modifs et que cela fonctionnait pour la partie hors admin donc normalement la classe user devrait deja etre modifie... ou j'ai mal compris.
Si tu n'as pas modifie la classe user ton probleme vient de la. dans ce cas il faut que tu modifies la methode insert dans laquelle tu vas trouver les 2 requetes insert et update. Il faudrait aussi que tu modifies la classe XoopsUser.
Si tu as pas fait les modifs au dessus dit le je te dirais ce qu'il faut mettre dedans.
Posté le : 24/10/2007 21:44
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
Bonjour,
Bon là il est un peut tard pour faire les modifs mais le fichier /kernel/user.php je l'ai en effet déjà modifier vu que hors admin ça marche par contre je n'ai modifier que l'update car lors de l'ajout d'un nouveau user on rentre que des infos basique.
Le problème vient donc de là ;) c'est bizarre je vois pas comment ce fichier est rattacher au fichier /modules/systeme/admin.php
Je pense pas que ce soit plus dur à modifier que le reste la difficultée était de trouver le bon endroit
Je te remercie encore en espérant que ce soit bien ça :D
A + je vous tiens au courant
Posté le : 25/10/2007 00:39
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
Tu avais raison garrath ;) voici mon code it's works :)
<?php
// $Id: user.php 506 2006-05-26 23:10:37Z skalpa $
// ------------------------------------------------------------------------ //
// 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 //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu) //
// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
if (!defined('XOOPS_ROOT_PATH')) {
exit();
}
/**
* Class for users
* @author Kazumi Ono <onokazu@xoops.org>
* @copyright copyright (c) 2000-2003 XOOPS.org
* @package kernel
*/
class XoopsUser extends XoopsObject
{
/**
* Array of groups that user belongs to
* @var array
* @access private
*/
var $_groups = array();
/**
* @var bool is the user admin?
* @access private
*/
var $_isAdmin = null;
/**
* @var string user's rank
* @access private
*/
var $_rank = null;
/**
* @var bool is the user online?
* @access private
*/
var $_isOnline = null;
/**
* constructor
* @param array $id Array of key-value-pairs to be assigned to the user. (for backward compatibility only)
* @param int $id ID of the user to be loaded from the database.
*/
function XoopsUser($id = null)
{
$this->initVar('uid', XOBJ_DTYPE_INT, null, false);
$this->initVar('name', XOBJ_DTYPE_TXTBOX, null, false, 60);
$this->initVar('uname', XOBJ_DTYPE_TXTBOX, null, true, 25);
$this->initVar('firstname', XOBJ_DTYPE_TXTBOX, null, false, 60);
$this->initVar('adr', XOBJ_DTYPE_TXTBOX, null, false, null);
$this->initVar('cp', XOBJ_DTYPE_TXTBOX, null, false, 10);
$this->initVar('tel', XOBJ_DTYPE_TXTBOX, null, false, 60);
$this->initVar('ddn', XOBJ_DTYPE_TXTBOX, null, false, 60);
$this->initVar('email', XOBJ_DTYPE_TXTBOX, null, true, 60);
$this->initVar('url', XOBJ_DTYPE_TXTBOX, null, false, 100);
$this->initVar('user_avatar', XOBJ_DTYPE_TXTBOX, null, false, 30);
$this->initVar('user_regdate', XOBJ_DTYPE_INT, null, false);
$this->initVar('user_icq', XOBJ_DTYPE_TXTBOX, null, false, 15);
$this->initVar('user_from', XOBJ_DTYPE_TXTBOX, null, false, 100);
$this->initVar('user_sig', XOBJ_DTYPE_TXTAREA, null, false, null);
$this->initVar('user_viewemail', XOBJ_DTYPE_INT, 0, false);
$this->initVar('actkey', XOBJ_DTYPE_OTHER, null, false);
$this->initVar('user_aim', XOBJ_DTYPE_TXTBOX, null, false, 18);
$this->initVar('user_yim', XOBJ_DTYPE_TXTBOX, null, false, 25);
$this->initVar('user_msnm', XOBJ_DTYPE_TXTBOX, null, false, 100);
$this->initVar('pass', XOBJ_DTYPE_TXTBOX, null, false, 32);
$this->initVar('posts', XOBJ_DTYPE_INT, null, false);
$this->initVar('attachsig', XOBJ_DTYPE_INT, 0, false);
$this->initVar('rank', XOBJ_DTYPE_INT, 0, false);
$this->initVar('level', XOBJ_DTYPE_INT, 0, false);
$this->initVar('theme', XOBJ_DTYPE_OTHER, null, false);
$this->initVar('timezone_offset', XOBJ_DTYPE_OTHER, null, false);
$this->initVar('last_login', XOBJ_DTYPE_INT, 0, false);
$this->initVar('umode', XOBJ_DTYPE_OTHER, null, false);
$this->initVar('uorder', XOBJ_DTYPE_INT, 1, false);
// RMV-NOTIFY
$this->initVar('notify_method', XOBJ_DTYPE_OTHER, 1, false);
$this->initVar('notify_mode', XOBJ_DTYPE_OTHER, 0, false);
$this->initVar('user_occ', XOBJ_DTYPE_TXTBOX, null, false, 100);
$this->initVar('bio', XOBJ_DTYPE_TXTAREA, null, false, null);
$this->initVar('user_intrest', XOBJ_DTYPE_TXTBOX, null, false, 150);
$this->initVar('user_mailok', XOBJ_DTYPE_INT, 1, false);
// for backward compatibility
if (isset($id)) {
if (is_array($id)) {
$this->assignVars($id);
} else {
$member_handler =& xoops_gethandler('member');
$user =& $member_handler->getUser($id);
foreach ($user->vars as $k => $v) {
$this->assignVar($k, $v['value']);
}
}
}
}
/**
* check if the user is a guest user
*
* @return bool returns false
*
*/
function isGuest()
{
return false;
}
/**
* Updated by Catzwolf 11 Jan 2004
* find the username for a given ID
*
* @param int $userid ID of the user to find
* @param int $usereal switch for usename or realname
* @return string name of the user. name for "anonymous" if not found.
*/
function getUnameFromId( $userid, $usereal = 0 )
{
$userid = intval($userid);
$usereal = intval($usereal);
if ($userid > 0) {
$member_handler =& xoops_gethandler('member');
$user =& $member_handler->getUser($userid);
if (is_object($user)) {
$ts =& MyTextSanitizer::getInstance();
if ( $usereal ) {
return $ts->htmlSpecialChars($user->getVar('name'));
} else {
return $ts->htmlSpecialChars($user->getVar('uname'));
}
}
}
return $GLOBALS['xoopsConfig']['anonymous'];
}
/**
* increase the number of posts for the user
*
* @deprecated
*/
function incrementPost(){
$member_handler =& xoops_gethandler('member');
return $member_handler->updateUserByField($this, 'posts', $this->getVar('posts') + 1);
}
/**
* set the groups for the user
*
* @param array $groupsArr Array of groups that user belongs to
*/
function setGroups($groupsArr)
{
if (is_array($groupsArr)) {
$this->_groups =& $groupsArr;
}
}
/**
* get the groups that the user belongs to
*
* @return array array of groups
*/
function &getGroups()
{
if (empty($this->_groups)) {
$member_handler =& xoops_gethandler('member');
$this->_groups =& $member_handler->getGroupsByUser($this->getVar('uid'));
}
return $this->_groups;
}
/**
* alias for {@link getGroups()}
* @see getGroups()
* @return array array of groups
* @deprecated
*/
function &groups()
{
$groups =& $this->getGroups();
return $groups;
}
/**
* Is the user admin ?
*
* This method will return true if this user has admin rights for the specified module.<br />
* - If you don't specify any module ID, the current module will be checked.<br />
* - If you set the module_id to -1, it will return true if the user has admin rights for at least one module
*
* @param int $module_id check if user is admin of this module
* @return bool is the user admin of that module?
*/
function isAdmin( $module_id = null ) {
if ( is_null( $module_id ) ) {
$module_id = isset($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar( 'mid', 'n' ) : 1;
} elseif ( intval($module_id) < 1 ) {
$module_id = 0;
}
$moduleperm_handler =& xoops_gethandler('groupperm');
return $moduleperm_handler->checkRight('module_admin', $module_id, $this->getGroups());
}
/**
* get the user's rank
* @return array array of rank ID and title
*/
function rank()
{
if (!isset($this->_rank)) {
$this->_rank = xoops_getrank($this->getVar('rank'), $this->getVar('posts'));
}
return $this->_rank;
}
/**
* is the user activated?
* @return bool
*/
function isActive()
{
if ($this->getVar('level') == 0) {
return false;
}
return true;
}
/**
* is the user currently logged in?
* @return bool
*/
function isOnline()
{
if (!isset($this->_isOnline)) {
$onlinehandler =& xoops_gethandler('online');
$this->_isOnline = ($onlinehandler->getCount(new Criteria('online_uid', $this->getVar('uid'))) > 0) ? true : false;
}
return $this->_isOnline;
}
/**#@+
* specialized wrapper for {@link XoopsObject::getVar()}
*
* kept for compatibility reasons.
*
* @see XoopsObject::getVar()
* @deprecated
*/
/**
* get the users UID
* @return int
*/
function uid()
{
return $this->getVar("uid");
}
/**
* get the users name
* @param string $format format for the output, see {@link XoopsObject::getVar()}
* @return string
*/
function name($format="S")
{
return $this->getVar("name", $format);
}
function firstname($format="S")
{
return $this->getVar("firstname", $format);
}
function adr($format="S")
{
return $this->getVar("adr", $format);
}
function cp($format="S")
{
return $this->getVar("cp", $format);
}
function tel($format="S")
{
return $this->getVar("tel", $format);
}
function ddn($format="S")
{
return $this->getVar("ddn", $format);
}
/**
* get the user's uname
* @param string $format format for the output, see {@link XoopsObject::getVar()}
* @return string
*/
function uname($format="S")
{
return $this->getVar("uname", $format);
}
/**
* get the user's email
*
* @param string $format format for the output, see {@link XoopsObject::getVar()}
* @return string
*/
function email($format="S")
{
return $this->getVar("email", $format);
}
function url($format="S")
{
return $this->getVar("url", $format);
}
function user_avatar($format="S")
{
return $this->getVar("user_avatar");
}
function user_regdate()
{
return $this->getVar("user_regdate");
}
function user_icq($format="S")
{
return $this->getVar("user_icq", $format);
}
function user_from($format="S")
{
return $this->getVar("user_from", $format);
}
function user_sig($format="S")
{
return $this->getVar("user_sig", $format);
}
function user_viewemail()
{
return $this->getVar("user_viewemail");
}
function actkey()
{
return $this->getVar("actkey");
}
function user_aim($format="S")
{
return $this->getVar("user_aim", $format);
}
function user_yim($format="S")
{
return $this->getVar("user_yim", $format);
}
function user_msnm($format="S")
{
return $this->getVar("user_msnm", $format);
}
function pass()
{
return $this->getVar("pass");
}
function posts()
{
return $this->getVar("posts");
}
function attachsig()
{
return $this->getVar("attachsig");
}
function level()
{
return $this->getVar("level");
}
function theme()
{
return $this->getVar("theme");
}
function timezone()
{
return $this->getVar("timezone_offset");
}
function umode()
{
return $this->getVar("umode");
}
function uorder()
{
return $this->getVar("uorder");
}
// RMV-NOTIFY
function notify_method()
{
return $this->getVar("notify_method");
}
function notify_mode()
{
return $this->getVar("notify_mode");
}
function user_occ($format="S")
{
return $this->getVar("user_occ", $format);
}
function bio($format="S")
{
return $this->getVar("bio", $format);
}
function user_intrest($format="S")
{
return $this->getVar("user_intrest", $format);
}
function last_login()
{
return $this->getVar("last_login");
}
/**#@-*/
}
/**
* Class that represents a guest user
* @author Kazumi Ono <onokazu@xoops.org>
* @copyright copyright (c) 2000-2003 XOOPS.org
* @package kernel
*/
class XoopsGuestUser extends XoopsUser
{
/**
* check if the user is a guest user
*
* @return bool returns true
*
*/
function isGuest()
{
return true;
}
}
/**
* XOOPS user handler class.
* This class is responsible for providing data access mechanisms to the data source
* of XOOPS user class objects.
*
* @author Kazumi Ono <onokazu@xoops.org>
* @copyright copyright (c) 2000-2003 XOOPS.org
* @package kernel
*/
class XoopsUserHandler extends XoopsObjectHandler
{
/**
* create a new user
*
* @param bool $isNew flag the new objects as "new"?
* @return object XoopsUser
*/
function &create($isNew = true)
{
$user = new XoopsUser();
if ($isNew) {
$user->setNew();
}
return $user;
}
/**
* retrieve a user
*
* @param int $id UID of the user
* @return mixed reference to the {@link XoopsUser} object, FALSE if failed
*/
function &get($id)
{
$user = false;
if (intval($id) > 0) {
$sql = 'SELECT * FROM '.$this->db->prefix('users').' WHERE uid='.$id;
if (!$result = $this->db->query($sql)) {
return $user;
}
$numrows = $this->db->getRowsNum($result);
if ($numrows == 1) {
$user = new XoopsUser();
$user->assignVars($this->db->fetchArray($result));
}
}
return $user;
}
/**
* insert a new user in the database
*
* @param object $user reference to the {@link XoopsUser} object
* @param bool $force
* @return bool FALSE if failed, TRUE if already present and unchanged or successful
*/
function insert(&$user, $force = false)
{
if (strtolower(get_class($user)) != 'xoopsuser') {
return false;
}
if (!$user->isDirty()) {
return true;
}
if (!$user->cleanVars()) {
return false;
}
foreach ($user->cleanVars as $k => $v) {
${$k} = $v;
}
// RMV-NOTIFY
// Added two fields, notify_method, notify_mode
if ($user->isNew()) {
$uid = $this->db->genId($this->db->prefix('users').'_uid_seq');
$sql = sprintf("INSERT INTO %s (uid, uname, name, firstname, adr, cp, tel, ddn, email, url, user_avatar, user_regdate, user_icq, user_from, user_sig, user_viewemail, actkey, user_aim, user_yim, user_msnm, pass, posts, attachsig, rank, level, theme, timezone_offset, last_login, umode, uorder, notify_method, notify_mode, user_occ, bio, user_intrest, user_mailok) VALUES (%u, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %u, %s, %s, %s, %u, %s, %s, %s, %s, %s, %u, %u, %u, %u, %s, %.2f, %u, %s, %u, %u, %u, %s, %s, %s, %u)", $this->db->prefix('users'), $uid, $this->db->quoteString($uname), $this->db->quoteString($name), $this->db->quoteString($firstname), $this->db->quoteString($adr), $this->db->quoteString($cp), $this->db->quoteString($tel), $this->db->quoteString($ddn), $this->db->quoteString($email), $this->db->quoteString($url), $this->db->quoteString($user_avatar), time(), $this->db->quoteString($user_icq), $this->db->quoteString($user_from), $this->db->quoteString($user_sig), $user_viewemail, $this->db->quoteString($actkey), $this->db->quoteString($user_aim), $this->db->quoteString($user_yim), $this->db->quoteString($user_msnm), $this->db->quoteString($pass), $posts, $attachsig, $rank, $level, $this->db->quoteString($theme), $timezone_offset, 0, $this->db->quoteString($umode), $uorder, $notify_method, $notify_mode, $this->db->quoteString($user_occ), $this->db->quoteString($bio), $this->db->quoteString($user_intrest), $user_mailok);
} else {
$sql = sprintf("UPDATE %s SET uname = %s, name = %s, firstname = %s, adr = %s, cp = %s, tel = %s, ddn = %s, email = %s, url = %s, user_avatar = %s, user_icq = %s, user_from = %s, user_sig = %s, user_viewemail = %u, user_aim = %s, user_yim = %s, user_msnm = %s, posts = %d, pass = %s, attachsig = %u, rank = %u, level= %u, theme = %s, timezone_offset = %.2f, umode = %s, last_login = %u, uorder = %u, notify_method = %u, notify_mode = %u, user_occ = %s, bio = %s, user_intrest = %s, user_mailok = %u WHERE uid = %u", $this->db->prefix('users'), $this->db->quoteString($uname), $this->db->quoteString($name), $this->db->quoteString($firstname), $this->db->quoteString($adr), $this->db->quoteString($cp), $this->db->quoteString($tel), $this->db->quoteString($ddn), $this->db->quoteString($email), $this->db->quoteString($url), $this->db->quoteString($user_avatar), $this->db->quoteString($user_icq), $this->db->quoteString($user_from), $this->db->quoteString($user_sig), $user_viewemail, $this->db->quoteString($user_aim), $this->db->quoteString($user_yim), $this->db->quoteString($user_msnm), $posts, $this->db->quoteString($pass), $attachsig, $rank, $level, $this->db->quoteString($theme), $timezone_offset, $this->db->quoteString($umode), $last_login, $uorder, $notify_method, $notify_mode, $this->db->quoteString($user_occ), $this->db->quoteString($bio), $this->db->quoteString($user_intrest), $user_mailok, $uid);
}
if (false != $force) {
$result = $this->db->queryF($sql);
} else {
$result = $this->db->query($sql);
}
if (!$result) {
return false;
}
if (empty($uid)) {
$uid = $this->db->getInsertId();
}
$user->assignVar('uid', $uid);
return true;
}
/**
* delete a user from the database
*
* @param object $user reference to the user to delete
* @param bool $force
* @return bool FALSE if failed.
*/
function delete(&$user, $force = false)
{
if (strtolower(get_class($user)) != 'xoopsuser') {
return false;
}
$sql = sprintf("DELETE FROM %s WHERE uid = %u", $this->db->prefix("users"), $user->getVar('uid'));
if (false != $force) {
$result = $this->db->queryF($sql);
} else {
$result = $this->db->query($sql);
}
if (!$result) {
return false;
}
return true;
}
/**
* retrieve users from the database
*
* @param object $criteria {@link CriteriaElement} conditions to be met
* @param bool $id_as_key use the UID as key for the array?
* @return array array of {@link XoopsUser} objects
*/
function getObjects($criteria = null, $id_as_key = false)
{
$ret = array();
$limit = $start = 0;
$sql = 'SELECT * FROM '.$this->db->prefix('users');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$sql .= ' '.$criteria->renderWhere();
if ($criteria->getSort() != '') {
$sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
}
$limit = $criteria->getLimit();
$start = $criteria->getStart();
}
$result = $this->db->query($sql, $limit, $start);
if (!$result) {
return $ret;
}
while ($myrow = $this->db->fetchArray($result)) {
$user = new XoopsUser();
$user->assignVars($myrow);
if (!$id_as_key) {
$ret[] =& $user;
} else {
$ret[$myrow['uid']] =& $user;
}
unset($user);
}
return $ret;
}
/**
* count users matching a condition
*
* @param object $criteria {@link CriteriaElement} to match
* @return int count of users
*/
function getCount($criteria = null)
{
$sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('users');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$sql .= ' '.$criteria->renderWhere();
}
$result = $this->db->query($sql);
if (!$result) {
return 0;
}
list($count) = $this->db->fetchRow($result);
return $count;
}
/**
* delete users matching a set of conditions
*
* @param object $criteria {@link CriteriaElement}
* @return bool FALSE if deletion failed
*/
function deleteAll($criteria = null)
{
$sql = 'DELETE FROM '.$this->db->prefix('users');
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$sql .= ' '.$criteria->renderWhere();
}
if (!$result = $this->db->query($sql)) {
return false;
}
return true;
}
/**
* Change a value for users with a certain criteria
*
* @param string $fieldname Name of the field
* @param string $fieldvalue Value to write
* @param object $criteria {@link CriteriaElement}
*
* @return bool
**/
function updateAll($fieldname, $fieldvalue, $criteria = null)
{
$set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
$sql = 'UPDATE '.$this->db->prefix('users').' SET '.$set_clause;
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
$sql .= ' '.$criteria->renderWhere();
}
if (!$result = $this->db->query($sql)) {
return false;
}
return true;
}
}
?>
Merci encore
Posté le : 25/10/2007 11:46
|
|
|
Re: Modification du formulaire ajouter un utilisateur de la partie admin |
|
Guest_
|
B'jour, Pourrais-tu ré-expliquer l'utilité de ce hack ? (à part se passer de smartprofile  ) Tu as ajouté les champs suivants pour l'inscription des membres : • prénom • adresse • code postal • tel • date de naissance C'est ça ? Et ce champs sont visibles : - dans le formulaire d'inscription des membres (Front office) - dans le formulaire de modification des membres (Back office) C'est toujours çà  ? Les fichiers que tu as dû modifier sont : • /modules/systeme/admin/main.php • /modules/systeme/admin/userform.php • /modules/systeme/admin/user.php • /modules/systeme/language/french/admin/user.php + le dernier code ? Là j'ai pas suivi, de quel fichier s'agit-il ? Merci d'avance pour tes éclaircissements  ! @+ ps : garrath a toujours raison  !!
Posté le : 25/10/2007 12:07
|
|
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.
|