cb_categorie variable (Field Manager)

17 years 11 months ago #10057 by Jacob
I'm wondering if its possible to detect the value of the "cb_categorie" after a user is logged in.

I'd like to make some template changes based on different user categories.

Much appreciated!

Jacob

Joomla Development and Support since 2005

Please Log in to join the conversation.

17 years 11 months ago #10066 by mikko
Replied by mikko on topic Re:cb_categorie variable (Field Manager)
You need to make an sql query to table #__comprofiler with the user id to get data.

mikko

Please Log in to join the conversation.

17 years 11 months ago #10078 by Jacob
Replied by Jacob on topic Re:cb_categorie variable (Field Manager)
Mikko,

Thanks for the quick reply.

Can you help me with writing this query, my php/mysql knowledge aren't one of my strengths.

Thanks
Jacob

Joomla Development and Support since 2005

Please Log in to join the conversation.

17 years 11 months ago #10082 by mikko
Replied by mikko on topic Re:cb_categorie variable (Field Manager)
See the source. Plenty of examples there. Try grep -R "from #__comprofiler" * to find some.

-Mikko

Please Log in to join the conversation.

17 years 11 months ago #10143 by Jacob
Replied by Jacob on topic Re:cb_categorie variable (Field Manager)
here's the query I got so far, let me know if its correct:

[code:1]
$query = "SELECT cb_categorie, id FROM #__comprofiler"
."\n WHERE id = ". $my->id;
$cat= $database->loadResult();
echo $cat;
[/code:1]

I put this code in my template and logged in via front end, didnt see anything echo'd out.

Any help is appreciated.

Jacob

Joomla Development and Support since 2005

Please Log in to join the conversation.

17 years 11 months ago #10159 by mikko
Replied by mikko on topic Re:cb_categorie variable (Field Manager)
Looks OK to me. Good that you got it right!

If you experience performance issues, you could consider storing the field you fetch to the session, but this is much more compicated.

-mikko

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.232 seconds

Facebook Twitter LinkedIn