Go Back   DevBook Facebook Forum > Epic Developer Community


Welcome to the DevBook Facebook Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 07-24-2007, 04:52 PM
budlight budlight is offline
Administrator
 
Join Date: Jun 2007
Posts: 33
budlight is on a distinguished road
Default Anyone have any good invite code?

Anyone have any good invite code? here is mine, it's not really setup for forced invites but it works well. It would be nice if it had javascript to only allow ten checkboxes to be checked. Make sure to add these Javascript and css files to your site:
http://thedevbook.com/apps/js/basics.js
http://thedevbook.com/apps/js/facebook.js
http://thedevbook.com/apps/styles/facebook.css

PHP Code:
<?php
include_once('init.php'); //this file does stuff like initializes the facebook object etc

$notificationName=get_notification_name($appname);
$message=get_request_message($appname);
$image='http://thedevbook.com/apps/qmark_tiny.jpg';

if (
$_POST['f']) {
$triedmore=0;
$MAX_FRIENDS_PER_REQUEST=10;
$uid=$_POST['user'];
$ses=$_POST['session'];

$values $_POST['f'];


if (
count($values) > 10)
{
    
$triedmore=1;
}elseif (
count($values)==0)
{
    echo 
"You didn't add any friends";

    
//$facebook->redirect(get_app_url($appname));
}
    
$ids=implode(',',array_slice($values,0,$MAX_FRIENDS_PER_REQUEST));



//  public function notifications_sendRequest($to_ids, $type, $content, $image, $invite)
$redirurl=$facebook->api_client->notifications_sendRequest($ids$notificationName ,$message,$image,'false');
//echo $redirurl;

if ($redirurl==''){
        
//storeinvite($uid,$ses,$ids,'failed',$triedmore,time()); you'd need this function for this to work
    
$facebook->redirect(get_app_url($appname));

}else{
        
//storeinvite($uid,$ses,$ids,'success',$triedmore,time()); you'd need this function for this to work
$facebook->redirect($redirurl);

}
//print_r($ids);

}
else{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>yeah a title would be nice</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <script type="text/javascript" src="http://thedevbook.com/apps/js/basics.js"></script>
        <script type="text/javascript" src="http://thedevbook.com/apps/js/facebook.js"></script>
        <link rel="stylesheet" href="http://thedevbook.com/apps/styles/facebook.css" type="text/css" />
    </head>

    <body>
        <?  include('header.php'); ?>
        <br />
        <br />
        <div align="center">
        Below are your friends who haven't yet added this application <br /><br />
            <? print_invite_form($facebook,$user,$facebook->api_client->session_key,$appname);?>
        </div>
        <? include('footer.php'); ?>
    </body>
</html>

<?

}


function 
print_invite_form($facebook,$uid,$ses,$app){

    
$rawfriends=$facebook->api_client->friends_get();
    if (
count($rawfriends) > 1) {
        
$friends implode(',',$rawfriends);
        
$friendlist "'" str_replace(",","','",$friends) . "'";
        
// might error if 0 or 1
        
$picturearray $facebook->api_client->fql_query("SELECT name,first_name, last_name, pic_square,uid FROM user WHERE uid in ($friendlist) AND has_added_app='0';");
        
usort($picturearray,'CompareFriendsNames');

        echo 
"<form method=\"post\" >
        <div class=\"sharesubmit\">
        
        <input type=\"submit\" value=\"Invite Your Friends\" class=\"inputsubmit donebutton\"/><br />
        Please only invite up to 10 friends at a time.
        </div>
        <div class=\"selectall\" style=\"width:500px;\">
        <a href=\"#\" onclick=\"selectAll(true);return false;\"> Select All </a>
        |
        <a href=\"#\" onclick=\"selectAll(false);return false;\"> Unselect All </a>
        </div>

        <input type=\"hidden\" name=\"user\" value=\"$uid\"/>
        <input type=\"hidden\" name=\"session\" value=\"$ses\"/>
        <input type=\"hidden\" name=\"app\" value=\"$app\"/>
        <input type=\"hidden\" name=\"pcid\" value=\"0\"/>
        <table>
        <tr>
        <td>
        <div class=\"friend_selector\" style=\"height:375px;width:500px;overflow:auto;\">
        <table>"
;

        
//echo friends tables here
        
$x=0;
        for (
$i=0;$i count($picturearray);$i++){

            if (
$x <= 0){
                echo 
"<tr>\n";
            }

            echo 
'<td class="friendtile">    ';
            if     (
strlen($picturearray[$i][pic_square])==0){
                
$picturearray[$i][pic_square]=APPBASE 'images/qmark_tiny.jpg';
            }
            echo 
"<table><tr><td><img src=\"" $picturearray[$i][pic_square].
            
"\" style=\"width:30px;\" alt=\"userpic\" /></td><td><input id=\"check_$i\" " .
            
" type=\"checkbox\" name=\"f[]\" value=\"" .
            
$picturearray[$i][uid] . "\" checked=\"checked\" /></td><td><span class=\"friendtext\">" .
            
$picturearray[$i][name] . "</span></td></tr></table>";
            echo 
'</td>';
            if (
$x >= 2){
                echo 
"</tr>\n";
                
$x=0;

                }elseif (
$i== (count($picturearray)-1)){
                    echo 
"</tr>\n";
                    }else{
                        
$x++;
                    }
                }


                echo
'                        </table>
                </div>
                </td>
                </tr>
                <tr>
                <td>
                <div class="sharesubmit">
                <input type="submit" value="Invite Your Friends" class="inputsubmit donebutton"/>

                </div>
                </td>
                </tr>
                </table>
                </form>'
;

            }
        }
?>
Reply With Quote
Sponsored Links
Advertisement
  #2 (permalink)  
Old 07-27-2007, 11:34 PM
budlight budlight is offline
Administrator
 
Join Date: Jun 2007
Posts: 33
budlight is on a distinguished road
Default Re: Anyone have any good invite code?

I forgot to include this function. It lets them be sorted in alphabetical order which is a huge improvement in my opinion.
PHP Code:
function CompareFriendsNames($ar1$ar2)
{
   if (
strtolower($ar1['last_name']) < strtolower($ar2['last_name']))
      return -
1;
   else if (
strtolower($ar1['last_name']) > strtolower($ar2['last_name']))
      return 
1;
   if (
strtolower($ar1['first_name']) < strtolower($ar2['first_name']))
      return -
1;
   else if (
strtolower($ar1['first_name']) > strtolower($ar2['first_name']))
      return 
1;
   return 
0;

Reply With Quote
  #3 (permalink)  
Old 08-10-2007, 06:50 PM
stueynet stueynet is offline
Junior Member
 
Join Date: Aug 2007
Posts: 1
stueynet is on a distinguished road
Default Re: Anyone have any good invite code?

Fatal error: Call to undefined function get_notification_name() in ...

Where is this function?

I would eat my own arm for a copy and past invite.php file that works perfectly.
Reply With Quote
  #4 (permalink)  
Old 07-21-2008, 07:52 AM
ravinesh.raj ravinesh.raj is offline
Junior Member
 
Join Date: Jul 2008
Posts: 1
ravinesh.raj is on a distinguished road
Default Re: Anyone have any good invite code?

Hi Budlight

can u provide me code of invite2.php that has been used in "Logocreater" application for invite the friends. And pls also give detail, how it works? asap
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:14 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0

Ad Management by RedTyger