Giter Club home page Giter Club logo

yii2-social's Introduction

Krajee Logo
yii2-social
Donate

Stable Version Unstable Version License Total Downloads Monthly Downloads Daily Downloads

Module that enables access to social plugins for Yii Framework 2.0. It includes support for embedding plugins from the following networks into your website:

  • Disqus
  • Facebook
    • Like Button
    • Share Button
    • Send Button
    • Save Button
    • Embedded Posts
    • Embedded Videos
    • Follow Button
    • Comment Button
    • Page Plugin
  • Google Plus
    • Signin Plugin
    • +1 Button
    • Share Button
    • Follow Button
    • Page Badge
    • Person/Profile Badge
    • Community Badge
    • Embedded Posts
  • Google Analytics
  • Twitter
    • Share Button
    • Follow Button
    • Hash Tag Button
    • Mention Button
    • Embedded Posts/Tweets
    • Embedded Timeline
  • VKontakte
    • Comments Button
    • Embedded Post
    • Community/Group
    • Like Button
    • Recommendations
    • Poll Module
    • Authorization
    • Share Content
    • Subscribe
  • GitHub
    • Watch Button
    • Star Button
    • Fork Button
    • Follow Button
  • GitHubX
    • Watch Button
    • Star Button
    • Fork Button
    • Issue Button
    • Download Button
    • Follow Button

Installation

The preferred way to install this extension is through composer.

NOTE: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

Either run

$ php composer.phar require kartik-v/yii2-social "@dev"

or add

"kartik-v/yii2-social": "@dev"

to the require section of your composer.json file.

Usage

Module Configuration

You can view usage and demos on the module.

'modules' => [
    'social' => [
        // the module class
        'class' => 'kartik\social\Module',

        // the global settings for the disqus widget
        'disqus' => [
            'settings' => ['shortname' => 'DISQUS_SHORTNAME'] // default settings
        ],

        // the global settings for the facebook plugins widget
        'facebook' => [
            'app_id' => 'FACEBOOK_APP_ID',
            'app_secret' => 'FACEBOOK_APP_SECRET',
        ],

        // the global settings for the google plugins widget
        'google' => [
            'clientId' => 'GOOGLE_API_CLIENT_ID',
            'pageId' => 'GOOGLE_PLUS_PAGE_ID',
            'profileId' => 'GOOGLE_PLUS_PROFILE_ID',
        ],

        // the global settings for the google analytic plugin widget
        'googleAnalytics' => [
            'id' => 'TRACKING_ID',
            'domain' => 'TRACKING_DOMAIN',
        ],
        
        // the global settings for the twitter plugins widget
        'twitter' => [
            'screenName' => 'TWITTER_SCREEN_NAME'
        ],
    ],
    // your other modules
]

Disqus

VIEW DEMO

Facebook

VIEW DEMO

Google+

VIEW DEMO

Google Analytics

VIEW DEMO

Twitter

VIEW DEMO

GitHub

VIEW DEMO

GitHubX

VIEW DEMO

License

yii2-social is released under the BSD-3-Clause License. See the bundled LICENSE.md for details.

yii2-social's People

Contributors

albertborsos avatar cinghie avatar daugsbi avatar edofre avatar ekzobrain avatar felladrin avatar kartik-v avatar koxu1996 avatar madand avatar shaposhnikov avatar tibee avatar vex21 avatar xzaero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-social's Issues

Google Analytics Widget Enhancements

Various enhancements and additional configuration settings for the GoogleAnalytics widget

  • Remove support for old version (widget only supports the new Google Universal Analytics plugin)
  • New testMode property that defaults to YII_DEBUG definition to allow google analytics to work from localhost.
  • Ability to configure tracking object name. Defaults to __gaTracker.
  • Ability to configure trackerConfig settings for creation of the ga object.
  • Ability to configure sendConfig settings for sending of the ga data.
  • Ability to configure anonymizeIp property.
  • Ability to add additional javascript before sending the ga data.
  • Ability to add additional javascript after sending the ga data.

PHP Recoverable Error – yii\base\ErrorException

Argument 1 passed to Facebook\FacebookRequest::__construct() must be an instance of Facebook\FacebookSession, null given, called in F:\data\xampp\htdocs\wash\vendor\kartik-v\yii2-social\Module.php on line 224 and defined

Unable to locate message source for category 'kvsocial'.

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of yii2-social.
  • This is not an usage question. I confirm having gone through and read the documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • x ] I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

  1. I just added the yii2-social plugin as in documentation.
  2. I replaced the facebook sdk with facebook opengraph repo (as mentioned in your demo page)
  3. When i render the widget, it shows me this error.

Expected behavior and actual behavior

When I follow those steps, I see...

I was expecting to see a facebook button but it gives ne i18n error (translation issue)

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version:
  • yii2-social version:

Isolating the problem

  • This bug happens on the demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using yii2-social without other plugins.

The code breaks at line 207

$label = ArrayHelper::remove($options, 'label', Yii::t('kvsocial', 'Login with Facebook'));
var/lib/openshift/5749a71c89f5cfb4f000008c/app-root/runtime/repo/vendor/kartik-v/yii2-social/Module.php at line 207 – yii\BaseYii::t('kvsocial', 'Login with Facebook')

screenshot from 2016-08-25 01-57-34

Facebook plugin does not work

Hi. I have a problem with Facebook plugin. It does not work at all. I see requests to the facebook API, but I have not any results on the page. HTML which was generated:

<div id="fb-root"></div>
<div class="fb-share-button" data-colorscheme="dark"></div>

Maybe somebody faced with the same issue?

Unable to remove credits from Disqus

I'm using your module to insert Disqus on my website, I think that in Disqus.php you should add this:

if (!isset($this->credits)) {
$this->credits = Html::a(Yii::t('social', 'comments powered by Disqus'), 'http://disqus.com/?ref_noscript');
}

To let us enable/disable and edit credits.

In my case I want to remove it from the bottom of Disqus plugin.

Use plugin in a particular block or div from my entire page

Hello, how to use plugin with particular block or div from entire page, like :

<div id='post-1'>
description....
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::SHARE, 'settings' => []]); ?>
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::LIKE, 'settings' => []]); ?>
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::COMMENT, 'settings' => []]); ?>
</div>
<div id='post-2'>
description....
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::SHARE, 'settings' => []]); ?>
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::LIKE, 'settings' => []]); ?>
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::COMMENT, 'settings' => []]); ?>
</div>
<div id='post-3'>
description....
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::SHARE, 'settings' => []]); ?>
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::LIKE, 'settings' => []]); ?>
<?= FacebookPlugin::widget(['type'=>FacebookPlugin::COMMENT, 'settings' => []]); ?>
</div>

because this is generate script :

<div id='fb-root'></div>
<div class="fb-share-button"></div>
<noscript><div class="alert alert-danger">You must enable Javascript on your browser for the site to work optimally and display sections completely.</div></noscript>

<div id='fb-root'></div>
<div class="fb-like"></div>
<noscript><div class="alert alert-danger">You must enable Javascript on your browser for the site to work optimally and display sections completely.</div></noscript>

<div id='fb-root'></div>
<div class="fb-comments" data-href="http://linktodomain"></div>
<noscript><div class="alert alert-danger">You must enable Javascript on your browser for the site to work optimally and display sections completely.</div></noscript>

I'm refer this link :
http://stackoverflow.com/questions/31446150/facebook-share-only-certain-div
http://stackoverflow.com/questions/9926872/want-to-share-a-particular-block-or-div-from-my-entire-page-into-facebook
http://www.hyperarts.com/blog/tutorial-add-share-button-iframe-tab-applications/

and how to configuration every different div

Custom layout of share buttoms

I have a question is posible customize the default button? For example I want to change the facebook share button by other layout.
Sorry for my English.
Best regards.

facebook comments width

How can I make the facebook comment box wider?

This does not change the width:

'settings' => [
                    'data-width' => '784px',
                    'width' => '784px',
                    'data-num_posts' => 20,
                ],

It's not possible to get session using FB token

I'm trying to get session by FB token, but getFbSession() returns null.

$social = Yii::$app->getModule('social');
$fbSession = $social->getFbSession(['source' => '<TOKEN>']);

where TOKEN - is string FB token

Looks like the statement in kartik\social\Module:179 is incorrect:

       if (
            empty($source) || !is_string($source) || 
            !($source instanceof FacebookRedirectLoginHelper) || 
            !($source instanceof FacebookCanvasLoginHelper) || 
            !($source instanceof FacebookJavaScriptLoginHelper)
        ) {
            return null;
        }

