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/
Romel Apuya answers:
Hi KateM82,
I can help you with this.
Can you give me access to the codes
cheers,
romel
kateM82 comments:
Hi Romel,
Which codes are you after?
Romel Apuya comments:
on the wp site that you have.
kateM82 comments:
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.
Romel Apuya comments:
can you post the code of the template you are using?
kateM82 comments:
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>
Romel Apuya comments:
<?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.
kateM82 comments:
Thanks for this, I tried it, but the cubepoints didn't register in the log/get added.
Romel Apuya comments:
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>
kateM82 comments:
Still doesn't add the points. :(
Romel Apuya comments:
yeah Julio is right.
Julio Potier answers:
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 !
kateM82 comments:
This doesn't seem to register the points either.
Julio Potier comments:
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
kateM82 comments:
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
Julio Potier comments:
if ( isset($_GET['share']) && ($_GET['share'] == "YES") && !get_user_meta( $user_id, '_cp_like_fb', true ) ) {
ps : you said <blockquote>"I don't think you need access to my site for this"</blockquote>, i'll tell you "this is why wee need access : avoid wasting time eachother ;)
kateM82 comments:
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.
Julio Potier comments:
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 ?