Fixing SSL on sites using iThemes Security

In a Facebook group, we had a question this week, which was a bit tricky to solve. The member had migrated the site to HTTPS. After the migration, some images were not loading anymore. First we asked, if the search and replace on the database was done, so the paths were updated. This was done, but still some images were not loading.

Wrong domain for SSL certifitcate

So I checked the website as a visitor and inspected the certificate. It was issued for the .com TLD but some files were served from a .de TLD, which was a bit strange. My first guess was a theme with static paths to the domain. So I asked to send me the functions.php and header.php file from the theme to check them. Nothing static there.

Read more →

Fixing broken plugin translation in WPML

This week in a project, I had the issue, that for plugin was not loaded in the correct language. The project war multilingual with three languages. The default language was German, one of the other two languages was English. Usually when you experience broken translations, all texts are shown in English only. But not this time. The strings from the plugin were always translated to German, the default language, even on the English site.

The project was using WPML to translate the website into two other languages. For all other plugins, the theme and the content, the translation was working as expected. Just not for this one plugin. Finding the issue was not easy, but once found, the fix was rather easy.

The problematic code

Two years ago at WordCamp Berlin 2015, I gave a talk on how to initialitze a plugin correctly. I had a similar issue with missing translation. But in this case, it was always showing the English original strings.

<?php
/**
 * Plugin Name: Broken Plugin
 */
    
// Load translation files.
load_plugin_textdomain( 'broken-plugin', false, 'broken-plugin/languages' );
    
// Initialize plugin.
add_action( 'after_setup_theme', 'broken_plugin_theme_setup', 12 );
    
function broken_plugin_theme_setup() {
	// Some code ...
}
&#91;/php&#93;

I don't want to blame the plugin author for the small issue, so I anonymized the name. But above you can see the code, how it looked like in the plugin. As you can see in this short snippet, the language file is loaded right at beginnig of the plugin file. The plugin has a callback function registered to the <code>after_setup_theme</code> hook, which would be the perfect place to load the translation.
<h2>The reason it is broken</h2>
But why is the translation not working? As I told you, the translation files must must be loaded, otherwise the strings would not be in the default language German, but in English. The reason for that is quite simple. The plugin name started with the letter B (not only my anonymized example, but also the real one) and as plugins are usually loaded in an alphabetic order and the folder name of WPML is "sitepress-multilingual-cms", the plugin and it's code just came too early. The switch to the correct language was only done after WPML was fully loaded. But at this time, the translated strings of the broken plugin were already in the translations array (with the German string) and not overwritten with the correct language.
<h2>Fixing the plugin</h2>
So fixing the plugin would be easy, right? I just have to move the function call of `load_plugin_textdomain` into the callback function. That would work. But what would happen on the next update? Correct! The translation would be broken again.

So how to do it better? The best way to fix it, would be a bug report to the plugin author. This is what I did. I found the plugin on GitHub, fixed the bug on a fork and opened a pull request. But the plugin has some pending PRs and no new release for over two years. So I didn't expected my fix to be released any time soon. So we can now fix it in the plugin ourselves? We could, but there is another way. Why not fixing the plugin from the outwise. Doing this is pretty easy.

Many developers know the function <code>load_plugin_textdomain</code>, but as fix many functions named like this, there is usually a reverse function. In this case <code>unload_plugin_textdomain</code> which we could use:

[php gutter="false"]
function broken_plugin_trail_wpml_fix() {
	unload_textdomain( 'broken-plugin' );
	load_plugin_textdomain( 'broken-plugin', false, 'broken-plugin/languages' );
}
add_action( 'after_setup_theme', 'broken_plugin_trail_wpml_fix', 13 );

So within another callback function to the hook after_setup_theme we just first unload the translation and then load the file again using the exact same call. We use priority higher than the one in the plugin, wo even if the fix is being merged and we don’t recognize it right away, our fix will still work.

This code can be dropped in a small plugin (or temporarily in the functions.php file of the theme) and once the original plugin is fixed, we can remove it.

Conclusion

As you can see from the easy example, you can sometime fix issues in a plugin without changing it’s code, so on a plugin update, the fix will still work. I would still highly recommend, that you always try to provide a fix for the issue to the plugin author first. Some of them are really quick with releasing a patched version of the plugin, so you don’t have to find a way aroud. And even more important: this way you not only fix the issue for your site, but for all the other users who experince that issue.

A successful eighth year comes to an end

