Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Post hook */
- add_action('publish_post', 'cp_newPost');
- function cp_newPost($pid) {
- global $blog_id;
- $post = get_post($pid);
- $uid = $post->post_author;
- global $wpdb;
- $count = (int) $wpdb->get_var("select count(id) from `".CP_DB."` where `type`='post' and `data`=". $pid);
- if($count==0){
- $pid = array( "post_id" => $pid, "blog_id" => $blog_id );
- cp_points('post', $uid, apply_filters('cp_post_points',get_option('cp_post_points')), $pid);
- }
- }
- /** Post logs hook */
- add_action('cp_logs_description','cp_admin_logs_desc_post', 10, 4);
- function cp_admin_logs_desc_post($type,$uid,$points,$data){
- if($type!='post') { return; }
- global $wpdb;
- $wpdb->get_var( "SELECT count(id) FROM ".CP_DB." WHERE type='post' AND data = '" . $data ."'" );
- $blog_id = $wpdb->get_var( "SELECT blog_id FROM ".CP_DB." WHERE type = 'post' AND uid = " . $uid . " AND data = '" . $data . "'" );
- if( $blog_id == 0 ) {
- $post = get_post($data);
- echo __('Created a Post', 'cp'). ' "<a href="'.get_permalink( $post ).'">' . $post->post_title . '</a>"';
- } else {
- $post = get_blog_post( $blog_id, $data );
- echo __('Post on', 'cp') . ' "<a href="'.$post->guid.'">' . $post->post_title . '</a>"';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement