Simple Machines Community Forum

SMF Support => Language Specific Support => Français (French) => Aiheen aloitti: Footux - helmikuu 21, 2010, 08:33:06 AP

Otsikko: Drapeaux dans la memberlist
Kirjoitti: Footux - helmikuu 21, 2010, 08:33:06 AP
Bonjour à tous,

Voilà, j'ai installé ce mod : http://custom.simplemachines.org/mods/index.php?mod=417 et je voudrais afficher dans la liste des membres le drapeau d'origines des membres... j'ai essayé de le faire moi-même mais bon... pas trop réussi... :)
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: maximus23 - helmikuu 21, 2010, 12:41:46 IP
Bonjour,

Pour qu'il fonctionne tu dois l'activer dans ton panneau d'administration :)

Admin -> configuration -> réglages et options -> ...

:)

Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: Footux - helmikuu 21, 2010, 02:12:21 IP
en fait il est activé et il fonctionne mais le mod ne permet pas de voir les drapeaux dans la liste de membres... et je voudrais l'ajouter manuellement...
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: maximus23 - helmikuu 21, 2010, 02:47:01 IP
Bonsoir,

Ah ok tu voulais une extention au mod :) J'ai mal compris ton premier message :)

Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: Footux - helmikuu 21, 2010, 04:41:39 IP
Désolé... en fait oui le mod ne le propose pas et je voudrais bien l'intégrer. j'ai essayé mais j'ai du foirer un truc dans le code car ça me plantait le site...
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: Footux - helmikuu 24, 2010, 12:40:01 IP
Tu ne m'oublies pas ?  :P
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: DeathSign - helmikuu 24, 2010, 01:32:35 IP
Bonjour tout le monde ! (Oui ça faisait un moment...)

Alors si c'est bien ça que tu veux :
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg534.imageshack.us%2Fimg534%2F3453%2Fimage1r.th.gif&hash=7f27ee3bd7229f5c982812ede0d8a6ff78e6f11a) (http://img534.imageshack.us/img534/3453/image1r.gif)

Tu devras :

1. Editer le fichier Sources/Memberlist.php
Chercher :
// Set up the columns...
$context['columns'] = array(
'isOnline' => array(
'label' => $txt['online8'],
'width' => '20'
),
'realName' => array(
'label' => $txt[35]
),
'emailAddress' => array(
'label' => $txt[307],
'width' => '25'
),

Ajouter après :
'country' => array(
'label' => $txt[227],
'width' => '25'
),


2. Editer le fichier Themes/default/Memberlist.template.php
Rechercher : (attention je colle tout le paquet pour aller plus vite, y'a plusieurs modifs ^^)
// Assuming there are members loop through each one displaying their data.
if (!empty($context['members']))
{
foreach ($context['members'] as $member)
echo '
<tr style="text-align: center;"', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>
<td class="windowbg2">
', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['text'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="middle" />' : $member['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
</td>
<td class="windowbg" align="left">', $member['link'], '</td>
<td class="windowbg2">', $member['hide_email'] ? '' : '<a href="mailto:' . $member['email'] . '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . ' ' . $member['name'] . '" /></a>', '</td>
<td class="windowbg">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank"><img src="' . $settings['images_url'] . '/www.gif" alt="' . $member['website']['title'] . '" title="' . $member['website']['title'] . '" /></a>' : '', '</td>
<td class="windowbg2">', $member['icq']['link'], '</td>
<td class="windowbg2">', $member['aim']['link'], '</td>
<td class="windowbg2">', $member['yim']['link'], '</td>
<td class="windowbg2">', $member['msn']['link'], '</td>
<td class="windowbg" align="left">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
<td class="windowbg" align="left">', $member['registered_date'], '</td>
<td class="windowbg2" width="15">', $member['posts'], '</td>
<td class="windowbg" width="100" align="left">
', $member['posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $member['post_percent'] . '" height="15" alt="" />' : '', '
</td>
</tr>';
}
// No members?
else
echo '
<tr>
<td colspan="12" class="windowbg">', $txt[170], '</td>
</tr>';

// Show the page numbers again. (makes 'em easier to find!)
echo '
<tr>
<td class="titlebg" colspan="12">', $txt[139], ': ', $context['page_index'], '</td>
</tr>
</table>';

Remplacer par :
Lainaa// Assuming there are members loop through each one displaying their data.
   if (!empty($context['members']))
   {
      // Mod Add Country Flag
      $flags = CountryFlag();

   
      foreach ($context['members'] as $member) {
         echo '
      <tr style="text-align: center;"', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>
         <td class="windowbg2">
            ', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['text'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="middle" />' : $member['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
         </td>
         <td class="windowbg" align="left">', $member['link'], '</td>
         <td class="windowbg2">', $member['hide_email'] ? '' : '<a href="mailto:' . $member['email'] . '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . ' ' . $member['name'] . '" /></a>', '</td>
         <td class="windowbg">';
         // Mod Add Country Flag =)
         if(isset($member['options']['country']) && !empty($member['options']['country']))
            echo '
            <img src="', $settings['default_theme_url'], '/images/flags/', $member['options']['country'], '.png" alt="', $flags[$member['options']['country']], '" />';

         echo '</td>

         <td class="windowbg">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank"><img src="' . $settings['images_url'] . '/www.gif" alt="' . $member['website']['title'] . '" title="' . $member['website']['title'] . '" /></a>' : '', '</td>
         <td class="windowbg2">', $member['icq']['link'], '</td>
         <td class="windowbg2">', $member['aim']['link'], '</td>
         <td class="windowbg2">', $member['yim']['link'], '</td>
         <td class="windowbg2">', $member['msn']['link'], '</td>
         <td class="windowbg" align="left">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
         <td class="windowbg" align="left">', $member['registered_date'], '</td>
         <td class="windowbg2" width="15">', $member['posts'], '</td>
         <td class="windowbg" width="100" align="left">
            ', $member['posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $member['post_percent'] . '" height="15" alt="" />' : '', '
         </td>
      </tr>';         
      }
   }
   // No members?
   else
      echo '
      <tr>
         <td colspan="13" class="windowbg">', $txt[170], '</td>
      </tr>';

   // Show the page numbers again. (makes 'em easier to find!)
   echo '
      <tr>
         <td class="titlebg" colspan="13">', $txt[139], ': ', $context['page_index'], '</td>
      </tr>
   </table>';


Rechercher :
echo '
<tr class="titlebg">
<td colspan="12">';
$links = array();
foreach ($context['sort_links'] as $link)
$links[] = ($link['selected'] ? '<img src="' . $settings['images_url'] . '/selected.gif" alt="&gt;" /> ' : '') . '<a href="' . $scripturl . '?action=mlist' . (!empty($link['action']) ? ';sa=' . $link['action'] : '') . '">' . $link['label'] . '</a>';

echo '
', implode(' | ', $links), '
</td>
</tr>';
}
echo '
<tr>
<td colspan="12" class="', empty($settings['use_tabs']) ? 'catbg' : 'titlebg', '">';

Remplacer par :
Lainaaecho '
      <tr class="titlebg">
         <td colspan="13">';
            $links = array();
            foreach ($context['sort_links'] as $link)
               $links[] = ($link['selected'] ? '<img src="' . $settings['images_url'] . '/selected.gif" alt="&gt;" /> ' : '') . '<a href="' . $scripturl . '?action=mlist' . (!empty($link['action']) ? ';sa=' . $link['action'] : '') . '">' . $link['label'] . '</a>';

            echo '
               ', implode(' | ', $links), '
         </td>
      </tr>';
   }
   echo '
      <tr>
         <td colspan="13" class="', empty($settings['use_tabs']) ? 'catbg' : 'titlebg', '">';

Si je n'ai rien oublié, ça devrait marcher :)

Amicalement,
DeathSign
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: maximus23 - helmikuu 24, 2010, 02:52:19 IP
Bonsoir,

DeathSign content de te revoir :)

Footux tu vois qu'on ne t'oublie pas :) Moi je suis assez pris pour le moment donc stand-by :)

Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: Footux - helmikuu 25, 2010, 07:33:05 AP
Alors j'ai un petit soucis... j'ai réussi pour le fichiers Sources/Memberlist.php. Mais pour le fichier template (personnalisé) ça ne marche pas... voici-ci joint mon fichier.. en fait quand j'applique les changement j'ai toutes les colonnes qui sont à droite de celle d'affichage du drapeau qui disparaissent...
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: DeathSign - helmikuu 25, 2010, 12:39:41 IP
Je vois le soucis mais avant de te donner la version corrigée, pourquoi tu as un <td class="windowbg2">', $member['avatar']['image'], '</td> en plus ? C'est volontaire pour voir tous les avatars ? Si oui il faut adapter le tableau.
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: maximus23 - helmikuu 25, 2010, 12:43:29 IP
Bonsoir,

A mon avis il doit avoir installé le mod avatar d'ou cette ligne complémentaire :)

Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: Footux - helmikuu 25, 2010, 12:55:19 IP
Oui c'est ça Maximus a répondu ;) j'ai ajouté le mod avatar dans la memberlist ;)
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: DeathSign - helmikuu 25, 2010, 01:01:47 IP
Okip je viens de voir le mod avant que tu ne confirmes :)

Voilà la version corrigée de ton fichier adaptée à ton cas. Je vais changer mon post précédent et mettre en gras les changements.

Amicalement,
DeathSign
Otsikko: Re: Drapeaux dans la memberlist
Kirjoitti: Footux - helmikuu 25, 2010, 01:39:51 IP
Mrci tout plein :)