Possible Bug : Logging out : Jfactory in plugin

15 years 4 months ago #81125 by parth
Hi,

noticed this while porting one of our plugins to support CB 1.2 RC3. I now think i might be doing this too early but a lot of our users do need it ( They want to use 1.5 native too :) ) ..

Anyways here goes..

Joomla 1.58- native
CB 1.2 RC3

Working on CB Google Adsense Plugin

I noticed that when i use Jfactory in Display Tab to check id of logged in user, the user gets logged out when trying to view a profile.

[code:1]$uid =& JFactory::getUser();
$uid= $uid->id;[/code:1]

Jfactory returns fine. If i remove the above part then plugin & profile works fine..

What could be the issue here ? Some conflict ?

I am pretty sure its nothing to do with rest of my code as i isolated it to this after much testing & double checked to make sure this was the thing causing the issue.

I would also like to know if there is anything i can directly use in the CB API to get logged in user Info .. so that i dont have to worry about any conflicts & future Joomla Upgrades.

Nant/Beat i'd appreciate if one of you can look into this issue & let me know ..


Btw i also tried this with a blank plugin just to make sure :) .. Let me know if i want wrong anywhere..



[code:1]<?php
class getGAdsTab extends cbTabHandler {
function getGAdsTab() {
$this->cbTabHandler();
}


function getDisplayTab($tab,$user,$ui) {
$uid =& JFactory::getUser();
$uid= $uid->id;
return'Hi there';
}
} [/code:1]

Php-Nuke to Mambo to Joomla...
My Evolution goes on!
Need Joomla Development?
Drop us mail! www.tekdi.net - sales@tekdi.net
Our CB extensions :
CB Adsense , CB User RSS, CB-Eventlist My Events & CB-Eventlist Attended Events, CB Network Suggest
Joomla Extensions, Training & Support
techjoomla.com/
Check Out our Joomla extensions at extensions.joomla.org/extensions/owner/tekdi/1
extensions.joomla.org/extensions/owner/techjoomla/1

Please Log in to join the conversation.

15 years 4 months ago #81185 by beat
bug is in your code. You are nulling joomla's user...

don't reuse same var... which is used by reference....

$jUser =& ....
$userId = $jUser->id;


there is a CB API cross-platform native way that i will document after CB 1.2 Stable is released...

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

15 years 4 months ago #81196 by parth
Wow!
Silly silly silly of me !

Sorry for the trouble. overlooked the obvious :)

Would be good to use the CB API way. Let me know if we can be any help in documenting the API. Its much awaited.

Regards

Parth

Php-Nuke to Mambo to Joomla...
My Evolution goes on!
Need Joomla Development?
Drop us mail! www.tekdi.net - sales@tekdi.net
Our CB extensions :
CB Adsense , CB User RSS, CB-Eventlist My Events & CB-Eventlist Attended Events, CB Network Suggest
Joomla Extensions, Training & Support
techjoomla.com/
Check Out our Joomla extensions at extensions.joomla.org/extensions/owner/tekdi/1
extensions.joomla.org/extensions/owner/techjoomla/1

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.159 seconds

Facebook Twitter LinkedIn