Skip to Content Skip to Menu

Module for login status information

9 years 3 months ago #265543 by codeslayer
Module for login status information was created by codeslayer
I have updated & migrated the site of my customer to Joomla 3.4.1. Since the new site uses a pop-up Login form (triggered by a menu entry) we needed a module to display the current login status.
I'v been browsing for some free modules but haven't found anything useful I decided to develop my own module.

I found a module called "Flexi Custom Code" which can be used to embed php code and used the CB FAQs to write following code:
Code:
<?php global $_CB_framework; $cbUser =& CBuser::getInstance( $_CB_framework->myId()); if ( ! $cbUser ) $cbUser =& CBuser::getInstance( null ); $userData =& $cbUser->getUserData(); $userName = $userData->username; if ($userName) { echo "You are logged in as " . $userName; } else { echo "You are currently not logged in."; } ?>


Generally it works pretty well but during the development I noticed that this module might have some caching issues.
In the beginning the information wos only correct when I called the "CB profile information" page or the "kunena forum". The reason for that could be that those pages we using some CB calls/functions.
Finally I cleaned now the browser and joomla caches and now it seems to work for me.

The problem I have that it seems not to work for all users.
Some users get not the correct login information output if they ope different pages on the site, For example I use jDownloads for providing files to download. SOme users report that the login status changes to "not logged in" if they go to a download category.
It'somehow difficult to reproduce this error since it works for me and about 90% of all users.

I even disabled the caching in the "Flexi Custom Code" module where my code resides.

Now my question:
Does my code have any potential bugs or is there something I could improve?

My solution is of course free to use if anybody finds it useful.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum