kartik-v / yii2-social Goto Github PK
View Code? Open in Web Editor NEWA Yii2 module for embedding social plugins and widgets.
Home Page: http://demos.krajee.com/social
License: Other
A Yii2 module for embedding social plugins and widgets.
Home Page: http://demos.krajee.com/social
License: Other
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.
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.
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.
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,
You fix the problem?
http://demos.krajee.com/site/vk-plugin?type=like
pull request #51 , solves the problem.
I need VKPlugin, what works, but running only SHARE.
When trying to call
<?= VKPlugin::widget(['apiId' => '********','type'=>VKPlugin::LIKE]); ?>
Get the error
Undefined variable: js
`
191192193194195196197198199200201202203204205206207208209
} 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
I guess it's still working, but switching to facebook/graph-sdk will have us get rid of the nasty message when updating Composer.
master
branch of yii2-social.When I follow those steps, I see...
I was expecting to see a facebook button but it gives ne i18n error (translation issue)
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')
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!
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?
Please Help me to get google+ profile data after login to save in database which is same as facebook login module.
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
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
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
Enhancement
Will you be implementing a twitter feed widget rather than just be able to embed a single tweet.
Twitter share button button doesn't work with default size, it works only when 'large' size is specified
Error is :
"Failed to clone [email protected]:facebook/facebook-php-sdk.git, git was not found, check that it is installed and in your PATH env.
'git' is not recognized as an internal or external command,
operable program or batch file."
Add new class kartik\social\FacebookPersistentHandler
.
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!
Pls help me How to set title, image while sharing in Facebook?
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
FacebookRedirectLoginHelperX
class for handling sessions the Yii waygetFbLoginHelper
method in social module to fetch the Redirect Login Helper object instance based on the module level facebook settingsinitFbSession
method in social module to initialize a facebook sessiongetFbSession
method in social module to get a facebook session either based on string token, redirect login url, canvas login, or Javascript login.getFbGraphUser
method gets the Facebook graph user object for current user.Changes from earlier release
getFbApi
has been removed from the social modulegetFbUser
has been removed from the social moduleI'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.
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
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
Include Developer API for fetching Instagram Pics
Pinterest Plugin Possible?!
yii2-social depends on yii2-krajee-base. You should add it in your composer file.
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?
Hello,
I want to know how to change my share button language to es_ES.
Thank!
I would like to have a suggestion for creating Event pages in Facebook
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
master
branch of yii2-social.When I follow those steps, I see...
I was expecting...
Actualy Facebook PHP SDK is v5
An alternative extended version of Github buttons
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.
I am trying to use you extension but seems that your website is with some problem, I can't open links like this http://demos.krajee.com/social
Can you fix it?
Thanks
Various enhancements and additional configuration settings for the GoogleAnalytics
widget
testMode
property that defaults to YII_DEBUG
definition to allow google analytics to work from localhost.__gaTracker
.trackerConfig
settings for creation of the ga object.sendConfig
settings for sending of the ga data.anonymizeIp
property.Hi would be good if you can make it possible set google _anonymizeIp to true.. in europe coutries its a must.
thanks
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?
The solution that I found for this it to declare setPluginOptions in GooglePlugin as:
protected function setPluginOptions($convertLowerCase = true)
Do you plan to add vk.com?
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,
],
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.