24 pointsStarting to get into this DEV thingI'm new here
TehStig
Member
—
30th June 2011 08:43
Hello,
I was curious what the actually facebook php tag was (or shortcode) to add the facebook connect button to other pages on my site. In my theme, when a user clicks login they get a popup login form but no facebook connect unless directed to the /wp-login.php form.
At any rate, I was told by my theme designer that if I know my php tag to add I can insert it into my login form. I just didn't know what that was for this mod.
Hello,
I was curious what the actually facebook php tag was (or shortcode) to add the facebook connect button to other pages on my site. In my theme, when a user clicks login they get a popup login form but no facebook connect unless directed to the /wp-login.php form.
At any rate, I was told by my theme designer that if I know my php tag to add I can insert it into my login form. I just didn't know what that was for this mod.
The mod does add a facebook login button on the main /wp-login.php page, if we could port that around somehow it would be nice. I think there is a widget included too, but I didn't want it in the sidebar.
If the widget isn't working for your design, perhaps this can help.
First, you'll need to enable the Facebook Connect widget - you won't be using it in your sidebar, but it needs to be enabled so it loads some of the javascript we need for the login button to work nicely. You can do this by going to Facebook > Widget Pack page in your admin interface, checking the box labeled "Use Facebook Connect widget" and hitting "Save Changes" button.
This will just load the widget and its dependencies (which we need for step 2) - the widget won't actually be shown unless you put it in your sidebar.
After this is done, you can use this PHP snippet in your theme, where you want your login button to appear:
This is, essentially, the "business" part of the Facebook login button in our connect widget. The code does the following:
1) Check if the user is already logged in.
2) If not, it will print the Facebook button with the needed permissions.
3) If the user is logged in, it will show his avatar and the logout link beneath it.
Good idea mcmcghee and TehStig, and the latest version provides that shortcode for ya! You'll find more details on it in the Facebook > Shortcodes page.
Responses (5)
Sales & Support Pro — 30th June 2011 15:15 #
Hiya!
I've had a look at the code and it doesn't look like there is a specific function for actually adding the connect stuff in...
Take a look at wpmu-dev-facebook/lib/forms/registration_page.php to see the code....
It may be that you can use some of that same code if you're proficient with PHP.
I'll ask the developer if he can provide any guidance too.
Phil
Member — 30th June 2011 16:29 #
Thanks for the help, Phil
The mod does add a facebook login button on the main /wp-login.php page, if we could port that around somehow it would be nice. I think there is a widget included too, but I didn't want it in the sidebar.
Developer — 1st July 2011 14:50 #
Hi,
If the widget isn't working for your design, perhaps this can help.
First, you'll need to enable the Facebook Connect widget - you won't be using it in your sidebar, but it needs to be enabled so it loads some of the javascript we need for the login button to work nicely. You can do this by going to Facebook > Widget Pack page in your admin interface, checking the box labeled "Use Facebook Connect widget" and hitting "Save Changes" button.
This will just load the widget and its dependencies (which we need for step 2) - the widget won't actually be shown unless you put it in your sidebar.
After this is done, you can use this PHP snippet in your theme, where you want your login button to appear:
This is, essentially, the "business" part of the Facebook login button in our connect widget. The code does the following:
1) Check if the user is already logged in.
2) If not, it will print the Facebook button with the needed permissions.
3) If the user is logged in, it will show his avatar and the logout link beneath it.
Member — 23rd August 2011 17:42 #
Any chance this can be put in a shortcode or something in a future release?
WPMU DEV Fanatic — 13th September 2011 18:54 #
Good idea mcmcghee and TehStig, and the latest version provides that shortcode for ya! You'll find more details on it in the Facebook > Shortcodes page.
Thanks,
David
Become a member