How to make JsConnect to work?
Hi,
I have keep on checking all forums, documents on jsconnect but not getting how can i integrate Vanila forum to our site.
I have website example.com (implemented in Zend Framework) and have installed forum in example.com/forum.
I dont want user to register to Forum directly but only from example.com. Now, if user registers or signins to example.com, I want autologin to example.com/forum with specific user profile.
I am using jsConnect in login controller and checking if user is logged in then calling below code.
(I already have included functions.jsconnect.php correctly.)
$clientID = "1234";
$secret = "1234";
$signedIn = true; // this is just a placeholder
$user = array();
if ($signedIn) {
// CHANGE THESE FOUR LINES.
$user['uniqueid'] = '123';
$user['name'] = 'John PHP';
$user['email'] = 'john.php@anonymous.com';
$user['photourl'] = '';
}
$secure = false; //I have done false as true requires parameter in get request.
WriteJsConnect($user, $_GET, $clientID, $secret, $secure);
This doesn't make user login to example.com/forum....
Let me know what else I need to do.
Please give me working example (without security check) which just make user login to forum when user logins to my main website.
Comments
This doc provides an overview of how jsConnect-based SSO works: http://docs.vanillaforums.com/features/sso/
Thanks Linc. That Doc helps me. This is bit tricky to understand for intermediate developer. Especially, whats use of registration, login, logout page url in jsconnect setting.
Anyway, I am able to setup login. Now, when I do example.com/forum/sso , it redirects and says
XYZ
You are already registered.
Profile Picture
XYZ ABC
Add Info & Create Account
Username
Choose a name to identify yourself on the site.
It seems this is successfully working but I dont want to show this page but want user to go to dashboard in all cases whether user is new or already registered. How can I do that?
Doc says about AutoConnect but how can we set that?
Did you ever get round this? I have everything working except first time someone goes to the forum it pops up with 'add info & create account' followed by email field & username field.
Is there a way round it?
If not, is it possible to change the text 'Choose a name to identify yourself on the site.' & make the username field none editable?? If so how do I do this?
Thanks all, I have learned lots from the forums except this last bit!
Well I was messing with this for ages, post a comment on here & then find my answer.....
In my custom.css
vanilla\themes\EmbedFriendly\design\custom.css
I added this:
#Form_ConnectName{ display:none; }
this hides the username field
I then added a locale.php file
vanilla\conf\locale.php
I added this:
$Definition['ConnectChooseName'] = '';
removes the 'Choose a name to identify yourself on the site.' wording
and
$Definition['Username'] = '';
which removes the bold 'Username' word
Might not be the best way but works for me.
Hope it helps others.
OMG, well I was missing the email in jsconnect.php as it was set to blank, add an email in there & voila, 1st time forum user is logged on without the email prompt screen, funny how you figure things out after asking for help!!! Oh well, maybe help someone else.
Thanks
Same principle as Rubber Duck Debugging. Being able to express your problem gives you more insight into your problem.
Glad you got it sorted!
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I am still getting stuck on this, and would be happy to pay someone to set it up for me - anyone?
I also had this problem. Turns out the user name I was using for testing was already present in the forum. Not a very clear message mind you!