On June 21st, my blog had it’s 8th birthday. I had it bilinugal quite from the start but in the first few years I haven’t translated all of the blog posts. But starting this year, I wrote almost all of tmy blog posts in English first, followed by the German translation a week later. The anually “birthday blog post”, I wrote in German first though. But now here it comes also in English. A bit belated birthday celebrations.

As always (what you migh not yet know), I start with some statistics. I want to present you the Top 3 blog posts of the last year. In my German yearly review I also have the Top 3 since the start of my blog, but as they are the same for my English blost posts, I recude them to one Top 3 list:

Top 3 blog posts

  1. Free Cisco VPN Client alternative for Windows 7 x64 (64 bit)
  2. Shortcut of the month: CTRL + ALT + J (eclipse)
  3. Form preview with jQuery Thickbox

Those are some pretty only blog posts 🙂 The one on place 4 was my 5th overall, written on August 20th, 2009. In total, my blog has 55 blog posts in English (including this one), 27 written only this year and 264 blog posts in German published. So on my English blog, I am “slightly” getting a better number after 8 years. But it’s still a lot less. That’s mybe why the top 3 are so old.

I also posts some stats about the visitors of my blogs every year. The most active day was December 22nd, 2016 with 662 page views. There were also 188 new comments in the past year, 71 written by myself.

What’s next?

I hope it’s going on just the way it has in the last 27 weeks of the year 🙂 I’ll try to write a blog post until the end of each week. I might even try to write an advent calender for the third year in a row. This year maybe even in German AND English. But let’s see how that will work out 🙂

I am also thinking about working on the theme a bit. I might just improve it a bit or even switch to a new theme. But that would probably require me to reproduce all the perfectly scaled screenshots, which I would rather avoid. So stay tuned 🙂

I’ve always ended my birthday blog posts with a little video. They were usually funny, but for this year, I couldn’t decide on a funny one. Than I thaught I’ll just pick a video form WordCamp Europe some weeks ago, but there were so many good talks, that I couldn’t choose a single one. So instead I want to end this blog post with a more serious one, which has an important topic. I hope you’ll like it, even though the message might not be easy to digest. So sorry if you hoped for a funny one.

Click here to display content from YouTube.
Learn more in YouTube’s privacy policy.

WordCamp Europe 2017 – Learn. Connect. Contribute.

Yes, I know. This is yet another WordCamp review blog post. But I promise, in the next two month, there will be “regular” posts 🙂 So I am currently sitting in the plane back to Berlin – time to write down the review, while emotions are still fresh. In short: it was amazing!

Enjoying Paris

I arrived in Paris on Monday. Usually I don’t stay too many extra days around WordCamp, but as I really love Paris, I had to spend a full week here. Unfortunately my colleague who wanted to join me to explore the city couldn’t make it. But I found other members from the German and international community I could show some of my favorite spots in Paris and some of the typical touristic places, anyone have to see.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

I’m not only a fan of the city but also of the French Cuisine. You can’t be in France without having wine, baguette and cheese. I received some good critics on my choices of cheese 🙂

Tuesday and Wednesday: Community Summit

Before the WordCamp Europe, about 150 members of the international WordPress community met for the Community Summit. I was not nominated/invited and as the topics discussed were not twittered or blogged about, I can’t give you details on the outcome. But I heared from many attendees, that some important topics were discussed and some decisions made.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

Thursday: Contributor Day

Most WordCamps I visited lately had the Contributor Day before the WordCamp. For WordCamp Europe it was the first time, but I think it went pretty well. I joined the Meta team and worked on some last minute optimizations for our new default WordCamp theme CampSite 2017. Having the leads of the meta team around helped a lot to get patches discussed and merged very fast. We even found some new things we could improve and I wrote a small blog post to ask the community for feedback. Overall it was one of the most productive Contributor Days for me.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

Speakers Dinner

Being part of the organizing team of WordCamp Europe 2017 I was invited to the dinner for speakers, sponsors, organizers and volunteers. We met on a boat on the river Seine and had some nice talks over good food. Luckily the weather in Paris was really good the whole week. Just a bit warm 🙂

Friday: The first conference day

In the opening remarks, Paolo Belcastro (global lead of the WordCamp) told the audience, that the WordCamp Europe originally was only planed as a one time event back in 2013 in Leiden. But it turned out to be one of the most successful WordCamps and is here to stay. Jenny Beaumont (team lead of the local team) welcomed around 1900 attendees to the fifth edition of this amazing event. OK, not all of them get up that early to attend the opening remark at 9:15 in the morning 🙂

