madfarmer
Forum Replies Created
-
Forum: Plugins
In reply to: [Google App Engine for WordPress] Gives me blank screen in productionYea it does work now. But i actually can’t remember what it was. The bucket name should be without gcs:// . so that a bucket gcs://funnyname/ should go into the settings in wordpress as funnyname .
I was also missing some packages and settings in my php.ini here is my php.ini
google_app_engine.enable_functions = “php_sapi_name, gc_enabled, phpversion, phpinfo, parse_str, “
upload_max_filesize = “10M”
post_max_size = “20M”Also, try and flush the memcache on the server.
Forum: Plugins
In reply to: [Members - Membership & User Role Editor Plugin] Members and bbPressSomething is wrong with your site. I cant comment.. But the location of the topics query is here
\wp-content\plugins\bbpress\includes\topics\template-tags.php:
bbp_has_topics. I have already begun this but with very mediocre results, i cant control ordering somehow and it shows stickies regardles of choice.. I had to make a custom function to not interfeer with normal behavior.
function tehnik_bpp_get_permitted_topics($topic_list) { if(function_exists('members_can_user_view_post')) { $filtered_topics = array(); //Get Current User ID $user_id = wp_get_current_user()->ID; foreach ($topic_list as $topic) { $topic_id = $topic->ID; $forum_id = bbp_get_topic_forum_id($topic_id); if(members_can_user_view_post($user_id, $forum_id)) { array_push($filtered_topics, $topic_id); } } return (array) $filtered_topics; } return true; } function tehnik_bpp_get_permitted_topic_ids($topic_query) { //Check if Members plugin function exists. No need to reinvent the wheel..use what is available if (!function_exists('members_can_user_view_post')) return array(); //Get Current User ID $user_id = wp_get_current_user()->ID; //Init the Array which will hold our list of allowed forums $allowed_topics = array(); //Loop through all the forums while ( $topic_query->have_posts() ) : $topic_query->the_post(); //Get the Forum/Post ID $topic_id = $topic_query->post->ID; $forum_id = bbp_get_topic_forum_id($topic_id); //Check if User has permissions to view this Post ID if(members_can_user_view_post($user_id, $forum_id)) { //User can view this post (forum) - add it to the allowed forums array array_push($allowed_topics, $topic_id); } endwhile; //Return the list return $allowed_topics; } /** * This function filters the list of forums based on the users rank as set by the Mebmers plugin */ function bbp_has_topics_custom( $args = '' ){ global $wp_rewrite; /** Defaults **************************************************************/ // Other defaults $default_topic_search = !empty( $_REQUEST['ts'] ) ? $_REQUEST['ts'] : false; $default_show_stickies = false; $default_post_parent = 'any'; // Default argument array $meta_query = array( 'post_type' => bbp_get_topic_post_type(), // Narrow query down to bbPress topics 'post_parent' => $default_post_parent, // Forum ID 's' => $default_topic_search, // Topic Search 'show_stickies' => false, // Ignore sticky topics? 'max_num_pages' => false, // Maximum number of pages to show ); //Get an array of IDs which the current user has permissions to view $allowed_topics = tehnik_bpp_get_permitted_topic_ids(new WP_Query($meta_query)); // Default argument array $default = array( 'post_type' => bbp_get_topic_post_type(), // Narrow query down to bbPress topics 'post_parent' => $default_post_parent, // Forum ID 'meta_key' => '_bbp_last_active_time', // Make sure topic has some last activity time 'orderby' => 'meta_value', // 'meta_value', 'author', 'date', 'title', 'modified', 'parent', rand', 'order' => 'ASC', // 'ASC', 'DESC' 'posts_per_page' => bbp_get_topics_per_page(), // Topics per page 'paged' => bbp_get_paged(), // Page Number 's' => $default_topic_search, // Topic Search 'show_stickies' => false, // Ignore sticky topics? 'max_num_pages' => false, // Maximum number of pages to show 'post__in' => $allowed_topics ); // What are the default allowed statuses (based on user caps) if ( bbp_get_view_all() ) { // Default view=all statuses $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id() ); // Add support for private status if ( current_user_can( 'read_private_topics' ) ) { $post_statuses[] = bbp_get_private_status_id(); } // Join post statuses together $default['post_status'] = join( ',', $post_statuses ); // Lean on the 'perm' query var value of 'readable' to provide statuses } else { $default['perm'] = 'readable'; } // Maybe query for topic tags if ( bbp_is_topic_tag() ) { $default['term'] = bbp_get_topic_tag_slug(); $default['taxonomy'] = bbp_get_topic_tag_tax_id(); } /** Setup *****************************************************************/ // Parse arguments against default values $r = bbp_parse_args( $args, $default, 'has_topics' ); // Get bbPress $bbp = bbpress(); // Call the query $bbp->topic_query = new WP_Query( $r ); // Set post_parent back to 0 if originally set to 'any' if ( 'any' == $r['post_parent'] ) $r['post_parent'] = 0; // Limited the number of pages shown if ( !empty( $r['max_num_pages'] ) ) $bbp->topic_query->max_num_pages = $r['max_num_pages']; // If no limit to posts per page, set it to the current post_count if ( -1 == $r['posts_per_page'] ) $r['posts_per_page'] = $bbp->topic_query->post_count; // Add pagination values to query object $bbp->topic_query->posts_per_page = $r['posts_per_page']; $bbp->topic_query->paged = $r['paged']; // Only add pagination if query returned results if ( ( (int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts ) && (int) $bbp->topic_query->posts_per_page ) { // Limit the number of topics shown based on maximum allowed pages if ( ( !empty( $r['max_num_pages'] ) ) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count ) $bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count; // If pretty permalinks are enabled, make our pagination pretty if ( $wp_rewrite->using_permalinks() ) { // User's topics if ( bbp_is_single_user_topics() ) { $base = bbp_get_user_topics_created_url( bbp_get_displayed_user_id() ); // User's favorites } elseif ( bbp_is_favorites() ) { $base = bbp_get_favorites_permalink( bbp_get_displayed_user_id() ); // User's subscriptions } elseif ( bbp_is_subscriptions() ) { $base = bbp_get_subscriptions_permalink( bbp_get_displayed_user_id() ); // Root profile page } elseif ( bbp_is_single_user() ) { $base = bbp_get_user_profile_url( bbp_get_displayed_user_id() ); // View } elseif ( bbp_is_single_view() ) { $base = bbp_get_view_url(); // Topic tag } elseif ( bbp_is_topic_tag() ) { $base = bbp_get_topic_tag_link(); // Page or single post } elseif ( is_page() || is_single() ) { $base = get_permalink(); // Topic archive } elseif ( bbp_is_topic_archive() ) { $base = bbp_get_topics_url(); // Default } else { $base = get_permalink( (int) $r['post_parent'] ); } // Use pagination base $base = trailingslashit( $base ) . user_trailingslashit( $wp_rewrite->pagination_base . '/%#%/' ); // Unpretty pagination } else { $base = add_query_arg( 'paged', '%#%' ); } // Pagination settings with filter $bbp_topic_pagination = apply_filters( 'bbp_topic_pagination', array ( 'base' => $base, 'format' => '', 'total' => $r['posts_per_page'] == $bbp->topic_query->found_posts ? 1 : ceil( (int) $bbp->topic_query->found_posts / (int) $r['posts_per_page'] ), 'current' => (int) $bbp->topic_query->paged, 'prev_text' => is_rtl() ? '→' : '←', 'next_text' => is_rtl() ? '←' : '→', 'mid_size' => 1 ) ); // Add pagination to query object $bbp->topic_query->pagination_links = paginate_links( $bbp_topic_pagination ); // Remove first page from pagination $bbp->topic_query->pagination_links = str_replace( $wp_rewrite->pagination_base . "/1/'", "'", $bbp->topic_query->pagination_links ); } // Return object return apply_filters( 'tehnik_bpp_filter_topics_by_permissions', $bbp->topic_query->have_posts(), $bbp->topic_query ); } //add_filter('bbp_has_topics', 'tehnik_bpp_filter_topics_by_permissions', 10, 2 );
Forum: Plugins
In reply to: [Members - Membership & User Role Editor Plugin] Members and bbPressDid you get to fixing the topics ?
Forum: Plugins
In reply to: [Members - Membership & User Role Editor Plugin] Members and bbPressThis is GREAT ! Spend like 8 hours implementing this myself, just didnt wrap it into a plugin. Could you maybe add filtering on topics as well, so that the topic widgets and bbp_has_topics works as well ?