當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BP_Activity_Activity::get_child_comments方法代碼示例

本文整理匯總了PHP中BP_Activity_Activity::get_child_comments方法的典型用法代碼示例。如果您正苦於以下問題:PHP BP_Activity_Activity::get_child_comments方法的具體用法?PHP BP_Activity_Activity::get_child_comments怎麽用?PHP BP_Activity_Activity::get_child_comments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BP_Activity_Activity的用法示例。


在下文中一共展示了BP_Activity_Activity::get_child_comments方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: rebuild_activity_comment_tree

 function rebuild_activity_comment_tree($parent_id, $left = 1)
 {
     global $nxtdb, $bp;
     // The right value of this node is the left value + 1
     $right = $left + 1;
     // Get all descendants of this node
     $descendants = BP_Activity_Activity::get_child_comments($parent_id);
     // Loop the descendants and recalculate the left and right values
     foreach ((array) $descendants as $descendant) {
         $right = BP_Activity_Activity::rebuild_activity_comment_tree($descendant->id, $right);
     }
     // We've got the left value, and now that we've processed the children
     // of this node we also know the right value
     if (1 == $left) {
         $nxtdb->query($nxtdb->prepare("UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE id = %d", $left, $right, $parent_id));
     } else {
         $nxtdb->query($nxtdb->prepare("UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE type = 'activity_comment' AND id = %d", $left, $right, $parent_id));
     }
     // Return the right value of this node + 1
     return $right + 1;
 }
開發者ID:nxtclass,項目名稱:NXTClass-Plugin,代碼行數:21,代碼來源:bp-activity-classes.php

示例2: rebuild_activity_comment_tree

 /**
  * Rebuild nested comment tree under an activity or activity comment.
  *
  * @since 1.2.0
  *
  * @global wpdb $wpdb WordPress database object.
  *
  * @param  int $parent_id ID of an activity or activity comment.
  * @param  int $left      Node boundary start for activity or activity comment.
  * @return int Right      Node boundary of activity or activity comment.
  */
 public static function rebuild_activity_comment_tree($parent_id, $left = 1)
 {
     global $wpdb;
     $bp = buddypress();
     // The right value of this node is the left value + 1.
     $right = intval($left + 1);
     // Get all descendants of this node.
     $comments = BP_Activity_Activity::get_child_comments($parent_id);
     $descendants = wp_list_pluck($comments, 'id');
     // Loop the descendants and recalculate the left and right values.
     foreach ((array) $descendants as $descendant_id) {
         $right = BP_Activity_Activity::rebuild_activity_comment_tree($descendant_id, $right);
     }
     // We've got the left value, and now that we've processed the children
     // of this node we also know the right value.
     if (1 === $left) {
         $wpdb->query($wpdb->prepare("UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE id = %d", $left, $right, $parent_id));
     } else {
         $wpdb->query($wpdb->prepare("UPDATE {$bp->activity->table_name} SET mptt_left = %d, mptt_right = %d WHERE type = 'activity_comment' AND id = %d", $left, $right, $parent_id));
     }
     // Return the right value of this node + 1.
     return intval($right + 1);
 }
開發者ID:JeroenNouws,項目名稱:BuddyPress,代碼行數:34,代碼來源:class-bp-activity-activity.php

示例3: bp_activity_delete_children

/**
 * Delete an activity comment's children.
 *
 * @since BuddyPress (1.2.0)
 *
 * @uses BP_Activity_Activity::get_child_comments() {@link BP_Activity_Activity}
 * @uses bp_activity_delete_children()
 * @uses bp_activity_delete()
 *
 * @param int $activity_id The ID of the "root" activity, ie the
 *        comment's oldest ancestor.
 * @param int $comment_id The ID of the comment to be deleted.
 */
function bp_activity_delete_children($activity_id, $comment_id)
{
    // Get activity children to delete
    $children = BP_Activity_Activity::get_child_comments($comment_id);
    // Recursively delete all children of this comment.
    if (!empty($children)) {
        foreach ((array) $children as $child) {
            bp_activity_delete_children($activity_id, $child->id);
        }
    }
    // Delete the comment itself
    bp_activity_delete(array('secondary_item_id' => $comment_id, 'type' => 'activity_comment', 'item_id' => $activity_id));
}
開發者ID:eresyyl,項目名稱:mk,代碼行數:26,代碼來源:bp-activity-functions.php

示例4: bp_activity_delete_children

	function bp_activity_delete_children( $activity_id, $comment_id) {
		/* Recursively delete all children of this comment. */
		if ( $children = BP_Activity_Activity::get_child_comments( $comment_id ) ) {
			foreach( (array)$children as $child )
				bp_activity_delete_children( $activity_id, $child->id );
		}
		bp_activity_delete( array( 'secondary_item_id' => $comment_id, 'type' => 'activity_comment', 'item_id' => $activity_id ) );
	}
開發者ID:n-sane,項目名稱:zaroka,代碼行數:8,代碼來源:bp-activity.php


注:本文中的BP_Activity_Activity::get_child_comments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。