function bplike_activity_comment_button() { $liked_count = 0; if (is_user_logged_in()) { if (bp_activity_get_meta(bp_get_activity_comment_id(), 'liked_count', true)) { $users_who_like = array_keys(bp_activity_get_meta(bp_get_activity_comment_id(), 'liked_count', true)); $liked_count = count($users_who_like); } if (!bp_like_is_liked(bp_get_activity_comment_id(), 'activity_comment', get_current_user_id())) { ?> <a href="#" class="acomment-reply bp-primary-action like" id="like-activity-<?php echo bp_get_activity_comment_id(); ?> " title="<?php echo bp_like_get_text('like_this_item'); ?> "><?php echo bp_like_get_text('like'); if ($liked_count) { echo ' <span><small>' . $liked_count . '</small></span>'; } ?> </a> <?php } else { ?> <a href="#" class="acomment-reply bp-primary-action unlike" id="unlike-activity-<?php echo bp_get_activity_comment_id(); ?> " title="<?php echo bp_like_get_text('unlike_this_item'); ?> "><?php echo bp_like_get_text('unlike'); if ($liked_count) { echo ' <span><small>' . $liked_count . '</small></span>'; } ?> </a> <?php } } }
"><?php _e('Comment', 'buddypress'); ?> </a> <?php $likes = cjtheme_activity_comment_likes(bp_get_activity_comment_id()); ?> <?php $user_like = cjtheme_activity_comment_user_like(bp_get_activity_comment_id()); ?> <?php $thanks = cjtheme_activity_comment_thanks(bp_get_activity_comment_id()); ?> <?php $user_thank = cjtheme_activity_comment_user_thank(bp_get_activity_comment_id()); ?> <a href="#" class="acomment-reply like-comment" id="like-<?php bp_activity_comment_id(); ?> " data-comment-id="<?php bp_activity_comment_id(); ?> " data-user-id="<?php echo $current_user->ID; ?> "><?php echo $user_like; echo $likes > 0 ? ' ' . $likes : ''; ?> </a>
/** * Adds a "mark as spam" button to each activity COMMENT item for site admins. * * This function is intended to be used inside the activity stream loop. * * @since BuddyPress (1.6) */ public function add_activity_comment_spam_button() { if (!bp_activity_user_can_mark_spam()) { return; } // By default, only handle activity updates and activity comments. $current_comment = bp_activity_current_comment(); if (empty($current_comment) || !in_array($current_comment->type, BP_Akismet::get_activity_types())) { return; } bp_button(array('block_self' => false, 'component' => 'activity', 'id' => 'activity_make_spam_' . bp_get_activity_comment_id(), 'link_class' => 'bp-secondary-action spam-activity-comment confirm', 'link_href' => wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_slug() . '/spam/' . bp_get_activity_comment_id() . '/?cid=' . bp_get_activity_comment_id(), 'bp_activity_akismet_spam_' . bp_get_activity_comment_id()), 'link_text' => __('Spam', 'buddypress'), 'wrapper' => false)); }
/** * Gets the 'delete' URL for the activity comment currently being displayed * * @since 1.5.0 * * @global object $bp BuddyPress global settings * @uses nxt_nonce_url() * @uses bp_get_root_domain() * @uses bp_get_activity_slug() * @uses bp_get_activity_comment_id() * @uses apply_filters() To call the 'bp_activity_comment_delete_link' hook * * @return string $link The nonced URL for deleting the current activity comment */ function bp_get_activity_comment_delete_link() { global $bp; $link = nxt_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link'); return apply_filters('bp_activity_comment_delete_link', $link); }
function activity_comments_print_link() { $link = bpModFrontend::get_link(array('type' => 'activity_comment', 'author_id' => bp_get_activity_comment_user_id(), 'id' => bp_get_activity_comment_id(), 'id2' => bp_get_activity_id(), 'custom_class' => 'bpm-no-images bp-secondary-action')); echo $link; }
/** * Gets the 'delete' URL for the activity comment currently being displayed * * @since BuddyPress (1.5.0) * * @uses wp_nonce_url() * @uses bp_get_root_domain() * @uses bp_get_activity_slug() * @uses bp_get_activity_comment_id() * @uses apply_filters() To call the 'bp_activity_comment_delete_link' hook. * * @return string $link The nonced URL for deleting the current * activity comment. */ function bp_get_activity_comment_delete_link() { $link = wp_nonce_url(bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link'); /** * Filters the link used for deleting the activity comment currently being displayed. * * @since BuddyPress (1.5.0) * * @param string $link Link to use for deleting the currently displayed activity comment. */ return apply_filters('bp_activity_comment_delete_link', $link); }
/** * wp_ulike_buddypress function for activities like/unlike display * * @author Alimir * @since 1.7 * @updated 2.3 * @updated 2.4 * @return String */ function wp_ulike_buddypress($arg) { //global variables global $wp_ulike_class, $wp_user_IP; if (bp_get_activity_comment_id() != null) { $activityID = bp_get_activity_comment_id(); } else { $activityID = bp_get_activity_id(); } $bp_get_meta = bp_activity_get_meta($activityID, '_activityliked'); $get_like = $bp_get_meta != '' ? $bp_get_meta : 0; $return_userID = $wp_ulike_class->get_reutrn_id(); $theme_class = wp_ulike_get_setting('wp_ulike_buddypress', 'theme'); if (wp_ulike_get_setting('wp_ulike_buddypress', 'auto_display_position') == 'meta') { $html_tag = 'span'; } else { $html_tag = 'div'; } if (wp_ulike_get_setting('wp_ulike_buddypress', 'only_registered_users') != '1' or wp_ulike_get_setting('wp_ulike_buddypress', 'only_registered_users') == '1' && is_user_logged_in()) { $data = array("id" => $activityID, "user_id" => $return_userID, "user_ip" => $wp_user_IP, "get_like" => $get_like, "method" => 'likeThisActivity', "setting" => 'wp_ulike_buddypress', "type" => 'post', "table" => 'ulike_activities', "column" => 'activity_id', "key" => '_activityliked', "cookie" => 'activity-liked-'); //call wp_get_ulike function from class-ulike calss $counter = $wp_ulike_class->wp_get_ulike($data); $counter = str_replace('<span class="count-box">0</span>', '<span class="count-box" style="display: none">0</span>', $counter); $wp_ulike = '<' . $html_tag . ' id="wp-ulike-activity-' . $activityID . '" class="wpulike ' . $theme_class . '">'; $wp_ulike .= '<' . $html_tag . ' class="counter">' . $counter . '</' . $html_tag . '>'; $wp_ulike .= '</' . $html_tag . '>'; $wp_ulike .= $wp_ulike_class->get_liked_users($activityID, 'ulike_activities', 'activity_id', 'wp_ulike_buddypress'); if ($arg == 'put') { return $wp_ulike; } else { echo $wp_ulike; } } else { if (wp_ulike_get_setting('wp_ulike_buddypress', 'only_registered_users') == '1' && !is_user_logged_in()) { $login_type = wp_ulike_get_setting('wp_ulike_general', 'login_type'); if ($login_type == "button") { $template = $wp_ulike_class->get_template($activityID, 'likeThisActivity', $get_like, 1, 0); if (wp_ulike_get_setting('wp_ulike_general', 'button_type') == 'image') { return '<' . $html_tag . ' id="wp-ulike-activity-' . $activityID . '" class="wpulike ' . $theme_class . '"><' . $html_tag . ' class="counter">' . $template['login_img'] . '</' . $html_tag . '></' . $html_tag . '>'; } else { return '<' . $html_tag . ' id="wp-ulike-activity-' . $activityID . '" class="wpulike ' . $theme_class . '"><' . $html_tag . ' class="counter">' . $template['login_text'] . '</' . $html_tag . '></' . $html_tag . '>'; } } else { return '<p class="alert alert-info fade in" role="alert"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>' . __('You need to login in order to like this activity: ', WP_ULIKE_SLUG) . '<a href="' . wp_login_url(get_permalink()) . '"> ' . __('click here', WP_ULIKE_SLUG) . ' </a></p>'; } } } //end only_registered_users condition }
/** * Gets the 'delete' URL for the activity comment currently being displayed. * * @since 1.5.0 * * * @return string $link The nonced URL for deleting the current * activity comment. */ function bp_get_activity_comment_delete_link() { $link = wp_nonce_url(bp_get_activity_directory_permalink() . 'delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link'); /** * Filters the link used for deleting the activity comment currently being displayed. * * @since 1.5.0 * * @param string $link Link to use for deleting the currently displayed activity comment. */ return apply_filters('bp_activity_comment_delete_link', $link); }
function bplike_activity_button() { // Debugging. // echo bp_get_activity_type(); $liked_count = 0; $bp_like_comment_id = bp_get_activity_comment_id(); if (empty($bp_like_comment_id)) { $bp_like_id = bp_get_activity_id(); $bp_like_view = 'button view-likes'; if (bp_like_is_liked($bp_like_id, 'activity')) { $bp_like_css = 'button unlike'; } else { $bp_like_css = 'button like'; } } else { $bp_like_id = bp_get_activity_comment_id(); $bp_like_view = 'acomment-reply bp-primary-action view-likes'; if (bp_like_is_liked($bp_like_id, 'activity')) { $bp_like_css = 'acomment-reply bp-primary-action unlike'; } else { $bp_like_css = 'acomment-reply bp-primary-action like'; } } // Debugging. //print_r( bp_activity_get_meta( $bp_like_id , 'liked_count' , true )); $activity = bp_activity_get_specific(array('activity_ids' => $bp_like_id)); $activity_type = $activity['activities'][0]->type; // Debugging. //print_r($activity); if ($activity_type === null) { $activity_type = 'activity_update'; } if (is_user_logged_in() && $activity_type !== 'activity_liked') { if (bp_activity_get_meta($bp_like_id, 'liked_count', true)) { $users_who_like = array_keys(bp_activity_get_meta($bp_like_id, 'liked_count', true)); $liked_count = count($users_who_like); } if (!bp_like_is_liked($bp_like_id, 'activity')) { ?> <a href="#" class="<?php echo $bp_like_css; ?> " id="like-activity-<?php echo $bp_like_id; ?> " title="<?php echo bp_like_get_text('like_this_item'); ?> "><?php echo bp_like_get_text('like'); if ($liked_count) { echo ' (' . $liked_count . ')'; } ?> </a> <?php } else { ?> <a href="#" class="<?php echo $bp_like_css; ?> " id="unlike-activity-<?php echo $bp_like_id; ?> " title="<?php echo bp_like_get_text('unlike_this_item'); ?> "><?php echo bp_like_get_text('unlike'); if ($liked_count) { echo ' (' . $liked_count . ')'; } ?> </a> <?php } // Checking if there are users who like item. if (isset($users_who_like)) { view_who_likes(); } } }