Not Follow Back (Simple Custom)


SUBMITTED BY: Guest

DATE: March 19, 2013, 10:25 a.m.

FORMAT: PHP

SIZE: 2.1 kB

HITS: 1571

  1. <?php
  2. menu_register(array(
  3. 'notfollback' => array(
  4. 'hidden' => true,
  5. 'security' => true,
  6. 'callback' => 'twitter_notfollback_page',
  7. ),
  8. ));
  9. function twitter_notfollback_page($query){
  10. $user = $query[1];
  11. if (!$user) {
  12. user_ensure_authenticated();
  13. $user = user_current_username();
  14. }
  15. $request = API_URL."followers/ids.xml?screen_name={$user}";
  16. $tla = twitter_process($request); //This is the curl Oauth and all that.
  17. $requestf = API_URL."friends/ids.xml?screen_name={$user}";
  18. $tlaf = twitter_process($requestf);
  19. $tla = iterator_to_array(simplexml_load_string($tla),false);
  20. $tla_arr = (array) $tla[0];
  21. $tlaf = iterator_to_array(simplexml_load_string($tlaf),false);
  22. $tlaf_arr = (array) $tlaf[0];
  23. $val = array_diff($tlaf_arr['id'],$tla_arr['id']);
  24. $content="";
  25. foreach($val as $user)
  26. {
  27. $requestlook = API_URL."users/lookup.xml?user_id={$user}";
  28. $tplookup = twitter_process($requestlook);
  29. $xml = simplexml_load_string(utf8_encode($tplookup));
  30. $us = $xml->user->screen_name;
  31. $avatar = $xml->user->profile_image_url;
  32. $bio = $xml->user->description;
  33. $content .= "<div class='well container'>";
  34. $content .= "<div class='lead'>";
  35. $content .= "<span class='avatar'><img src='{$avatar}'/></span>";
  36. $content .= "<span class='status shift'><b><a href='user/{$us}'>@{$us}</a></b>
  37. <br/><small>{$bio}</small></span>
  38. <hr/><a href='user/{$us}' class='btn'>Mention @{$us}</a> <a href='unfollow/{$us}' class='btn'>Unfollow @{$us}</a> <a href='direct/create/{$us}' class='btn'>DM @{$us}</a>";
  39. $content .= "</div>";
  40. $content .= "</div>";
  41. }
  42. if($content == null){
  43. $content.="<br/><p class='well container' style='padding-left:5px;'>Nobody. . . Everyone is following you back</p><br/>";
  44. }
  45. theme('page', "Not FollBack", $content);
  46. }
  47. ?>

comments powered by Disqus