Mam kod single php w stylu wordpress odpowiadający za wyświetlanie się posta. Wygląda on tj poniżej.

  1. <?php get_header(); ?>
  2.  
  3. <!-- Begin #colleft -->
  4. <section>
  5. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  6. <article>
  7. <header>
  8. <h1><?php the_title(); ?></h1>
  9. <div class="meta">
  10. <?php the_time('M j, Y') ?> przez <?php the_author_posts_link()?>&nbsp;&nbsp;&nbsp;<img src="<?php bloginfo('template_directory'); ?>/images/ico_post_comments.png" alt="" /> <?php comments_popup_link(__("Brak komentarzy", "site5framework"),__("1 Komentarz", "site5framework"),__("% Komentarzy", "site5framework") ); ?>&nbsp;&nbsp;&nbsp;<img src="<?php bloginfo('template_directory'); ?>/images/ico_post_date.png" alt="" /> <?php _e("Kategoria", "site5framework"); ?>: <?php the_category(', ') ?>
  11. </div>
  12. </header>
  13. <?php the_content(); ?>
  14. <iframe width="640" height="360" src="http://www.youtube.com/embed/<?php echo get_post_meta($post->ID, "filmik", true); ?>?rel=0" frameborder="0" allowfullscreen></iframe>
  15. <div class="postTags"><?php the_tags(); ?></div>
  16. </article>
  17. <?php comments_template(); ?>
  18. <?php endwhile; else: ?>
  19.  
  20. <p><?php _e("Post jest pusty", "site5framework"); ?></p>
  21.  
  22. <?php endif; ?>
  23.  
  24. </section>
  25. <!-- End section -->
  26.  
  27.  
  28. <?php get_sidebar(); ?>
  29. <?php get_footer(); ?>


Tą pogrubioną linijkę chcę zablokować kupionym skryptem. Umożliwia on zablokowanie danej treści, pojawi się ona dopiero wtedy, gdy ktoś zaloguje się przez facebooka.
Poniżej kod odpowiadający za to:

  1. <?php
  2.  
  3. $f1 = new Fb_ypbox();
  4. $user_data = $f1->getUserData();
  5. $fb_user_id = $user_data['id'];
  6.  
  7. if($fb_user_id!='') {
  8. $user_db = get_users(array('fb_user_id'=>$fb_user_id));
  9. if(count($user_db)>0) {
  10. if($user_db[0]['fb_token_expires']!=0 && time()>$user_db[0]['fb_token_expires']) {
  11. $force_connect =1;
  12. }
  13. }
  14. }
  15.  
  16. if($fb_user_id=='' || count($user_db)==0 || $force_connect==1) {
  17. echo '<br><br>';
  18. echo '<center>';
  19. echo '<h1>Click on the link bellow to unlock your content</h1>';
  20. echo 'You will also be able to check and try out the backend !<br><br>';
  21. echo '<img src="'.$GLOBALS['fb_ypbox_path'].'/include/graph/icons/facebook32.png" style="vertical-align:middle; margin-right:10px; padding-bottom:8px;">';
  22. echo '<a href="#" id="fb_box_fb_login_btn" style="font-size:20px;">Facebook connect</a>';
  23. echo '</center>';
  24. }
  25.  
  26. else {
  27. $user_data = $f1->getUserData();
  28. $fb_image = '<img src="'.$user_data['picture'].'" style="vertical-align:middle; width:50px; margin-right:10px;">';
  29.  
  30. $result = get_settings();
  31. for($i=0; $i<count($result); $i++) {
  32. $settings[$result[$i]['meta_key']] = $result[$i]['meta_value'];
  33. }
  34.  
  35. $settings['locked_content'] = stripslashes($settings['locked_content']);
  36.  
  37. $settings['locked_content'] = str_replace('{picture}', $fb_image, $settings['locked_content']);
  38. $settings['locked_content'] = str_replace('{name}', $user_data['name'], $settings['locked_content']);
  39.  
  40. //Here comes your content that only can be seen by users who have connected
  41. echo '<div style="margin-top:40px;">'.$settings['locked_content'].'</div>';
  42.  
  43. //you can comment out the next section
  44. echo '<br>';
  45. //echo '<fb:like href="http://xxx.com/products/facebook_viral/" send="true" width="450" show_faces="true"></fb:like>';
  46. echo '<br><hr style="margin-bottom:3px;">';
  47. //echo $fb_image;
  48. echo '<div class="span-12">';
  49. echo '<small>You are connected as ';
  50. echo ' <a href="'.$user_data['link'].'">'.$user_data['name'].'</a></small>';
  51. echo ' <small>(<a href="#" id="fb_box_fb_logout_btn">Logout</a>)</small>';
  52. echo '</div>';;
  53.  
  54. }
  55.  
  56. $f1 = new Fb_ypbox();
  57. $f1->load_js_functions();
  58. $f1->loadJsSDK();
  59.  
  60. ?>
  61.  
  62. <?php
  63. echo $GLOBALS['footer'];
  64. ?>


Niestety nie mam pomysłu jak najlepiej połączyć obra skrypty i nie wiem jak zamiast 'locked content' (pobiera z bazy danych) wstawić treść z poprzedniego kodu (pogrubioną).