0

Facebook アプリについて、「あなたのアプリは、ユーザーが許可リクエストを拒否した後、ユーザーを繰り返しログイン ダイアログにリダイレクトします。優れたユーザー エクスペリエンスを提供するためのプラットフォーム ポリシーを満たすように、アプリを更新してください。」というアラートを受け取りました。

誰でもそれを修正するのを手伝ってもらえますか。ここにコードがあります

    <?php
if (!empty($_GET['i'])) {
  session_start();
  $_SESSION['imguris'] = $_GET['i']; 
}

require( '../../../../wp-load.php' );

$toptions = get_option('sample_theme_options');

if (!empty($toptions['fbappid']) && !empty($toptions['fbapisecret'])) {

    $fbconfig['appid' ]     = $toptions['fbappid'];
    $fbconfig['secret']     = $toptions['fbapisecret'];
    $fbconfig['baseurl']    = get_bloginfo('template_url')."/fb/index.php";
    //print_r($fbconfig);

    if (isset($_GET['request_ids'])){

    }

    $user            =   null; //facebook user uid
    try{
        include_once "facebook.php";
    }
    catch(Exception $o){
        error_log($o);
    }

    $facebook = new t_Facebook(array(
      'appId'  => $fbconfig['appid'],
      'secret' => $fbconfig['secret'],
      'cookie' => true,
    ));

    $user       = $facebook->getUser();    
    $loginUrl   = $facebook->getLoginUrl(array(
                'scope'         => 'publish_stream',
                'redirect_uri'  => $fbconfig['baseurl'])
    );

    function d($d){
        echo '<pre>';
        print_r($d);
        echo '</pre>';
    }

    if (!$user) { ?>
        <script type="text/javascript"> 
        window.top.location.href="<?php echo $loginUrl; ?>"; 
        </script>
    <?php } ?>

    <?php if ($user){
        if (isset($_SESSION['imguris'])) {
            $imguri = str_replace(get_option('home'), "", $_SESSION['imguris']);
            $imguri = '../../../../'.$imguri;               
            $facebook->setFileUploadSupport(true);
            $args = array('message' => $toptions['covtitle']);
            $args['image'] = '@' . realpath($imguri);
            try {
                    $data = $facebook->api('/'.$user.'/photos', 'post', $args);
                    //print_r($data);
            } catch (t_FacebookApiException $e) {
                    //d($e);
            }
            if (isset($data['id'])) {
                if (isset($toptions['instructionsurl'])) {
                    $redir = $toptions['instructionsurl'];
                } else {
                    $redir = get_option('home');
                }
                echo "<script type='text/javascript'> window.top.location.href='".$redir."'; </script>";
            }
        }
    } 

} else {
    if (isset($toptions['instructionsurl'])) {
        $redir = $toptions['instructionsurl'];
    } else {
        $redir = get_option('home');
    }
    echo "<script type='text/javascript'> window.top.location.href='".$redir."'; </script>";
}

?>

ありがとう

4

1 に答える 1

0

The problem isn't about the code, it's about the workflow. FB user experience policies state that an app should not repeatedly ask users for permissions if they keep refusing them. However it should also provide users with a clear way to grant those permissions if they decide so. There is no specific solution to achieve this behavior, but FB recommends developers separate their essential and non-essential permission requests, i.e. only ask for basic read permissions on login and then before the app attempts to post content on FB verify that you have the necessary write permissions, and present the user with the appropriate permission request if not.

Check out FB permissions documentation for more info on possible Developer Alerts and proposed courses of action to resolve them.

于 2013-06-05T10:19:02.003 に答える