Giter VIP home page Giter VIP logo

zoninator's Issues

Slow queries generated by Zoninator

We have seen slow queries being generated by Zoninator, in particular a query that looks like this:

SELECT wp_posts.ID FROM wp_posts WHERE ?=? AND ( wp_posts.post_date > ?) AND wp_posts.ID NOT IN (?, ?, ?, ?, ?, ?, ?, ?) AND (((wp_posts.post_title LIKE ?) OR (wp_posts.post_excerpt LIKE ?) OR (wp_posts.post_content LIKE ?))) AND wp_posts.post_type = ? AND ((wp_posts.post_status = ? OR wp_posts.post_status = ?)) ORDER BY wp_posts.post_date DESC LIMIT ?, ?

It is in particular the NOT IN part that causes issues, as when data grows in wp_posts, there is more to exclude when processing the query. This can lead the database to overload, causing sites to have performance issues.

Is there any way to rewrite this without the NOT IN?


This issue originated as a VIP Request.

get_supported_post_types() shouldn't fire on init

Because it does, $this->post_types becomes set without potentially additional post types that just happen to be registered after.

It doesn't look like that class variable is ever used, so it would probably be better to remove it altogether.

Also, the taxonomy should be registered with post types on late init to ensure all post types have been registered.

Duplicate WP_Queries in get_zone_posts

I'm trying to perform some actions on each query being executed on a page, using the pre_get_posts action. I'm finding that zoninator loops are executing the query twice for each loop when I use z_get_posts_in_zone to get a list of arrays.

The first one is in zoninator.php on line 1012. get_zone_posts() runs get_zone_query() which returns a new WP_Query back to get_zone_posts. https://github.com/Automattic/zoninator/blob/master/zoninator.php#L1056

The second is when get_posts is called on that query on line 1013 here. get_posts() also also creates a new WP_Query as you can see here.

I couldn't find anything to support this being the desired effect, and I can't think of a scenario in this case where running 2 queries would be needed.

Create zones for PHPUnit testing.

Hi,

Is it possible to create a test zone for unit testing?

I have a situation where my right rail template will load only if there is a zone that populates the videos in that right rail. Now, my unit test fails because the right rail is never generated in my test post.

I looked up your code. All the setter methods are private, which makes it really hard to create any test data.

Any thoughts ?

Thanks

Add method/API function to add a post type to zoninator

Currently the code to add support to a post_type to Zoninator seems to be as follows:

add_post_type_support( 'video', $GLOBALS[ 'zoninator' ]->zone_taxonomy );
register_taxonomy_for_object_type( $GLOBALS[ 'zoninator' ]->zone_taxonomy, 'video' );

// Clear Zoninator supported post types cache
unset( $GLOBALS[ 'zoninator' ]->post_types );

Would be good to have a simpler API method or function.

Related: #2

Creating a more friendly way of unlocking zones

Currently when the zone lock times out the user is forced back to the tab/window where they were locked into a zone.

This is pretty bad UX and it would be nicer if it just silently took them out of the zone.

Reporting in Chrome (latest version) on Windows/Mac

get_zone_query() function not working on 5.7

It doesn't display posts for a zone, on the backend below is an error in the query generated by get_zone_query() method:

WordPress database error Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'wordpress.wp_postmeta.meta_value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by for query SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( \n wp_postmeta.meta_key = '_zoninator_order_4942'\n) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 ASC made by WP_Query::get_posts, referer: http://localhost/wordpress/wp-admin/admin.php?page=zoninator

Further, executed the select query directly on mysql, got the following response:

Error Code: 1055. Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'wordpress.wp_postmeta.meta_value' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Checked mysql documentation and got the following from there:

https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

Please check the issue.

Thanks.

WordPress 4.4 broke the nav

WordPress 4.4 broke the CSS for the left nav. It reverted to the old tab design in a jumbled list. Will be working on a fix for this later today.

Deprecation notice in widget in PHP 7.0

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; Zoninator_ZonePosts_Widget has a deprecated constructor in /tmp/wordpress/src/wp-content/plugins/zoninator/widget.zone-posts.php on line 6

Enhanced widget

For users who don't have access to modifying their PHP, it would be nice to include an enhanced widget where they can set the layout with template tags and basic HTML.

Example:

<div class="post-thumbnail">%thumbnail%</div>
<h4>%title%</h4>
<p>%excerpt%</p>

Or something similar where you can pass parameters.

Drag and Drop on Mobile Issue

It looks like the drag-and-drop is not working on mobile devices. If you touch one of the stories in the zones to change the rank, it will scroll all the way to the bottom making it impossible to move the stories up or around. This was reproduced on iPhone6/iPhone6+ in Safari/Chrome. However, this does work properly on iPad.

WordPress 4.2 Term Splitting

Zoninator needs to be patched to deal with potential term splitting issues as of 4.2.

The main issue is that posts are related to zones via meta key, and that meta key is a reference to the zone's term ID. If a zone were to be updated (not its posts, but the zone itself), and that zone were a shared term, it would be split and the post relationships would be broken.

Zone Feeds

Automatically create feeds for each zone that return a zone's posts: /zones/my-zone-slug/feed/

Suggested by John Cionci.

Versioning in Wpackagist

Hello,

We noticed that the versioning of your plugin is off at https://wpackagist.org/search?q=zoninator

It's not picking up the 0.7 release and it is still pulling the 0.6 version with the deprecated constructor name in Zoninator_ZonePosts_Widget.

Is there any way you can push the release to https://wpackagist.org? Do you have any plans to add the plugin to https://packagist.org/?

Thank you in advance!

Zone Shortcode

Would like to see a Zone Manager shortcode with the ability to add loops to pages.
For example:

[zonemanager zone="developingnews" showposts="1"]

Convert existing AJAX endpoints into WP API

As of 4.4, WordPress includes WP API infrastructure and provides a framework for creating custom REST endpoints. It is suggested that plugin authors convert their custom AJAX based APIs to use WP API.

The goal is to convert zoninator's existing AJAX endpoints into WP API, along with all the JavaScript client-side changes required.

UI Improvements

The current UI for managing zones was inspired by the Menus UI. Sadly, this doesn't "scale" when you have lots and lots of zones.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.