Topic-icon Is user logged into facebook

Active Subscriptions:

None
Hi,

I'm writing a plugin that will tell if a specified user ($userid) is logged in joomla via facebook. i stress that is is not the current user but any user.

many thanks in advance
The topic has been locked.
Support Specialist
8 years 6 months ago #54987 by alzander
There's a bit of nuance to that question. It's easy to get the user ID from a social network, but more difficult to determine if they are logged in. I'll help with the former, you'll have to determine the best way to check if they are logged in for your own site.
$id = JFBCFactory::usermap()->getJoomlaUserId(123, 'facebook');
If $id is null, the Joomla user with ID 123 hasn't mapped their account to Facebook. It's as simple as that.

There is no way that JFBConnect logs if the user that is current logged in did so through the social network. You can only tell that they are logged in and if they've linked their account to a social network, not what choice they used to login on this visit.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
8 years 6 months ago #54991 by fb_100000532508192
Thanks Alex,

i will write something to track when the user logs on etc to track them. Another question i'm writing a plugin which will redirect user once login is complete. Do you have any hooks or triggers so that my plugin knows jfbconnect is finished doings its bits?

many thanks in adfvanced
The topic has been locked.
Support Specialist
8 years 6 months ago #54995 by alzander
JFBConnect has an option to set the redirect location. If you want to do it dynamically though, you'd want to create a Social Profile plugin, just like the ones we distribute with JFBConnect. There's a 'onLogin' function you can override (originally declared in the /libraries/sourcecoast/plugins/socialprofile.php file) to setup a redirect. Just make sure your socialprofile plugin is the last ordered one so others can do their work first.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
8 years 6 months ago #55069 by fb_100000532508192
Hi Alex,

I've had a go but so far nothing is triggered. I'll PM you the code if you don't mind taking a look.

Many Thanks in advanced
The topic has been locked.
Support Specialist
8 years 6 months ago #55072 by alzander
Thanks for the code. Can you tell me where the execution stops? The code seems right. Without knowing where things go south, it's difficult to know failing.

The only thing odd I see is:
$plugin=JPluginHelper::getPlugin('socialprofiles', 'sonetwifiredir');
Is that the plugin that is currently being executed? The class name is plgSocialProfilesSonetRedirect, so not sure if that's just the name.

Beyond that, make sure you installed the plugin and enabled it.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
8 years 6 months ago #55078 by fb_100000532508192
Hi Alex,

as far as i can tell it doesn't start. i'ved PM'd the plugin to you. i also added an message alert at the beginning but that doesn't fire either. Be glad to know your thoughts.

phil
The topic has been locked.
Support Specialist
8 years 6 months ago #55085 by alzander
Are you able to see the plugin in the Plugin Manager and able to publish it successfully? The only thing I can guess is the name of your class doesn't match the name of the plugin:
plgSocialProfilesSonetRedirect
vs what I'd expect:
plgSocialProfilesSonetwifiredir
Not sure if that's as critical as I think, but it's my best suggestion if you can't get any code to execute like you describe.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
8 years 6 months ago #55101 by fb_100000532508192
Did you receive the plugin i sent?

The plugin is installed, enabled, changed class name to match plugin name but the only thing i can put it down to is that the onLogin() is not being fired. i've made other plugins for joomla that work ok. So i'm baffled as to why this won't. php doesn't give any errors or warnings.

Lost
The topic has been locked.
Active Subscriptions:

None
8 years 6 months ago #55125 by fb_100000532508192
Hi Alex,

I know you must be busy. But can you confirm that either my plugin is the culprit or the onLogin is? or would you mind posting a simple xml & php code(pluging) of the onLogin working. ive narrowed everything down to the function not being triggered but some feedback from you would be great.

Thanks in advance
The topic has been locked.