PDA

Voir la version complète : dure edition


funakoshi
30/05/2007, 14h13
salut, alors voila mon probleme je suis en train de faire un hack avec des champs supplementaires. mais je bute sur l'edition de ces champs.

malgré beaucoup de lecture ici et des hacks que j'ai.
alors j'ai besoin de pros ;) <- un peu de pommade :D


voici le code (simplifié)

dans le hook editpost_edit_complete

if ($isfirstpost)
{
if ($foruminfo['bon'])
{
$edit=$vbulletin->db->query_first("SELECT * FROM `" . TABLE_PREFIX . "table` WHERE threadid=$threadinfo[threadid]");
$champ1 = $edit['champ1'];

eval('$editall = "' . fetch_template('pack_editall') . '";');
}
}


dans le template pack_editall qui s'affiche bien avec les données du champ (edition->edition avancée) j'ai du code html puis
<input type="text" class="bginput" size="60" name="champ1" id="champ1" value="$champ1" />

jusque là je pense que tout va bien
ensuite dans le hook editpost_update_complete


if ($foruminfo['bon'])
{

$champ1 = addslashes(trim($_POST['champ1']));


$vbulletin->db->query_write("
UPDATE `" . TABLE_PREFIX . "table`
SET `champ1`='".$champ1."'
WHERE `threadid`='".$threadinfo[threadid]."'
");

}


et là quand j'envoie mon post mon champ1 se trouve vidé de sa substance :(

merci pour votre aide
@+

Fred
30/05/2007, 17h19
dans editpost_update_complete

if ($foruminfo['bon'])
{

$vbulletin->input->clean_array_gpc('p', array(
'champ1' => TYPE_STR
));

// Mise en variable de l'article id
$champ1 = $db->escape_string($vbulletin->GPC['champ1']);
$champ1 = trim($champ1);


$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "table
SET champ1='".$champ1."'
WHERE threadid='".$threadinfo[threadid]."'
");

}

ca fait deja plus propre est plus normalisé vbulletin :p

funakoshi
30/05/2007, 18h42
merci de ton aide , mais apres test ça fait la meme chose. ça vide le champ de la BDD.
donc l'update se fait bien mais la variable est vide :'(
y aurait pas autre chose à mettre ailleurs?
@+

Fred
30/05/2007, 19h00
if ($isfirstpost)
{
if ($foruminfo['bon'])
{
$edit=$vbulletin->db->query_first("SELECT * FROM `" . TABLE_PREFIX . "table` WHERE threadid=$threadinfo[threadid]");
$champ1 = $edit['champ1'];

eval('$editall = "' . fetch_template('pack_editall') . '";');
}
}

Met le en editpost_form_start
ca devrait passé logiquement

funakoshi
30/05/2007, 19h25
ça y est j'ai trouvé merci (car en me donnant le bon code j'ai pu chercher au bon endroit)

comme un ab---i j'avais pas inseré mon template au bon endroit dans editpost

tout simplement je l'avais mise au dessus du <form name="vbform"...
je me maudit ...:)
merci de ton aide
@+