Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Metamod not detecting logged in users

Metamod not detecting logged in users

With debug mode on, it looks like metamod is unable to detect the logged in user details. so the PHP code is not working:

Settings are:

Show Title: No
Enabled: Yes   
Position: User3
Access Level: public

Menu Assignment
Menus: All

Caching     : Use Global
Cache Time     : 900
Debug           : On
Module Class Suffix   : "Blank"
Start date/time : "Blank"
End date/time : "Blank"
Show Quick module(s) to : All users
$language handling : Browsers preferred language : Browsers preferred language
Strict language comparison: Off
Style for included modules :    In a table (default) - user <h> for title
Auto-enable included modules? : All included modules

PHP

if ( $$user->id == "2") return "32";
if ( $$user->id == "13") return "33";

indrajitch
Beginner Modder
ranks
useravatar
Offline
4 Posts
User info in posts
Administrator has disabled public posting

Re: Metamod not detecting logged in users

Hi indrajitch,

Just a slight problem with the PHP -- too many $ symbols!

Try it this way:

if ( $user->id == "2") return "32";
if ( $user->id == "13") return "33";


Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Metamod not detecting logged in users

Hi Stephen !

Sorry those extra $-s came while putting it on the forum (silly me!)

But the problem is stiff there even after copying the same code you gave...

its not picking up the logged in user details to show the module !!

Here is the metamod debug info (guess it might help!)

MetaMod debug info:
Module ID: 29
$option: com_huruhelpdesk
$view: cpanel
$id:
$Itemid: 2
$timezone: default
$language: en-us
$language_code: en
$language_region: us
Including modules:

btw.. what does it identify as "$id" - ?

indrajitch
Beginner Modder
ranks
useravatar
Offline
4 Posts
User info in posts
Administrator has disabled public posting

Re: Metamod not detecting logged in users

Sorry Stephen!

Again a silly error! problem solved - was picking up wrong user ID details from a different module instead of core Joomla

Used this before and worked fine - thats why I was surprised finding it not working this time around!

indrajitch
Beginner Modder
ranks
useravatar
Offline
4 Posts
User info in posts
Administrator has disabled public posting

Re: Metamod not detecting logged in users

Hi indrajitch,

$id comes from the URL (when SEF URLs are turned off) or from the SEF system if they are turned on. It's usually used by components to identify the main "thing" you are viewing - e.g. the article id when you are viewing articles, or the category id when you are viewing categories, etc.

To find out what's going on with the $user variable, can you please try this:

1 - make sure you are actually logged in as a user on the front end of the site! Being logged in on the back end doesn't count!

2 - try putting the following into the PHP box and see what it outputs:

echo "User: <pre>";
print_r( $user );
echo "</pre> (end user info)";

You should see some information from the user object displayed. If you don't see that, and you are definitely logged in on the front end of the site, then there's something bad going on.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10727
Newest User:
solza2
Members Online:
0
Guests Online:
172

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked