Advertisement:

Author Topic: Redirect user after login  (Read 2934 times)

amoric69

  • Full Member
  • ***
  • Posts: 185
Redirect user after login
« on: April 03, 2014, 12:01:58 pm »
Hello,
Is it possible to redirect user after his facebook connection ?
Or make appear a button loggin, somebody can help me the write the code ?
<?php  if ( osc_fbc_login == true()) { ?>

<button>Redirection</button>
;

  <?php if( osc_price_enabled_at_items() ) { ?>
                        <div class="control-group" style="margin-top:12px;margin-bottom:12px;">
                            <label class="control-label" for="price"><?php _e('Price', 'bender'); ?></label>
                            <div class="controls">
                                <?php ItemForm::price_input_text(); ?>
                                <?php ItemForm::currency_select(); ?>
                            </div>
                        </div>
                        <?php } ?>

amoric69

  • Full Member
  • ***
  • Posts: 185
Re: Redirect user after login
« Reply #1 on: April 03, 2014, 12:04:20 pm »
Something like it...

somebody can help me ?

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: Redirect user after login
« Reply #2 on: April 06, 2014, 01:55:47 pm »
I am looking to do the same.. I think you gotta change base.facebook.php in the plugin folder

Code: [Select]
  /**
   * Get a Login URL for use with redirects. By default, full page redirect is
   * assumed. If you are using the generated URL with a window.open() call in
   * JavaScript, you can pass in display=popup as part of the $params.
   *
   * The parameters:
   * - redirect_uri: the url to go to after a successful login
   * - scope: comma separated list of requested extended perms
   *
   * @param array $params Provide custom parameters
   * @return string The URL for the login flow
   */
  public function getLoginUrl($params=array()) {
    $this->establishCSRFTokenState();
    $currentUrl = $this->getCurrentUrl();

    // if 'scope' is passed as an array, convert to comma separated list
    $scopeParams = isset($params['scope']) ? $params['scope'] : null;
    if ($scopeParams && is_array($scopeParams)) {
      $params['scope'] = implode(',', $scopeParams);
    }

    return $this->getUrl(
      'www',
      'dialog/oauth',
      array_merge(array(
                    'client_id' => $this->getAppId(),
                    'redirect_uri' => $currentUrl, // possibly overwritten
                    'state' => $this->state),
                  $params));
  }

  /**
   * Get a Logout URL suitable for use with redirects.
   *
   * The parameters:
   * - next: the url to go to after a successful logout
   *
   * @param array $params Provide custom parameters
   * @return string The URL for the logout flow
   */
  public function getLogoutUrl($params=array()) {
    return $this->getUrl(
      'www',
      'logout.php',
      array_merge(array(
        'next' => $this->getCurrentUrl(),
        'access_token' => $this->getUserAccessToken(),
      ), $params)
    );
  }

volunteer

  • Full Member
  • ***
  • Posts: 241
Re: Redirect user after login
« Reply #3 on: April 06, 2014, 02:28:26 pm »

amoric69

  • Full Member
  • ***
  • Posts: 185
Re: Redirect user after login
« Reply #4 on: April 07, 2014, 07:07:12 pm »
I try it :
Quote
return $this->getUrl(
      'www',
      'dialog/oauth',
      array_merge(array(
                    'client_id' => $this->getAppId(),
                    'redirect_uri' => $currentUrl('http://www.mywebsite.com/home-page/'), // possibly overwritten
                    'state' => $this->state),
                  $params));
  }

but, it does'nt run too

why ?

volunteer

  • Full Member
  • ***
  • Posts: 241