And the second part of the question.
When I commented out that statement, getFbSession() returned correct FB session. But when I tried to get user I got error:

$user = $social->getFbGraphUser(['session' => $fbSession]);
You must provide or set a default application secret.
{
    "name": "Exception",
    "message": "You must provide or set a default application secret.",
    "code": 701,
    "type": "Facebook\\FacebookSDKException",
    "file": "<my_path>\\www\\vendor\\facebook\\php-sdk-v4\\src\\Facebook\\FacebookSession.php",
    "line": 340,

Facebook feeds from page

Hii Kartik,

Hope you are doing good.I have issued with access facebook feeds from facebook page. As I try activity feeds in demo still not work.
Can you give me any suggestion for feeds from facebook,pintrest,twitter etc.

Thankyou in advanced.

Implement vk plugin

Is it possible to implement vk plugin? VK is a huge social network. VK is implemented as client in yii2-authclient extension (link). It has well written documentation

New release of new Facebook php-sdk-v4 break your code

In your composer you should change the facebook api to version 4:
"facebook/php-sdk-v4": "4.*"

At least till you update your code to the new facebook php sdk. I think this update can create some problems for some users.

If some user is using the version 4.* and you update for version 5.* the code break if you don't update and some user update it also breaks.

This is not a backward compatible update so problems will appear!

Undefined variable: js

When trying to call
<?= VKPlugin::widget(['apiId' => '********','type'=>VKPlugin::LIKE]); ?>

Get the error

Undefined variable: js
`
191192193194195196197198199200201202203204205206207208209 $call = "$('#$id').html(VK.Share.button($params))";
} else {
$script = 'openapi.js?116';
$scriptId = 'vk_openapi_script_tag';
$check = 'VK.Widgets';
$widget = ucfirst(substr($this->type, 3));
$call = "VK.Widgets.$widget($params)";
if ($this->_initVk) {
$initOpts = Json::encode(['apiId' => $this->apiId, 'onlyWidgets' => true]);
$js = "VK.init({$initOpts});\n$js"; <-------- Errore
}
}

    $view->registerJsFile('//vk.com/js/api/' . $script, ['async'=>true, 'id'=>$scriptId, 'position'=>View::POS_HEAD]);
    $js = <<< SCRIPT

if (window.VK && $check) {
$call;
} else {
$('#$scriptId').load(function() {
`

$js = "VK.init({$initOpts});\n$js";

Please, tell me, what I do not correctly

Twitter size issue

Twitter share button button doesn't work with default size, it works only when 'large' size is specified

This extension should update the PHP Facebook SDK to v4

I notice that this extension use the PHP SKD v3, I think you should change to v4 to be more future proof.

Yii2 is brand new and a extension like yii2-social will be a most for many users, it deserves the last versions of social SDKs.

Change Language

Hello,

I want to know how to change my share button language to es_ES.

Thank!

Google+ Signin Button Customization

I can't find a way to fine-tune the GooglePlugin::SIGNIN button as described in Google's API.
It appears the button is rendered only using GoogleAuth.signIn(options). In order to render it with gapi.signin2.render(id, options) we need to specify a render function when loading the API, as explained in the documentation:

To create a contextual Google Sign-In button with custom settings, add an element to contain the sign-in button to your sign-in page, write a function that calls signin2.render() with your style and scope settings, and include the https://apis.google.com/js/platform.js script with the query string onload=YOUR_RENDER_FUNCTION.

Currently this isn't possible because the URL is hardcoded. Would it be possible to add this parameter as a widget attribute (perhaps call it public $onload)?

EDIT: It appears we can achieve the same by manually specifying the 'data-XXX' parameters under 'signinOptions', however it is mandatory to also set the class to g-signin2 and we must also manually register the google-signin-client_id meta tag.

Error Setting unknown property: kartik\social\Module::google-analytics

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of yii2-social.
  • This is not an usage question. I confirm having gone through and read the documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

Steps to reproduce the issue

Expected behavior and actual behavior

When I follow those steps, I see...

I was expecting...

Environment

Browsers

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version:
  • yii2-social version:

Isolating the problem

  • This bug happens on the demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using yii2-social without other plugins.

Calling unknown method: kartik\social\Module::getFbApi()

Hello.
I'm trying to use this awesome module, but it is not going to work :(

I installed as described here. I'm reinstalling it 5th or 6th times (using composer). But everytime the same error. Please, explain me what am I doing wrong?
Here are my codes:
config/web.php

'modules' => [
        'user' => [
            'class' => 'amnah\yii2\user\Module',
            // set custom module properties here ...
        ],
        'social' => [
            // the module class
            'class' => 'kartik\social\Module',

            // the global settings for the Disqus widget
            'disqus' => [
                'settings' => ['shortname' => 'DISQUS_SHORTNAME'] // default settings
            ],

            // the global settings for the Facebook plugins widget
            'facebook' => [
                'appId' => '****',
                'secret' => '****',
            ],

            // the global settings for the Google+ Plugins widget
            'google' => [
                'clientId' => 'GOOGLE_API_CLIENT_ID',
                'pageId' => 'GOOGLE_PLUS_PAGE_ID',
                'profileId' => 'GOOGLE_PLUS_PROFILE_ID',
            ],

            // the global settings for the Google Analytics plugin widget
            'googleAnalytics' => [
                'id' => 'TRACKING_ID',
                'domain' => 'TRACKING_DOMAIN',
            ],

            // the global settings for the Twitter plugin widget
            'twitter' => [
                'screenName' => 'TWITTER_SCREEN_NAME'
            ],

            // the global settings for the GitHub plugin widget
            'github' => [
                'settings' => ['user' => 'GITHUB_USER', 'repo' => 'GITHUB_REPO']
            ],
        ],

And controller:

public function actionPublish() {

        $social = Yii::$app->getModule('social');
        $social->facebook = [
            'appId' => '***',
            'secret' => '***',
            // any other custom settings
        ];
        // fetch the facebook sdk api
        $facebook = $social->getFbApi();

    }

The error:

Unknown Method – yii\base\UnknownMethodException

Calling unknown method: kartik\social\Module::getFbApi()

$facebook = $social->getFbApi();

But this is working:
http://demos.krajee.com/social#facebook

facebook plugin async issue

I'm getting FB.getLoginStatus() called before calling FB.init(). error in console each time facebook comments plugin is activated.
The fix would be to load the facebook SDK async, but there is no such configuration.

My suggestion is to add 'async' configuration key next to appId and secret, and if async is true, then append js.async = true maybe in FacebookPlugin.php after line 114.

Thank you!

New features for Facebook PHP SDK 4.0

  • Implement an extended FacebookRedirectLoginHelperX class for handling sessions the Yii way
  • New getFbLoginHelper method in social module to fetch the Redirect Login Helper object instance based on the module level facebook settings
  • New initFbSession method in social module to initialize a facebook session
  • New getFbSession method in social module to get a facebook session either based on string token, redirect login url, canvas login, or Javascript login.
  • New getFbGraphUser method gets the Facebook graph user object for current user.

Changes from earlier release

  • Method getFbApihas been removed from the social module
  • Module getFbUser has been removed from the social module

vk.com

Do you plan to add vk.com?

How can I translate with zelenin/yii2-i18n-module

I'm not able to use the translations on your widget with the zelenin/yii2-i18n-module module.

If I comment out line 112 in Widget.php:

Yii::$app->i18n->translations['social'] = $this->i18n;

Then it does get the translation from zelenin' module.

Is this a bug or should I configure your Widget? If so how can I configure the widget globally?

disable_mobile setting

I had:

'disable_mobile' => false

Which broke the whole widget, I fixed it by changing it into a string:

'disable_mobile' => 'false'

Should be easy to fix

Facebook Language, replace hyphen

Facebook needs language structured like "xx_XX". Yii::$app->language gives "xx-XX". You should provide, in the init function of the facebook plugin, a string like this
str_replace('-', '_', $this->language)

In this moment, I'm forced to use this string within the "language" property of the facebook plugin widget string

echo FacebookPlugin::widget(['type'=>FacebookPlugin::LIKE, 'settings' => [],'language' => str_replace('-', '_', Yii::$app->language)]);

Thank you

Web App don't use mobile native app to login

When i try to login with facebook from my smartphone, i would expect it gets the credentials of the facebook native app (for android), but instead i get the facebook web form for the login.

There is a way to get credentials from native app when i use my Yii2 web app?

[Bug] Underfined variable exception

When I am trying to use VkPlugin I am getting an exception:

Caused by: yii\base\ErrorException
Undefined variable: js

in /var/www/site.com/vendor/kartik-v/yii2-social/VKPlugin.php at line 200

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.