Big Litte Shame: a Tale of Empowered User Experience Through Localization

Even though I was in the organizing team, I could attend sessions, as the design team had done all the work before the actual event 🙂

My first session was from Caspar Hübinger. He talked about a very important topic: “gender-sensitive language“. I had the pleasure to see this talk at WordCamp Torino but for his talk at WordCamp Europe he researched even more and improved his very good talk with some new details. I would highly recommend to see his talk on WordPress.tv when it’s online.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

The three kinds of design

After Caspar’s talk I stayed in track 1 to follow the presentation from John Maeda. He is an inspiring speaker and talked about design and it’s importance. Even though I am not a designer, I learned a lot from this talk on how design can be a key factor for any successful product.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

Security is a Process

The next talk was a bit more technical. Mark Jaquith gave a small introduction on how to secure a website and which things you have to keep in mind. He didn’t digged too deeply into the implementation details but showed some important concepts to make WordPress core, plugins and themes more secure.

Lightning Talks – Contributing to WordPress

After lunch, there was a first round of lightning talks. The first talk by Jenny Wong was about how she and her organization team made the last two WordCamp London events the most accessible. Pascal Birchler then spoke about how he started a project to translate WordPress into Romansh, one of the four official languages of Switzerland – and he even doesn’t speak the language himself 🙂 Rahul Bansal followed with a talk on how they help new translation contributors being active over time. The last talk was from Alice Still about the WordUp Brighton (the local WordPress meetup in Brighton) and how they developed a good local community and reaching out to new attendees.

WordPress Security for All: You Won’t Believe How Simple It Can Be

I missed a bit of the next talk from Miriam Schwab about WordPress security, but she gave a good introduction on the most important parts. As you might know, I have my own view on some of the typical advices about security, but Miriam seems to have some similar views on them.

Is Your Code Ready for PHP7?

The next talk was again rather technical. Julka Grodel spoke about the changes in PHP7 and how you can make you code ready for PHP7 while making it also run on PHP5. I learned some new edge cases I didn’t knew before and some issues I experienced myself in the past weeks.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

New to Theme Design? Here’s What You Should Know

The last talk of the day for me was from Dmitry Mayorov about Theme Design. He shared his experiences he made while developing themes. He argumented for themes that are small and specific to a special need, rather than implementing yet another “multi purpose theme” that will not really fit for anything 🙂

Saturday: The second conference day

As the official party was not between the two conference days, I could get some rest.

People Over Code

I started my day with the talk from Andrew Nacin and his funny stories from projects in the WordPress ecosystem as well as in government. He reminded us, that we should keep our software as easy as possible, so not only other developers can work with it, but also we would know what we wrote back then 🙂

We Are All Making This Up: Improv Lessons for Developers

The next session was really something quite different. Dwayne McDaniel is not only a developer but he is also doing Improv. In his talk he made some interessting connections and even had some attendees joining him on stage for a small experiment/game.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

The Pernicious Myth of the Code Poet

Followed by this Boone Gorges talked about the WordPress slogan “Code is Poetry” and why he thinks it doesn’t really fits. In the Q&A after his talk, someone asked him, if he knows a better slogan. He came up with quite a funny one 🙂

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

After these talks I had to take a break for some meetings and an interview for the German podcast PressWerk (which is not yet online and will be in German).

Interview and Q&A with Matt Mullenweg

As on the previous WordCamp Europes, the co-founder of WordPress Matt Mullenweg had an interview followed by a Q&A session where attendees could ask him anything.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

That was also my last session of the WordCamp as I prepared for the closing remarks.

After party

After the great success of the WCEU ball last year on Vienna, we had another “party with style”. This years theme were the 1930s. The organizing team picked the beautiful Pavillon d’Armenonville as the location of the party. Located in the Bois de Boulogne, it was the perfect place for a nice evening with old and new friends to celebrate a wonderful event.

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

Conclusion

This was my first WordCamp Europe being part of the organizing team. I had an amazing time organizing and attending this WordCamp. The WordCamp Europe continues to be one of my favorite WordCamps. So I will definately be on the next one as well. Speaking about next year: the new city was announced in the closing remarks. We will meet again from June 14 to June 16 in … Belgrade, Serbia. Milan Ivanović and his local co-organizers found a perfect venue in the capital of Serbia. As I have never been to this country, I can’t wait to visit it in 12 month. Maybe I join some meeting of the local team to get some insights for an upcoming WordCamp Europe. But more on that on another occasion 🙂

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

