[SPIP] Masquer les emails des auteurs - commentaires
-
[SPIP] Masquer les emails des auteurs
2018-11-08T22:02:59Z
https://blog.roxing.net/spip-masquer-les-emails-des-auteurs#comment2654
2018-11-08T22:02:59Z
<p>Salut,</p>
<p>Si si ça fonctionne parfaitement en 3.0, 3.1, 3.2.1 et en 3.3 comme indiqué dans l'article ! je viens de tester no souci ! Par contre il faut impérativement vider le cache quand tu ajoutes ce genre de traitements :)</p>
<p>Comme je te disais sur IRC tu peux réutiliser la fonction sur d'autres champs, le mieux serait d'appeler la fonction camoufler vu qu'elle est réutilisable sans soucis.</p>
<div class="coloration_code cadre"><div class="spip_php cadre"><div class="php"><ol><li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #666666; font-style: italic;">// config/mes_options.php</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'table_des_traitements'</span><span style="color: #009900;">]</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'EMAIL'</span><span style="color: #009900;">]</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'auteurs'</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'camoufler(%s, $Pile[1]["id_auteur"])'</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'table_des_traitements'</span><span style="color: #009900;">]</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'TELEPHONE'</span><span style="color: #009900;">]</span><span style="color: #009900;">[</span><span style="color: #0000ff;">'auteurs'</span><span style="color: #009900;">]</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'camoufler(%s, $Pile[1]["id_auteur"])'</span><span style="color: #339933;">;</span></div></li>
</ol></div></div><p class="download cadre_download"><a href='https://blog.roxing.net/sites/blog.roxing.net/local/cache-code/ec6f3c70ebb237bb8f5476251ca405c5.txt' rel='nofollow'>Télécharger</a></p></div><div class="coloration_code cadre"><div class="spip_php cadre"><div class="php"><ol><li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #666666; font-style: italic;">//mes_fonctions.php</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #000000; font-weight: bold;">function</span> camoufler<span style="color: #009900;">(</span><span style="color: #000088;">$champ</span><span style="color: #339933;">,</span><span style="color: #000088;">$id</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> include_spip<span style="color: #009900;">(</span><span style="color: #0000ff;">'inc/autoriser'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #666666; font-style: italic;">// on camoufle sauf autorisation</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span>autoriser<span style="color: #009900;">(</span><span style="color: #0000ff;">'voir'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'auteur'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #000088;">$champ</span> <span style="color: #339933;">=</span> spip_substr<span style="color: #009900;">(</span><span style="color: #000088;">$champ</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">"*****"</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #009900;">}</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$champ</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #009900;">}</span></div></li>
</ol></div></div><p class="download cadre_download"><a href='https://blog.roxing.net/sites/blog.roxing.net/local/cache-code/bfb2ebd92059fca22e590f53931ceaf8.txt' rel='nofollow'>Télécharger</a></p></div>
<p>Il faut éviter de mettre les fonctions dans mes_options.php, ça fonctionne mais ce n'est pas le meilleur endroit !</p>
-
[SPIP] Masquer les emails des auteurs
2018-11-08T16:08:45Z
https://blog.roxing.net/spip-masquer-les-emails-des-auteurs#comment2653
2018-11-08T16:08:45Z
<p>oups dsl ça fonctionne mais directement dans le mes_options et que le code ci-dessous.</p>
<div class="coloration_code cadre"><div class="spip_php cadre"><div class="php"><ol><li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #666666; font-style: italic;">// masquer un email si on est pas autorisé</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #000000; font-weight: bold;">function</span> camoufler_email<span style="color: #009900;">(</span><span style="color: #000088;">$email</span><span style="color: #339933;">,</span><span style="color: #000088;">$id</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> include_spip<span style="color: #009900;">(</span><span style="color: #0000ff;">'inc/autoriser'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #666666; font-style: italic;">// on camoufle sauf autorisation</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #b1b100;">if</span> <span style="color: #009900;">(</span><span style="color: #339933;">!</span>autoriser<span style="color: #009900;">(</span><span style="color: #0000ff;">'voir'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'auteur'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> spip_substr<span style="color: #009900;">(</span><span style="color: #000088;">$email</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">)</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">"*****"</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #009900;">}</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$email</span><span style="color: #339933;">;</span></div></li>
<li style="font-weight: normal; vertical-align:top;"><div style=""><span style="color: #009900;">}</span></div></li>
</ol></div></div><p class="download cadre_download"><a href='https://blog.roxing.net/sites/blog.roxing.net/local/cache-code/5dab4d592b9ed13f842920683d7772ad.txt' rel='nofollow'>Télécharger</a></p></div>
-
[SPIP] Masquer les emails des auteurs
2018-11-08T16:03:16Z
https://blog.roxing.net/spip-masquer-les-emails-des-auteurs#comment2652
2018-11-08T16:03:16Z
<p>l'astuce ne semble plus fonctionner en spip 3.2.1 pourtant on devrais pouvoir le faire a minima, si tu sais comment faire ....je suis preneur @micalement spipfactory.fr</p>