EllisLab text mark
Advanced Search
9 of 11
9
   
Poll
Should I make the repository Spark friendly?
Yes 5
No 2
Branch off and create a "full" branch. 3
Total Votes: 10
You must be a logged-in member to vote
Facebook Ignited
Posted: 13 October 2012 05:34 AM   [ Ignore ]   [ # 131 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts
tacowaco - 13 October 2012 04:56 AM

Dear Alfonso,
Thanks again for your work on this project, you’re a star!. Are there any plans to add a function for using the notifications API

link to fb notification page

or are you aware of a method for implimenting this under the current system?

Martin,
I will definitely be including that in my next version. I have been pretty busy so I haven’t had much time to look at all the new features Facebook has been adding. Thank you for the suggestion and I look forward to more.

 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
Posted: 17 October 2012 11:06 AM   [ Ignore ]   [ # 132 ]   [ Rating: 0 ]
Joined: 2011-05-07
1 posts

if you want to use notifications with fb ignited then add the following to your controller, make sure you change your app name:

function notification($message){
  $user_id 
$this->fb_ignited->getUser();
  
$token_url =    "https://graph.facebook.com/oauth/access_token?" .
                  
"client_id=" $this->fb_app['fb_appid'.
                  
"&client;_secret=" $this->fb_app['fb_secret'.
                  
"&grant_type=client_credentials";
  
$app_token file_get_contents($token_url);
  
$app_token str_replace("access_token="""$app_token);
  
$data = array(
      
'href'=> 'https://apps.facebook.com/your-app-name/',
      
'access_token'=> $app_token,
      
'template'=> $message
  
);
  
$sendnotification $this->fb_ignited->api('/'.$user_id.'/notifications''post'$data);
 

I hope this helps.

Dee smile

 
Posted: 17 October 2012 11:31 AM   [ Ignore ]   [ # 133 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts
damianMcCann - 17 October 2012 11:06 AM

if you want to use notifications with fb ignited then add the following to your controller, make sure you change your app name:

// Above Code 

I hope this helps.

Dee smile

Actually I modified it to fit in with FBI smile Thanks! Here is the following result that I will be including in the next push:

public function fb_notification($message,$user_id NULL{
 
if ($user_id === NULL{
  $user_id 
$this->facebook->getUser();
 
}
 $data 
= array(
  
'href'=> $this->globals['fb_canvas'],
  
'access_token'=> $this->facebook->getAccessToken(),
  
'template'=> $message
 
);
 
$send_result $this->facebook->api("/$user_id/notifications"'post'$data);
 return 
$send_result;
 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
Posted: 22 October 2012 12:42 AM   [ Ignore ]   [ # 134 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts

Release v1.1.2

- Adding more defined visibility to all methods, preventing users from accessing the $this->globals variable.
- Adding support for file uploads via Facebook Ignited in the fb_config.php
- Added a new method fb_notification() to handle Facebook notifications.
- Added a fix for the constant redirect issue for some users not enabling query strings.

Please keep in mind I am adding the ‘fb_uploads’ option to the config file for a future update that I am looking into at this time. If you have any suggestions and/or comments feel free to post them here and as always I am looking for fresh material for the plugin.

Another thing to note, if you use stackoverflow.com I have been starting to answer questions on there as well. Please feel free to tag it as facebook-ignited if you are able to create a tag, so that I can easily find the questions pertaining to this project.

Thanks!

Alfonso Martinez

 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
Posted: 05 November 2012 09:50 AM   [ Ignore ]   [ # 135 ]   [ Rating: 0 ]
Avatar
Joined: 2009-10-10
20 posts

hi necomnius,

I use the librarie for an App, but I get bugs and errors all the time and its stressing me. After a while the access token seems to expire for example:

API Error Code: 102
API Error Description: Session key invalid or no longer valid

and the new update also contains bugs, this here throws errors:

$_REQUEST['state'$fb_query_strings['state'];
$_REQUEST['code'$fb_query_strings['code']

its says those variables are not set…
my temporary fix is:

if(isset($fb_query_strings['state']) ){
   $_REQUEST[
'state'$fb_query_strings['state'];
  
}else{
   $_REQUEST[
'state''';
  
}
  
if(isset($fb_query_strings['code']) ){
   $_REQUEST[
'code'$fb_query_strings['code']
  
}else{
   $_REQUEST[
'code''';
  

please test everything thoroughly

 
Posted: 05 November 2012 10:32 AM   [ Ignore ]   [ # 136 ]   [ Rating: 0 ]
Avatar
Joined: 2009-10-10
20 posts

I think the solution for expired access tokens can be found here: http://developers.facebook.com/blog/post/2011/05/13/how-to—handle-expired-access-tokens/

and here:
http://developers.facebook.com/roadmap/offline-access-removal/#extend_token

but I don’t have the knowledge on how to implement it :(

 
Posted: 05 November 2012 11:10 AM   [ Ignore ]   [ # 137 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts

v1.1.2 and v1.2.0 are able to handle the what you posted already above. What version are you using?

 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
Posted: 06 November 2012 06:53 AM   [ Ignore ]   [ # 138 ]   [ Rating: 0 ]
Avatar
Joined: 2009-10-10
20 posts
Necromnius - 05 November 2012 11:10 AM

v1.1.2 and v1.2.0 are able to handle the what you posted already above. What version are you using?

It happened with the old one, but it still does with the newest with users who used the app before the upgrade.
If it doesn’t happen anymore with new users of the app then its fine.

 

the other bug affects the newest version:

When $fb_query_strings[‘state’] and $fb_query_strings[‘code’]; are not set, codeigniter reports a warning that why I modified it so that it checks first if the variables are set…

if(isset($fb_query_strings['state']) ){
   $_REQUEST[
'state'$fb_query_strings['state'];
  
}else{
   $_REQUEST[
'state''';
  
}
  
if(isset($fb_query_strings['code']) ){
   $_REQUEST[
'code'$fb_query_strings['code']
  
}else{
   $_REQUEST[
'code''';
  
 
Posted: 10 November 2012 02:59 AM   [ Ignore ]   [ # 139 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts

Release v1.2.0 & v1.2.1

- Adding more defined visibility to all methods, preventing users from accessing the $this->globals variable.
- Adding support for file uploads via Facebook Ignited in the fb_config.php
- Added a new method fb_notification() to handle Facebook notifications.
- Added a fix for the constant redirect issue for some users not enabling query strings.
- Merged Pull Request #11 by dcostalis: Fixed the autoloader config file for Spark.
- Merged Pull Request #12 by dcostalis: Added a conditional to the translating query strings to $_REQUEST[] if existent only.

This should fix quite a few bugs but please let me know if anything comes up again. Thanks!

 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
Posted: 14 November 2012 10:36 PM   [ Ignore ]   [ # 140 ]   [ Rating: 0 ]
Avatar
Joined: 2012-11-14
1 posts

Just stumbled upon your project. This is some fantastic work keep it up! Totally forking this!

 
Posted: 14 November 2012 10:40 PM   [ Ignore ]   [ # 141 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts

Thanks, it comes in waves. Right now I am working on my own facebook app so I have been a bit distracted from this until people post or I need a feature lol.

 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
Posted: 15 November 2012 06:45 AM   [ Ignore ]   [ # 142 ]   [ Rating: 0 ]
Joined: 2012-11-15
1 posts

It seems fb_check_permissions() always returning TRUE.

$datas $this->CI->facebook->api($FQL); 

is returning an array so:

if($datas

always return TRUE

I add this to remove authenticated permissions (1) and return unauthenticated permissions (0) in a string:

$perm implode(','array_keysarray_diff($datas[0], array(1) ) ) ); 

And change if ($datas) statement to: if (!$perm)

fb_check_permissions():

public function fb_check_permissions($perm$extend false{
  
/**
   * Checks if the permission type enquired about is authenticated and accepted.
   * 
   * @param $perm - this is the permission that will be checked.
   * @param $extend - this will tell the function whether or not to extend the users permissions.
   */
  
$FQL = array("method" => "fql.query""query" => "SELECT {$perm} FROM permissions WHERE uid = me()");
  
$datas $this->CI->facebook->api($FQL);
  
  
$perm implode(','array_keysarray_diff($datas[0], array(1) ) ) );
  
  if (!
$perm{
   
return true;
  
else {
   
if ($extend === false{
    
return false;
   
else {
    
echo $this->fb_login_url(true$perm);
    exit;
   
}
  }
 } 

 

 
Posted: 17 November 2012 12:47 PM   [ Ignore ]   [ # 143 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts

Thanks, I will be including that in v1.2.2 smile

 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
Posted: 07 December 2012 11:35 AM   [ Ignore ]   [ # 144 ]   [ Rating: 0 ]
Joined: 2010-07-21
6 posts

Hello Necrominus (and the others) and a huge thanks to you : your job is awesome !

but… unfortunately, there is a but.

I’ve set my environment and everything is working fine until I wanted to put new methods in my controller.
The idea was to put the “fb_get_me” in the __construct method to check if the user is ok for each of the called methods.

So I set up this :

class Dashboard extends CI_Controller {
     
public $userId    null;
 
     function 
__construct()
     
{
          parent
::__construct(); 

          
// The fb_ignited library is already auto-loaded so call the user and app.
          
$this->fb_me $this->fb_ignited->fb_get_me(true); 
          
$this->fb_app $this->fb_ignited->fb_get_app();

          
$this->userId $this->fb_me['id'];
     
}

And everything is working fine.

Then I created other methods (shortened for clarity):

public function index()
{
     
//the code you provide in the example PLUS a link to "dashboard/listAll"
}
public function listAll()
{
     $data[
'pictures'$this->M_picture->getPictures(); // Retrieve pictures list
     
$this->load->view('show_pictures'$data);
}

public function vote($for)
{
     
//do stuff
     
$this->session->set_flashdata('ok'"Hey hey, vote okay !");
     
redirect('dashboard');

Within the “show_pictures” view there is a link targetting

<?php echo anchor('dashboard/vote/10''Vote for image'); ?> 

So I come to my application, click on “dashboard/listAll”, see all the images and want to vote for one.
So I click “dashboard/vote/10” and this method is never called :(

I made some tests and noticed that the

$this->fb_me $this->fb_ignited->fb_get_me(true); 

was the “problem” here.

Could you please tell me what am I doing wrong ?

Thank you so much in advance !

 
Posted: 08 December 2012 07:41 PM   [ Ignore ]   [ # 145 ]   [ Rating: 0 ]
Avatar
Joined: 2010-08-21
77 posts

Hi magikman,
I just wanted to let you know I have been looking into this for you and will include a fix in the v1.2.2 release with the new Facebook PHP SDK updates and posting to activity feed. Work has been pretty busy so I haven’t had a chance to update you on my progress. I appreciate the information ypu provided and if you would be able to report this info on GitHub issues it will allow me to keep track more easily.

If you can give me any more information regard the settings in Facebook dev panel (no app secret values values please) and also please check authorized status of the app in your privacy settings and report those to me I would appreciate any information to help me track this down for you!

Regards,
Rev. Alfonso E Martinez, III
(aka Necromnius)

 Signature 

Dark Prospect Games, LLC | Facebook Ignited on GitHub

 
9 of 11
9