function bl_frontend_form_submit_check($post)
 {
     if (isset($post['post_id']) && is_numeric($post['post_id']) && $post['post_id'] != 0) {
         $data = get_option("bepro_listings");
         //check if in-sufficient funds
         $uid = get_current_user_id();
         $current_points = cp_getPoints($uid);
         //if insufficient funds then abort listing save altogether
         if ($current_points == 0) {
             header("Location: " . get_bloginfo("url") . "/?p=" . $data["redirect_need_funds"]);
         }
         //update cubepoint records
         $new_points = $current_points - $data["charge_amount"];
         cp_updatePoints($uid, $new_points);
         cp_log("listing", $uid, -$data["charge_amount"], "Listing payment");
     }
 }
function bp_gameful_check_rules()
{
    global $wp, $bp;
    if (preg_match("/^\\/blogging-tips\\/\$/i", $_SERVER['REQUEST_URI'])) {
        cp_log('Read blogging tips', $bp->loggedin_user->id, 1, 'Gameful');
    }
}
Example #3
0
/**
* Function called when a comment has been deleted or marked as SPAM
*
* @param int id Comment id
* @access public
*/
function sk_actionDelete($id)
{
    global $wpdb;
    //Getcomment data
    $table_name = $wpdb->prefix . "schreikasten";
    $sql = "SELECT * FROM {$table_name} WHERE id={$id}";
    $comments = $wpdb->get_results($sql);
    if (count($comments) > 0) {
        foreach ($comments as $comment) {
            if (function_exists('cp_alterPoints') && $comment->user_id >= 0) {
                cp_alterPoints($comment->user_id, -get_option('cp_del_comment_points'));
                cp_log('schreikasten', $comment->user_id, -get_option('cp_del_comment_points'), $comment->id);
            }
        }
    }
}
Example #4
0
/** Set points and add to logs */
function cp_points_set($type, $uid, $points, $data)
{
    $points = apply_filters('cp_points_set', $points, $type, $uid, $data);
    $difference = $points - cp_getPoints($uid);
    cp_updatePoints($uid, $points);
    cp_log($type, $uid, $difference, $data);
}