WordCamp Copenhagen – Discovering a new community

You know I am spontaneous, when it comes to WordCamps, right? So three weeks ago was WordCamp Berlin. On the Contributor Day on Friday, Jenny Wong asked the design team, if they could help WordCamp Copenhagen with their website. She was the mentor of the organizing team – the single one left! The organization didn’t went too well and they didn’t had a real website. So the awesome design team helped with that and when the Contribtutor Day ended, WordCamp Copenhage had a nice website.

Meeting new communities

I was not involed in this process, but I offered my help as a “experienced organizer” if the organizer of WordCamp Copenhagen or Jenny needed more help. So in the following week, only around 9 days before the WordCamp, I searched for flights to Copenhagen and found a really good deal. So, here I was, booking another WordCamp trip 🙂

Click here to display content from Twitter.
Learn more in Twitter’s privacy policy.

Read more →

WordCamp Berlin 2017 – How was it?

Some of you might say “what, yet another WordCamp review?”, but no, this one will be different. And the reason is quite simple. For WordCamp Berlin 2017, I was the lead organizer so I had almost no time to see any sessions. So you have to read all the other reviews out there, if you want to know, how the talks have been.

WPAdminDay

But before I write some words about the WordCamp, let’s start two days earlier. Stefan Kremer organized for dev ops how maintain WordPress websites for their clients. As I am the administrator for the WordPress websites in the agency I am working for, this day gave me lots of new insights on how to optimize workflows and get a better overview on tasks to be done.

Marc Nilius showed his daily workflow when updating WordPress installations using InifiteWP, a software I really want to look into in the next weeks. He also wrote a custom script, which parses the email about changed files and how he uses this system to detect potentially hacked site.

Read more →

Home page with a grid layout using flexbox

A friend asked me on how to show the home page with the latest blog posts as a grid instead of a list. I though a bit about how I would solve it and as I haven’t used CSS Flexbox a lot in the past, I wanted to try this out. So, on the train back to Berlin, I tinkered a bit and came up with a small solution.

Turing TwentyFifteen’s home page into a grid

I needed a theme to experiment with and again I’ve chosen TwentyFifteen, as if has enough pace to have a grid home page. So, how does the home page look like in the theme by default?

Read more →

Disable self pings on a multisite

On a project, the client wanted to disable any pingsbacks from it’s own site. I found a snippet for that and there is also a plugin with this snippet. But this will only work for the current page. What if you want to disable pingbacks from one site of a multisite to another?

The extended snippet

Everytime a post or page is posted or updated, WordPress will try to send a pingback to any URL in the content. To modify the list of links to ping, we can use the action pre_ping with a very simple callback function:

Read more →

WordCamp Torino – My second Italian WordCamp

I just got back from my second WordCamp this year and also the second in Italy: WordCamp Torino. At WordCamp London three weeks ago, I was pretty sure, that I would not attend this one. But only a week later, plans changed and I couldn’t resist 🙂

Friday: Contributor Day

With only buying my ticket two weeks before the event, the Contributor Day tickets were already gone. Thanks to the organizing team, they could find some more room for us, so I was able to attend. With the upcoming WordCamp Europe and my participation in the organizing team, I had some work to do on the new default WordCamp theme. I hope that I can present you the results soon. There was also a little workshop about VVV which was pretty useful, as I just set up the new environment for my work on the new theme.

Read more →

My third WordCamp London and the first time as a volunteer

Last weekend, around 600 people met to largest the anually WordCamp in a European city: WordCamp London 2017. This was the third year in a row I visited this event and it still is my most favorite WordCamp. I booked my ticket many weeks ago. But after the organizing needed some last minute volunteers around a month before the big event, I didn’t thought twice and applied as a volunteer.

My second WordCamp volunteering

I have visitied many WordCamps, spoken on a couple of them and co-organized 3 Camp so far in Berlin and am currently the lead organizer of the next WordCamp Berlin in May. But this was only the second time, I applied as a volunteer. Being a volunteer, you not only meet new people and get in touch with many more, than as a regular attendee. You also learn a lot as an organizer. There are many things every WordCamp has in common. But especially WordCamp London sets a good example on many details. The team around Jenny Wong did a great job. Just as in the years before.

Read more →