Les archives de FluxBB.fr
Vous n'êtes pas identifié(e).
Pages : 1
Salut a tous,
Après avoir poster ma question sur le .org sans succès je m'adresse à vous.
Comment puis-je faire pour que les modérateurs puissent éditer le profil des Awards pour chaque utilisateur???
J'ai essayé ceci ::
//Update awards for users
if ($action == 'foo' && isset($_POST['update_awards']) && $pun_user['g_id'] == PUN_ADMIN) {Ajoutez :
$pun_user['g_moderator'] == '1')La seuls chose que ca change c'est une redirection continue avec le message "Récompenses Suprimée"
Développeur en herbe
-- Souvent derrière Notepad à essayer de comprendre ce qu'il ne comprend pas 
Hors ligne
Salut 
if ($action == 'foo' && isset($_POST['update_awards']) && $pun_user['g_id'] == PUN_ADMIN) {=>
if ($action == 'foo' && isset($_POST['update_awards']) && $pun_user['is_admmod']) {Je ne vois pas d'autres tests pour voir si l'on est admin.
Hors ligne
Ca ne marche pas non plus...
Voila le code complet de la partie profile.php
// Load the awards language file
if (file_exists(PUN_ROOT.'/lang/'.$pun_user['language'].'/admin_awards.php'))
require PUN_ROOT.'/lang/'.$pun_user['language'].'/admin_awards.php';
else
require PUN_ROOT.'/lang/English/admin_awards.php';
//Start of awards code
//Update awards for users
if ($action == 'foo' && isset($_POST['update_awards']) && $pun_user['is_admmod']) {
//Lets see if we want to remove all the awards
if(empty($_POST['awards'])) {
$db->query('DELETE FROM '.$db->prefix.'awards_users WHERE user_id= '.$id) or error('Unable to delete awards', __FILE__, __LINE__, $db->error());
redirect('profile.php?section=admin&id='.$id, $lang_admin_awards['Deleted all awards']);
}
else
{
$result = $db->query('SELECT award_id FROM '.$db->prefix.'awards_users WHERE user_id = '.$id) or error('Unable to fetch award info', __FILE__, __LINE__, $db->error());
$userawards = array();
while ($awards = $db->fetch_assoc($result)) {
$userawards[] = $awards['award_id'];
}
//$userawards hold all the awards the user currently has.
$awards = array_map('intval', $_POST['awards']);
//toremove holds the awards to remove
$toremove = array_diff($userawards, $awards);
//To add holds the ones to add
$toadd = array_diff($awards, $userawards);
//Remove the awards
if (!empty($toremove))
$db->query('DELETE FROM '.$db->prefix.'awards_users WHERE user_id='.$id.' AND award_id IN ('.implode(', ', $toremove).')') or error('Unable to delete awards', __FILE__, __LINE__, $db->error());
//Add the awards
if(!empty($toadd)){
foreach($toadd as $add) {
$db->query('INSERT INTO '.$db->prefix.'awards_users (award_id, user_id) VALUES('.$add.', '.$id.')') or error('Unable to insert awards', __FILE__, __LINE__, $db->error());
}
}
redirect('profile.php?section=admin&id='.$id, $lang_admin_awards['Edited user awards']);
}
}
//end of awards code//Remove awards
$db->query('DELETE FROM '.$db->prefix.'awards_users WHERE user_id='.$id) or error('Unable to delete awards', __FILE__, __LINE__, $db->error());//User Awards code
?>
<div class="inform">
<fieldset>
<legend><?php echo $lang_admin_awards['Set awards'] ?></legend>
<div class="infldset">
<p><?php echo $lang_admin_awards['Awards info'] ?></p>
<input type="hidden" name="form_sent_award" value="1" />
<?php
$result = $db->query('SELECT award_id FROM '.$db->prefix.'awards_users WHERE user_id = '.$id) or error('Unable to fetch award info', __FILE__, __LINE__, $db->error());
$userawards = array();
while ($awards = $db->fetch_assoc($result)) {
$userawards[] = $awards['award_id'];
}
$result = $db->query('SELECT id, extension, name FROM '.$db->prefix.'awards') or error('Unable to fetch award info', __FILE__, __LINE__, $db->error());
while ($awards = $db->fetch_assoc($result)) {
echo'<input type="checkbox" name="awards[]" value="'.$awards['id'].'" '.(in_array($awards['id'], $userawards, true) ? 'checked' : '').'> <img src="img/awards/'.$awards['id'].$awards['extension'].'" title="'.pun_htmlspecialchars($awards['name']).'" alt="'.pun_htmlspecialchars($awards['name']).'"/> '.pun_htmlspecialchars($awards['name']).'<br/>';
}
?>
<br class="clearb" /><input type="submit" name="update_awards" value="<?php echo $lang_admin_awards['Update awards'] ?>" />
</div>
</fieldset>
</div>
<?php
//End of Awards codeMerci de ton coup de main Adaur adoré 
Développeur en herbe
-- Souvent derrière Notepad à essayer de comprendre ce qu'il ne comprend pas 
Hors ligne
BOnjour,
J'ai fait la modification proposée par Xtrem-AW pour que mes membres puissent voir leur profil...
http://fluxbb.fr/forums/viewtopic.php?id=11439
Je voudrais savoir si il est possible d'ajouter d'autres éléments en lecture. Tel que les Awards reçus, ou d'autres à l'avenir (en supposant que ce soit la même démarche).
Pourriez vous m'aider?
Dernière modification par j-slim (22-01-2011 13:31:42)
Développeur en herbe
-- Souvent derrière Notepad à essayer de comprendre ce qu'il ne comprend pas 
Hors ligne
Je pense que c'est faisable, il faut simplement faire la modification pour les Profils visionnés par un autre membre, je cherche une petite base, et je te tient au courant 
Hors ligne
Merci à toi Xtrem
Développeur en herbe
-- Souvent derrière Notepad à essayer de comprendre ce qu'il ne comprend pas 
Hors ligne
Pages : 1