Ok let me explain what I am trying to do here.
I have Deanos Facebook Connect mod installed that makes a profile field.. What I want to do is take that number if it is there and put it into a block that I want to make up for a follow button. Here is a facebook code:
<div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=634543439897135"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-follow" data-href="https://www.facebook.com/DEANO CODE" data-width="250" data-show-faces="true"></div>
Where I have DEANO CODE is what I want to call from the profile field. I know it can be done but have to figure out how to code it. If I need to edit the \inc\classes\BxDolProfileFields.php and put it that way or if I can just use the profile boxes in the admin part..
|
If I use the above code and just use my number instead of the Deano Code.. It will pull up and works. But I want that to be that members number instead of mine.. |
when you say "that members number" are you referring to the member that is currently logged in? if so there is a cookie with the id number of the logged in user so you could create a variable and place instead. Example:
$my_id = $_COOKIE['memberID'];
*your code*.....
<div class="fb-follow" data-href="https://www.facebook.com/<?php echo $my_id; ?>" data-width="250" data-show-faces="true"></div>
i am not sure if this is 100% correct on the coding, but I hope the idea makes sense.
caredesign.net |
You will need to use a php block to do this. But before i can help, i need to know where are you placing this block?
How it is done depends on if your trying to pull the facebook id for the logged in member, or of the member who's profile is being viewed in the case the block is on the profile page.
https://www.deanbassett.com |
when you say "that members number" are you referring to the member that is currently logged in? if so there is a cookie with the id number of the logged in user so you could create a variable and place instead. Example:
$my_id = $_COOKIE['memberID'];
*your code*.....
<div class="fb-follow" data-href="https://www.facebook.com/<?php echo $my_id; ?>" data-width="250" data-show-faces="true"></div>
i am not sure if this is 100% correct on the coding, but I hope the idea makes sense.
He is not after the member id. He is after the facebook id my facebook connect mod stores in the database.
https://www.deanbassett.com |
Thank you for your reply but no.. Deanos Facebook Connect makes a field in the profile of the facebook number of that users facebook profile. What I need to do is find out the call sign for what gets entered in there..
Would be the same as when a member files out there profile and lets say I want to use what they put as there first name. Now say i want to make a block in the profile and have something like:
Hello my name is (Members First Name). I live in (Members City) of (Members Country).
So what I would be looking for would be the call sign for Members First Name, Members City, and Members Country..
But instead of that stuff I would like to use DeanosFacebookConnect Number that is already in the profile..
|
Thanks Deano.. It will be on the members profile page.. It will be so say I like someones profile I can go off and follow then on there facebook.. I would like to do it with your google connect as well..
You will need to use a php block to do this. But before i can help, i need to know where are you placing this block?
How it is done depends on if your trying to pull the facebook id for the logged in member, or of the member who's profile is being viewed in the case the block is on the profile page.
|
I have been trying to come up with some code to test with, but the facebook code you posted in the first message does not even work, so i am having problems testing. https://www.deanbassett.com |
Here is facebooks code I got from them..
<div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=634543439897135"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
This is the block code: <div class="fb-follow" data-href="https://www.facebook.com/100004310474547" data-width="250" data-show-faces="true"></div>
It is under my facebook app: 634543439897135
Then My facebook account# is 100004310474547
When I just put it in as a html block it worked but was my code on everyone elses page..
|
|
Well, this is the code. But i can't get it working on my site at all. Even using my number and the normal html version.
$profileID = getID( $_GET['ID'] ); $memberID = getLoggedId(); $facebookID = db_value("SELECT `dbcsFacebookProfile` FROM `Profiles` WHERE `ID`='$profileID'"); if((int)$facebookID != 0) { $sCode = <<<CODE <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=634543439897135"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-follow" data-href="https://www.facebook.com/{$facebookID}" data-width="250" data-show-faces="true"></div> CODE; echo $sCode;
} https://www.deanbassett.com |
Well i think i know why it does not work. The url is wrong when using a number instead of a name. I will have to work something out.
https://www.deanbassett.com |
I can't get that to work either.. Keep getting error |
It's due to the URL. It will not work. The facebook share link requires a profile name. It will not work with the number.
https://www.deanbassett.com |
I can get the code working as I put it with anyones number.. I just changed the 100004310474547 to another number and it ask me if I want to follow that one?
<div class="fb-follow" data-href="https://www.facebook.com/100004310474547" data-width="250" data-show-faces="true"></div>
|
It does not work with all numbers. It does not work with mine.
I think it depends on if the member setup their own url for their profile.
https://www.deanbassett.com |
Anyhow. I can't get it properly working on my site. I know the code is correct. If i view the source of the page it properly inserting the number as it is suppose to. So there is nothing more i can do.
https://www.deanbassett.com |
http://chambertheory.com/Slinger
Here is my code:
<div id="fb-root"></div> <script type="text/javascript">// <![CDATA[ (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=634543439897135"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); // ]]></script> <center> <div class="fb-follow" data-href="https://www.facebook.com/100004310474547" data-width="250" data-show-faces="true"></div> </center>
Then I put Facebook Follow two Code:
<div id="fb-root"></div> <script type="text/javascript">// <![CDATA[ (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=634543439897135"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); // ]]></script> <center> <div class="fb-follow" data-href="https://www.facebook.com/100006437084928" data-width="250" data-show-faces="true"></div> </center>
Only changed the facebook number and put in your number from the profile..
|
Ok thank you.. Might have to try the: \inc\classes\BxDolProfileFields.php with your code and see what happens |
Ok. Hold on. I'll have some different code in a minute.
But keep in mind it will not work for all id's.
To test a ID just do this.
Go to the url in a browser like so. https://www.facebook.com/profile.php?id=100006437084928
The replace the numbers. Like my number for example.
https://www.facebook.com/profile.php?id=728224741634635
If you get a blank white page then it will not work.
New code in a minute. The heredoc method is not working so i need to do something different.
https://www.deanbassett.com |
Ok. There was a error in my code. Here is the new code.
$profileID = getID( $_GET['ID'] ); $memberID = getLoggedId(); $facebookID = db_value("SELECT `dbcsFacebookProfile` FROM `Profiles` WHERE `ID`='$profileID'"); if((int)$facebookID != 0) { $sCode = <<<CODE <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=634543439897135"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-follow" data-href="https://www.facebook.com/{$facebookID}" data-width="250" data-show-faces="true"></div> CODE; echo $sCode;
}
https://www.deanbassett.com |
Is that to be a PHP block? Because it breaks my template? It does show but my template is all messed up? |
Is that to be a PHP block? Because it breaks my template? It does show but my template is all messed up?
Yes. A php block.
I just tested it again, and it does not mess up my template. The code is fine.
https://www.deanbassett.com |
Ok will install your php block mod then try it out.. Thank you Deano.. |
Oh, you do not have php blocks.
Well i did tell you this can only be done in a php block.
https://www.deanbassett.com |
Yea I have not installed it until now.. And now that code works out great. Thanks a lot.. Will it be basically the same code for google as well? Might be a good add to your modules too? Since I am using your connect inputs.. |
Google will be similar.
Just need googles code, and the proper profile field for google.
No. I will not include it in my mod.
As i stated, it does not work with all facebook id's, so for that reason alone, it will not be included because it is not reliable enough.
https://www.deanbassett.com |
Ok.. well I know for it to work. The member would have to connect with your facebook connect app. They cannot just fill in ther facebook number.. It has to go though that app we had to make on facebook.. That is the appId=634543439897135. But anyways. Thanks a lot for all your help.. |
Guess i need to prove it.
So i created a account on your site. You can delete it if you like. But you will find the share box does not show up on my profile. It does not work with my ID.
In the next version of facebook connect i will store a facebook profile link url and a facebook username. It won't be in the profile table, but another table. This will provide the needed info for that share to work with all profiles because you can use the username instead of the number.
It will be quite awhile before the next release tho.
https://www.deanbassett.com |
|