How would I go about creating a custom achievement?
As on my site I have built a function that allows users to accept comments as accepted answers to questions (these are posts). So for example if someone successfully had there comment chosen then they would unlock an achievement for how many times they did it etc.
This is what the function looks like:
// Add accepted value of true to the comment
add_comment_meta( $wp_comment_id, ‘accepted’, true );
$favor_email = get_comment_author_email($wp_comment_id);
$favor_message = ‘Your favor has been accepted’;
// send email to comment author
wp_mail($favor_email, ‘Favorr.me – Your favor has been accepted!’, $favor_message);
// Close the post from further comments
$current_post = array(‘comment_status’ => ‘closed’);
$updated_post = wp_update_post( $current_post );
if(isset($_GET) && !empty($_GET))
So the idea is when I run this function it closes the post and adds some special meta data to the comment that was accepted by passing in the comment id. So what I need to do is have the achievements plugin give points based on how many of these comments a user has had accepted.
Can anyone help? Thanks
- The topic ‘Custom achievement’ is closed to new replies.