Joomla, redirection personnalisée après connexion

Lorsque qu'un utilisateur se connecte à son compte dans Joomla, il est automatiquement redirigé à la page d'accueil.

Cet article explique comment effectuer un hack à Joomla 1.5, afin de rediriger l'utilisateur sur la page de votre choix après sa connexion. À partir de la configuration du module de connexion, vous pouvez spécifier une page dans le site, mais vous ne pouvez spécifier d'URL précise, ce qui est parfois nécessaire. Ça peut être très utile, surtout si vous attendez une action précise de votre visiteur (ex: poster un article, une image, inscrire son site dans votre annuaire, etc.).

Joomla 1.5.8 a servi pour cet exemple, mais c'est probablement exactement le même principe pour toutes les autres versions 1.5.x.

Ouvrez ce fichier :

  1. [votre site]/components/com_user/controller.php

Il faut rechercher cette ligne de code qui se trouve normalement à la ligne 153, à l'intérieur de la fonction login() :

  1. $mainframe->redirect( $return );

Il suffit simplement de remplacer $return par l'URL de votre choix. Par exemple :

  1. $mainframe->redirect( "http://www.guylabbe.ca" );

Ça parle de

Commentaires

Commenter sur ce sujet :

Le contenu de ce champ sera maintenu privé et ne sera pas affiché publiquement.
  • Les adresses de pages web et de messagerie électronique sont transformées en liens automatiquement.
  • Les lignes et les paragraphes vont à la ligne automatiquement.
  • You can enable syntax highlighting of source code with the following tags: <code>, <actionscript>, <apache>, <bash>, <dos>, <html>, <javascript>, <mysql>, <php>, <xml>.
  • Every instance heading tags will be modified to include an id attribute for anchor linking.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Image links with 'rel="lightshow"' in the <a> tag will appear in a Lightbox slideshow when clicked on.
  • Links to HTML content with 'rel="lightframe"' in the <a> tag will appear in a Lightbox when clicked on.
  • Links to video content with 'rel="lightvideo"' in the <a> tag will appear in a Lightbox when clicked on.
  • Links to inline or modal content with 'rel="lightmodal"' in the <a> tag will appear in a Lightbox when clicked on.
  • Links to specified hosts will have a rel="nofollow" added to them.

  • Insert <!--tableofcontents [list: ol; title: Table of Contents; minlevel: 2; maxlevel: 3; attachments: yes;]--> to insert a mediawiki style collapsible table of contents. Arguments within [] are optional.

Plus d'informations sur les options de formatage