logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$12
Add 200 cubepoints for Facebook like - once only.

Hi,

I use Cubepoints on my WP site, and I would like to encourage new users to also like my facebook page (http://facebook.com/dropdeadgorgeousdaily) after sign up.

To be able to do this I need to have an image/button link that when clicked will:

A) add them as a fan on my facebook page, and
B) give that logged in user 200 cubepoints.

I also want to make sure each user can only get the points once.

Here is a forum post which seems to be almost there, but I can't get it working for me.

Thanks

Kate

http://cubepoints.com/forums/topic/help-adding-extra-point-types-please-facebook-vote-it-up/

attachment image View Attachment

kateM82 | 12/29/11 at 10:09pm Edit
Tutorial: How to assign prize money


(2) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    12/29/11
    10:37pm
    Romel Apuya says:

    Hi KateM82,


    I can help you with this.
    Can you give me access to the codes


    cheers,

    romel

    • 12/29/11 10:41pm

      kateM82 says:

      Hi Romel,

      Which codes are you after?

    • 12/29/11 10:44pm

      Romel Apuya says:

      on the wp site that you have.

    • 12/29/11 11:04pm

      kateM82 says:

      I don't think you need access to my site for this, if you can just let me know the code to be dropped into a custom template page I am happy to test it out. thanks.

    • 12/29/11 11:08pm

      Romel Apuya says:

      can you post the code of the template you are using?

    • 12/29/11 11:32pm

      kateM82 says:

      here you go.


      <?php
      /*
      Template Name: signing bonus
      */

      ?>



      <div id="content" style="margin-bottom: 20px; width: 640px;">

      <h3 style="text-align: center;">Click here to score DDG$200 for liking us of Facebook.</h3>
      <p style="text-align: center;"><img class="aligncenter size-full wp-image-140021" title="Like us now for extra DDG$" src="http://dropdeadgorgeousdaily.com/wp-content/uploads/like-us-button.png" alt="Like us now for extra DDG$" width="198" height="64" /></p>
      <h3 style="text-align: center;">And finally fill out the form below and invite your friends.</h3>
      <h3 style="text-align: center;">Every friend who you invite (who signs up) will score you an extra DDG$200!</h3>



      </div>

      <div class="sidebars">
      <?php echo thesis_sidebars(); ?>
      </div>

    • 12/29/11 11:57pm

      Romel Apuya says:


      <?php
      /*
      Template Name: signing bonus
      */
      ?>
      <div id="content" style="margin-bottom: 20px; width: 640px;">
      <?php
      global $current_user;
      get_currentuserinfo();
      $user_id = "$current_user->ID";
      ?>
      <h3 style="text-align: center;">Click here to score DDG$200 for liking us of Facebook.</h3>
      <p style="text-align: center;">
      <a onclick="window.location='?share=YES'" href="http://facebook.com/dropdeadgorgeousdaily" target="_blank">
      <img class="aligncenter size-full wp-image-140021" title="Like us now for extra DDG$" src="http://dropdeadgorgeousdaily.com/wp-content/uploads/like-us-button.png" alt="Like us now for extra DDG$" width="198" height="64" />
      </a>
      </p>
      <h3 style="text-align: center;">And finally fill out the form below and invite your friends.</h3>
      <h3 style="text-align: center;">Every friend who you invite (who signs up) will score you an extra DDG$200!</h3>
      </div>
      <?php
      if ($share == "YES") {
      $share = "NO";
      if( function_exists('cp_alterPoints') && is_user_logged_in() ){
      cp_alterPoints($user_id, 200);
      cp_log('sharing', $user_id, 200, "admin");
      }
      }
      ?>
      <div class="sidebars">
      <?php echo thesis_sidebars(); ?>
      </div>


      here's the code.
      but this has drawback. as what the furom said.

      but this code be improved if you use facebook connect together with cubepoints.
      facebook connect has more control regarding facebook functionalities.

      cheers.

    • 12/30/11 1:51am

      kateM82 says:

      Thanks for this, I tried it, but the cubepoints didn't register in the log/get added.

    • 12/30/11 2:02am

      Romel Apuya says:

      ok try this


      <?php

      /*

      Template Name: signing bonus

      */

      ?>

      <div id="content" style="margin-bottom: 20px; width: 640px;">

      <?php

      global $current_user;

      $current_user = wp_get_current_user();

      $user_id = $current_user->ID;

      ?>

      <h3 style="text-align: center;">Click here to score DDG$200 for liking us of Facebook.</h3>

      <p style="text-align: center;">

      <a onclick="window.location='?share=YES'" href="http://facebook.com/dropdeadgorgeousdaily" target="_blank">

      <img class="aligncenter size-full wp-image-140021" title="Like us now for extra DDG$" src="http://dropdeadgorgeousdaily.com/wp-content/uploads/like-us-button.png" alt="Like us now for extra DDG$" width="198" height="64" />

      </a>

      </p>

      <h3 style="text-align: center;">And finally fill out the form below and invite your friends.</h3>

      <h3 style="text-align: center;">Every friend who you invite (who signs up) will score you an extra DDG$200!</h3>

      </div>

      <?php

      if ($share == "YES") {

      $share = "NO";

      if( function_exists('cp_alterPoints') && is_user_logged_in() ){

      cp_alterPoints($user_id, 200);

      cp_log('sharing', $user_id, 200, "admin");

      }

      }

      ?>

      <div class="sidebars">

      <?php echo thesis_sidebars(); ?>

      </div>

    • 12/30/11 3:48am

      kateM82 says:

      Still doesn't add the points. :(

    • 12/30/11 4:55am

      Romel Apuya says:

      yeah Julio is right.

  • avatar
    Last edited:
    12/30/11
    1:36am
    Julio Potier says:

    Hello, try this :

    <?php
    /*
    Template Name: signing bonus
    */
    ?>
    <div id="content" style="margin-bottom: 20px; width: 640px;">
    <?php
    global $current_user;
    get_currentuserinfo();
    $user_id = "$current_user->ID";
    ?>
    <h3 style="text-align: center;">Click here to score DDG$200 for liking us of Facebook.</h3>
    <p style="text-align: center;">
    <a onclick="window.location='?share=YES'" href="http://facebook.com/dropdeadgorgeousdaily" target="_blank">
    <img class="aligncenter size-full wp-image-140021" title="Like us now for extra DDG$" src="http://dropdeadgorgeousdaily.com/wp-content/uploads/like-us-button.png" alt="Like us now for extra DDG$" width="198" height="64" />
    </a>
    </p>
    <h3 style="text-align: center;">And finally fill out the form below and invite your friends.</h3>
    <h3 style="text-align: center;">Every friend who you invite (who signs up) will score you an extra DDG$200!</h3>
    </div>
    <?php
    if ( ($share == "YES") && (get_user_meta( $user_id, '_cp_like_fb', true ) == '') ) {
    $points = 200;
    if( function_exists('cp_alterPoints') && is_user_logged_in() ){
    cp_alterPoints($user_id, $points);
    cp_log('sharing', $user_id, $points, "admin");
    update_user_meta( $user_id, '_cp_like_fb', $points );
    }
    }
    ?>
    <div class="sidebars">
    <?php echo thesis_sidebars(); ?>
    </div>


    i added a get_post_meta and update_post_meta to check and update a meta value for this user.

    See you soon !

    • 12/30/11 1:55am

      kateM82 says:

      This doesn't seem to register the points either.

    • 12/30/11 1:58am

      Julio Potier says:

      Replace this :

      if ( ($share == "YES") && (get_user_meta( $user_id, '_cp_like_fb', true ) == '') ) {


      by this :

      if ( (isset($_GET['share']) && $_GET['share'] == "YES") && (!get_user_meta( $user_id, '_cp_like_fb', true )) ) {


      see you

    • 12/30/11 3:46am

      kateM82 says:

      Now I get this error - Parse error: syntax error, unexpected '{' in /home/ddgd/public_html/wp-content/themes/thesis_18/custom/pages/signupbonus.php on line 44

    • 12/30/11 3:49am

      Julio Potier says:

      if ( isset($_GET['share']) && ($_GET['share'] == "YES") && !get_user_meta( $user_id, '_cp_like_fb', true ) ) {


      ps : you said
      "I don't think you need access to my site for this"
      , i'll tell you "this is why wee need access : avoid wasting time eachother ;)

    • 12/30/11 4:14am

      kateM82 says:

      I understand that, sadly I gave out a login to a stranger once and they loaded a trojan onto my site - another couple crashed it completey, so I am very wary.

      I was hoping it was simple, but guess not.

    • 12/30/11 4:19am

      Julio Potier says:

      Was it on WPQuestions ?
      Because here, on 1876 questions, i never heard that kind of bad behaviour, we are real expert, not script kiddies.
      Also, i'm a Web Security Consultant and i'm 32yo, not a 16yo student hacking website for fun ;)
      You can trust expert from here (as least, those who won some questions and/or top experts)

      So, it's not working yet ?

This question has expired.



Johnny Denver had additional discourse to offer.



Current status of this question: Community pot



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.