1

I read the README from https://github.com/SocalNick/ScnSocialAuth. I can not use the ZendSkeleton because I want to integrate it in an existing project.

I'm quiet new and the README does not answer some question, like

  1. How do I integrate it with my zfc-user/login.phtml / register.phtml etc.?
  2. What do I do after the last step in the README?
  3. What page do I need to access to test if it works?

My problem is that the README has an abrupt end and leaves me in the dark about how to use/access it.

However, I followed all the steps in the README and end up with the following error:

PHP Fatal error: Call to a member function getEnabledProviders() on a non-object in /view/zfc-user/user/login.phtml on line 3

My zfc-user/login.phtml

<?php
$socialSignIn = true;
foreach ($this->options->getEnabledProviders() as $provider) {
if ($socialSignIn) {
    echo '<h1>Social Sign In</h1>';
    $socialSignIn = false;
}
echo '<dd>' . $this->socialSignInButton($provider, $this->redirect) . '</dd>';
}
if ($this->options->getSocialLoginOnly() == false) {
echo $this->zfcUserLogin;
}
?>

application.config.php

'modules' => array(
    'Application',
    'ScnSocialAuth',
    'ZfcBase',
    'ZfcUser'
    ...

composer.json

"require": {
    "php": ">=5.3.3",
    "zendframework/zendframework": "2.*",
    "zendframework/zend-diactoros": "*",
    "zf-commons/zfc-base": "*",
    "zf-commons/zfc-user": "1.2.*",
    "neilime/zf2-twb-bundle": "*",
    "symfony/yaml": "*",
    "snapshotpl/zf-snap-jquery": "dev-master",
    "zendframework/zendservice-recaptcha": "2.*",
    "socalnick/scn-social-auth": "1.*"
},
"autoload": {
    "psr-0": {
        "Hybrid": "vendor/hybridauth/hybridauth/hybridauth/"
    }
}

composers autoload_namespaces.php

return array(
'phpDocumentor' => array($vendorDir . '/phpdocumentor/reflection-docblock/src'),
'ZfcUser' => array($vendorDir . '/zf-commons/zfc-user/src'),
'ZfcBase' => array($vendorDir . '/zf-commons/zfc-base/src'),
'ZfSnapJquery' => array($vendorDir . '/snapshotpl/zf-snap-jquery/src'),
'ZendXml' => array($vendorDir . '/zendframework/zendxml/library'),
'ZendService' => array($vendorDir . '/zendframework/zendservice-recaptcha/library'),
'TwbBundle' => array($vendorDir . '/neilime/zf2-twb-bundle/src'),
'ScnSocialAuthTest' => array($vendorDir . '/socalnick/scn-social-auth/test'),
'ScnSocialAuth' => array($vendorDir . '/socalnick/scn-social-auth/src'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src'),
'Hybrid' => array($vendorDir . '/hybridauth/hybridauth/hybridauth', $vendorDir . '/hybridauth/hybridauth/hybridauth'),
);

Do I miss something in the docs or is it just the heat that's screwing with my head?

Andy Powers
  • 75
  • 10
  • i just installed the SkeletonApp from Zend and followed the README. I get the same error as mentioned above when adding the same lines as in my question to my zfc-user/login.phtml – Andy Powers Jul 07 '15 at 12:18
  • 2
    The error is quite obvious, `$this->options` is an undefined view variable. If you are not using the standard controller from that repository then it would have never have been set. You will need `$viewModel->options = $this->getServiceLocator()->get('ScnSocialAuth-ModuleOptions')` in the controllers `loginAction()` to pass the options to the view. – AlexP Jul 07 '15 at 15:56

0 Answers0