FriendsOfSymfony / FOSFacebookBundle

NOT MAINTAINED - see https://github.com/hwi/HWIOAuthBundle
321 stars 140 forks source link

Customizing the facebook button #287

Open qdelettre opened 11 years ago

qdelettre commented 11 years ago

I would like to change the button image to another.

How can i do that ?

Molkobain commented 11 years ago

You make your own FB Connect button using the facebook_login_url helper. Here an example from my website : Edit : It's not an helper actually but a URL get from the FB API. See next post.

<div class="co_co_button" id="fb_button">
    {{ facebook_initialize({'xfbml': true, 'fbAsyncInit': 'onFbInit();'}) }}
    <a href="{{facebook_login_url}}" title="{{ 'security.login.social_connect.connect_facebook' | trans({}, 'EPUserBundle')}}">
        <img src="/images/pictos/connect-fb.png" alt="{{ 'security.login.social_connect.connect_facebook' | trans({}, 'EPUserBundle')}}" />
        <div class="co_co_button_label">
            <span>{{ 'security.login.social_connect.connect_facebook' | trans({}, 'EPUserBundle')}}</span>
        </div>
    </a>
</div>

image

qdelettre commented 11 years ago

facebook_login_url helper ? facebook_login_url is not defined for me.

Molkobain commented 11 years ago

My bad, I thought it was an helper but it actually an URL I retrieved from the API. I should have read the code completly. :) Edit : But you can come with your own helper of course.

You can get the url from

$facebookLoginUrl = $this->container->get('fos_facebook.api')->getLoginUrl(array('redirect_uri'=> $this->container->get('router')->generate('fos_fb_security_check', array(), true) ));
balvirsingh commented 10 years ago

I implemented this in my page but it is not return email of user. so how can i get email of user ?