[TUTORIAL]Integrate Twitter Logins with MyBB
#21
(2010-02-27, 09:23 PM)afrothunder Wrote: If you look at callback.php you will find the following code:
$db->query("UPDATE mybb_userfields SET fid13='".$twtoken."' WHERE ufid=$scrid");
	$db->query("UPDATE mybb_userfields SET fid14='$twsecret' WHERE ufid=$scrid");
		$db->query("UPDATE mybb_userfields SET fid15='1' WHERE ufid=$scrid");

You can use this as an example on how to set any profile field during registration. You can set Location for example, which for me is ID 1 like this:
$db->query("UPDATE mybb_userfields SET fid1='Somewhere' WHERE ufid=$scrid");

If you wanted the user to be able to edit the field instead of it having a default value, you could add another field to the form in the username selection template, then replace "Somewhere" with $_POST['location'] or something similar(of course you should do security checks instead of just the post variable, but that's the general idea.

dont work :/
Exclamation MyBB-Es.Com, spanish support for MyBB Wink
Reply
#22
I solved Walkman's problem. If anyone else ends up with the same issue, here is how to solve it.

In callback.php replace
"profile_fields" => "",
with
"profile_fields" => $mybb->input['profile_fields'],

Then go to the twtregisteruname template and place the source for the profile fields you need from your registration page to the template after
<input name="username" type="text" value="{$twname}">

So, for example, in this case the following was placed after the input tag
<fieldset class="fieldset">
				<legend>Additional Information</legend>
				<table border="0" cellpadding="0" cellspacing="3" width="400">
  <tbody><tr> 
<!-- start: member_register_requiredfields -->
<!-- start: member_register_customfield -->
</tr><tr>
<td><span class="smalltext">Sex</span></td>
</tr>
<tr>
<td><select name="profile_fields[fid3]" id="fid3" size="1"><option value="--Selection">--Selection</option>

<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<div style="display: none;" id="fid3_status">
</div></td>

</tr>
<!-- end: member_register_customfield --><!-- start: 

member_register_customfield -->
<tr>
<td><span class="smalltext">Location</span></td>
</tr>
<tr>
<td><select name="profile_fields[fid1]" id="fid1" size="1"><option 

value="--Selection">--Selection</option>
<option value="Aaland">Aaland</option>
...
<option 

value="Zimbabwe">Zimbabwe</option></select><div style="display: none;" id="fid1_status"></div></td>

</tr>
<!-- end: member_register_customfield -->
<!-- end: member_register_requiredfields -->
          			
				</tbody></table>
			</fieldset>

I hope this helps anyone who also has this issue.
http://Screeze.com - A fun general discussions forum. Login using Facebook, Twitter, Windows Live or normally.

Utilize Twitter logins on your own board.
Reply
#23
Information 
Is there any way to get this up and working without Sqlite?
Reply
#24
(2010-03-04, 09:23 AM)androll33 Wrote: Is there any way to get this up and working without Sqlite?

Not without changing the code that writes to the UID linking database entirely.
http://Screeze.com - A fun general discussions forum. Login using Facebook, Twitter, Windows Live or normally.

Utilize Twitter logins on your own board.
Reply
#25
This user has been denied support. This user has been denied support.
<.< when i log in (registerd or not) got redirected here

"https://twitter.com/oauth/authenticate?oauth_token="
and get this message
Woah there!

This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.
Reply
#26
(2010-03-04, 06:15 PM)Glas Wrote: <.< when i log in (registerd or not) got redirected here

"https://twitter.com/oauth/authenticate?oauth_token="
and get this message
Woah there!

This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.

Did you put your application id and secret in the scripts where it says to?
http://Screeze.com - A fun general discussions forum. Login using Facebook, Twitter, Windows Live or normally.

Utilize Twitter logins on your own board.
Reply
#27
This user has been denied support. This user has been denied support.
(2010-03-04, 06:20 PM)afrothunder Wrote:
(2010-03-04, 06:15 PM)Glas Wrote: <.< when i log in (registerd or not) got redirected here

"https://twitter.com/oauth/authenticate?oauth_token="
and get this message
Woah there!

This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.

Did you put your application id and secret in the scripts where it says to?
Explain me please <.< should i put them in "callback.php"?

and where can i get those tokens... googling about them only redirect me to sites about "how to get facebook apis data"
by the way
it is safe that twtusers.dbt remains public? Confused
Reply
#28
(2010-03-04, 06:22 PM)Glas Wrote:
(2010-03-04, 06:20 PM)afrothunder Wrote:
(2010-03-04, 06:15 PM)Glas Wrote: <.< when i log in (registerd or not) got redirected here

"https://twitter.com/oauth/authenticate?oauth_token="
and get this message
Woah there!

This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.

Did you put your application id and secret in the scripts where it says to?
Explain me please <.< should i put them in "callback.php"?

and where can i get those tokens... googling about them only redirect me to sites about "how to get facebook apis data"
by the way
it is safe that twtusers.dbt remains public? Confused

Yes, they belong in callback.php but there might be other scripts that they are needed in so be sure to check through them all.

You can get your api keys here: http://twitter.com/apps

Also, the contents of that db file poses no security risk. Basically it just says twitter user 123456 is forum user 321 and that's it. You can chmod to disable public access if you wish.
http://Screeze.com - A fun general discussions forum. Login using Facebook, Twitter, Windows Live or normally.

Utilize Twitter logins on your own board.
Reply
#29
Nice and thank you for sharing.. Hope someday you can share how to connect with facebook.
Thanks again.
Reply
#30
I've been looking for something like this. I'll give this a try on my test site, if all goes well I'll install it on my live forum Smile. Thanks for posting this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)