foreach ($order as $v) { $post = get_post($v['post_id']); $post->menu_order = $v['menu_order']; if ($post_id == $v['post_id']) { $post->post_parent = $parent; } wp_update_post($post); } header('Content-Type: application/json'); echo json_encode(array('success' => true, 'order' => $order)); die; } add_action('wp_ajax_rw_buddypress_docs_tree_change_node', 'rw_buddypress_docs_tree_change_node'); add_filter('bp_docs_parent_dropdown_query_args', function ($array) { include_once 'RW_BuddyPress_Docs_Tree.php'; return RW_BuddyPress_Docs_Tree::bd_get_query_args($array); }); function rw_docs_disable_folder($return) { return false; } //add_filter( 'bp_docs_enable_folders', 'rw_docs_disable_folder' ); /** * save bp-actifity-filter cookie to user metadata */ function activity_widget_filter() { if (get_current_user_id() != 0) { $cookie = $_COOKIE['bp-activity-filter']; update_user_meta(get_current_user_id(), 'bp-activity-filter', $cookie); }
public static function bd_get_query_args($defaults) { global $bp; $qargs = array('posts_per_page' => -1, 'paged' => 0, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'bp_doc', 'post_status' => 'publish', 'suppress_filters' => true); $tree = new RW_BuddyPress_Docs_Tree(); $group_id = $tree->bd_docs_get_current_group_id(); if ($group_id) { $qargs["tax_query"] = array(array("taxonomy" => "bp_docs_associated_item", "field" => "slug", 'terms' => array('bp_docs_associated_group_' . $group_id))); } else { $qargs['author'] = $bp->loggedin_user->id; } return wp_parse_args($qargs, $defaults); }
<?php bp_docs_info_header(); ?> </div> <ul class="docs-tree tree-node"> <?php /** * Created by PhpStorm. * User: Joachim * Date: 12.03.2016 * Time: 10:06 */ include_once get_stylesheet_directory() . '/RW_BuddyPress_Docs_Tree.php'; RW_BuddyPress_Docs_Tree::the_docs_tree('ul', $group_id); ?> </ul> </div> <script> jQuery().ready(function($){ var options = { insertZone:50, insertZonePlus:true, listSelector:'ul', placeholderCss: {'background-color':'#FFC3B7'},