PHP

HostSo.com Web Hosting Services Review – Negative

150 150 rhecht

hostso-logo_bgRecently I was advised by a friend of mine to try switching my web hosting to HostSo. The pitch was that they operated a server that had 12 GB of RAM, and if one paid only $8.56/month for their ULTRA plan, one had unlimited space. I decided to give it a shot, which lasted a total of three days.

Here’s how it went: I went to the website and purchased the hosting plan. That setup was straightforward. One thing that gave off a red flag was the inability for them to enable Shell access on my own account for “security purposes.” That bothered me was that my website files, zipped, were too large to be unzipped on their server.

I had asked server support via Live Chat to unzip the files for me if possible. They did – to an extent. When they unzipped my website files they forgot to include all subdirectories and pointers. That left behind a huge mess of files all in the same directory for me to delete, as there was not much more I could do with them. I realized then and there that I would need to upload all website files the old-fashioned way.

After doing that (many hours later), setting up the necessary MySQL databases for my WordPress sites and pointing everything correctly, I noticed that my websites were all running slowly despite the claim that the server ran on 12 GB of RAM. My guess was there were already too many websites being hosted already on their server which was causing the sites to already run slowly. I set up WP-SuperCache (or W3-Total Cache, I forget which – they’re both good) to cache and speed up the sites. That helped a little. Then the unspeakable (in terms of customer service) happened.

The following day after my sites were launched I noticed that none of my WordPress sites, built on a Multisite configuration, were showing. I found that the “Permissions” to the required website directory were set to “000.” I reset the permissions of that and all subdirectories, then asked server support what happened. Their response? “Oh, we decided to disable that directory as it was causing too much of a load on our server.” Well duh! Websites do tend to do that. They also instructed me to optimize my databases and it won’t happen again. When I did, I replied that I had done so, but that what bothered me was that they took my sites down without my asking, and that concerned me from a business perspective. They replied that it won’t happen again before they warn me, and that I need to continue optimizing my databases. I decided then and there to leave their hosting in a flash.

When I asked to leave their hosting, they asked me why and I explained that their hosting didn’t meet my business requirements. It took a lot of back-and-forth with setting up a formal ticket, among other things, to finally get some sort of Credit Cart refund. Since they were using 2Checkout to process their payments, they returned the exact amount I paid them, but I received something like $8 less than they paid me due to 2Checkout’s insane processing fees. Whatever, at that point I decided to cut my losses.

I later learned from doing some Google searches that others had real complaints about HostSo’s Services. Among them were:

http://www.webhostingstuff.com/review/HostSocom.html

https://wordpress.org/support/topic/hostso-or-blue-host

https://forums.digitalpoint.com/threads/hostso-com-another-scam-company.1654806/

In short, never again. I had a terrible experience with them and don’t want to see others fall into the same trap.

WordPress: Youtube Embeds Not Working in Posts After Import

150 150 rhecht

wordpress-logo-teal
Let’s say you are importing a WordPress website from another website (e.g. posts, pages, etc.) and notice that Youtube embeds didn’t move over. What do you do?

Answer: WordPress automatically filters anything that looks “funny,” which includes inline frames. What you do is (from http://wordpress.org/support/topic/youtube-embeds-not-working-after-import):

You can find in /wp-includes called kses.php. In kses.php, you’ll want to scroll down to line 1309 and comment out the three lines under //Post filtering so that they look like this:

// Post filtering
#add_filter(‘content_save_pre’, ‘wp_filter_post_kses’);
#add_filter(‘excerpt_save_pre’, ‘wp_filter_post_kses’);
#add_filter(‘content_filtered_save_pre’, ‘wp_filter_post_kses’);

This will prevent the filter from removing all your youtube videos, slideshare embed, scribd documents, etc. Once you’ve altered the filter and saved it, you’re ready to create your new blogs, hit the Tools menu, and import your XML from your exports above. After the process completes, you should have a working blog with all of your previous content in place exactly as before.

What you’ll need to do (sorry) is restart from scratch – remove all tables in database, delete wp-config file and start over, with the modified kses file.

Wither CodeIgniter? Hello Laravel, CakePHP, and Zend

rhecht

codeigniter-logoI recently was looking at different website frameworks and decided to revisit an old friend – CodeIgniter. CodeIgniter is a fast and lightweight PHP framework that has gained quite a following, and is famously known to power ExpressionEngine, a CMS that costs $300 per license. A friend recommended that framework to me a few years back, and after learning the MVC framework from it via online tutorials and books, built my first project, a Toronto-based Traffic/Parking Tickets filing program. Sadly, like the project, the framework doesn’t look like it’s materializing any further.

What shocked me was when EllisLab, the current owner of CodeIgniter, wrote a blog post last June that essentially looked like they were raising the white flag on the framework. The excuse: they don’t have time, money or resources to focus on it and are looking for someone to focus on it more. In a fast-paced world where everyone is busy and where new frameworks are coming out of the woodwork, it doesn’t look like there’s much hope left for it.

Looking at an independent post, it looks like the next frameworks to focus on are CakePHP and Laravel. Zend also works as they have been around the longest and offer PHP certification.

Rest in Peace, CodeIgniter. I will look to learn Laravel here as it looks to be the future in PHP framework coding.

WooCommerce – Change Product Description Heading Title

150 150 rhecht

Change the heading title in the product description panel on the single product page in WooCommerce. This is for the ‘Product Description’ title inside the panel, NOT for the ‘Description’ tab. This code snippet goes in your functions.php, or other functions file. Change line 9 where it says, ‘YOUR CUSTOM TITLE’, to your own title.

/** 
 * Change on single product panel "Product Description"
 * since it already says "features" on tab.
 */
add_filter('woocommerce_product_description_heading',
'isa_product_description_heading');

function isa_product_description_heading() {
	echo 'YOUR CUSTOM TITLE';
}

Variation

You may want to remove the heading title altogether since it’s sort of redundant; there’s already a tab on top with a title. So, to remove the title, do this code instead:

/** 
 * remove on single product panel, "Product Description"
 * since it already says "Description" on tab.
 */
add_filter('woocommerce_product_description_heading',
'isa_product_description_heading');

function isa_product_description_heading() {
	echo '';
}

Courtesy of: http://isabelcastillo.com/change-product-description-title-woocommerce

WebP – Google’s Image Extension for Web Internet Browsers – How to Properly Use

150 150 rhecht

webplogoRecently, when I launched a new design for a website, one of the biggest features was a photo gallery. This photo gallery was calling a number of high-res PNG files, which was a big part that caused the home page to load slowly. Seeing few options for the same quality images at a smaller file size. I then recalled a couple of years ago when Google announced a new image format specific for web browsers. That format is WebP, and for all intents and purposes it’s the same as a PNG file at 1/5th the size, allowing for faster loading.

I immediately jumped at the chance to convert my PNG files into WebP images, and was more than pleased at the results. However, imagine my chagrin when I realized that WebP can only be used by Google Chrome and no other browser! What to do?

The simple answer seems to be that for now, make image loading browser specific, at least until all other browsers (Internet Explorer, Firefox, Safari, Opera, etc.) get up to speed. It’s a shame as WebP loads lightening-fast, but that what cross-browser compatibility is all about. If the browser is Chrome, then unleash the WebP goodness it has to offer. Else, load the slow-loading PNG files. But how?

Looking at browser-specific CSS rules, I realized then and there that from a CSS perspective, you cannot isolate Chrome from Safari, Chrome from Opera, etc. The only two ways are server-side or JQuery.

Since too much Javascript is never a good thing, I did the responsible thing: I hard-coded a condition in PHP:

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false)
{
    // User agent is Google Chrome
    // Output WebP background CSS file
}
else{
    //Output slow-loading PNG background CSS file
}

And voila! It worked!

Oh, before I finish, here’s a way to slightly reduce the size of your PNG files. It’s called PNGCrush and should reduce the image size by up to a quarter of what it was before. Enjoy!

Note: Being lazy, I’ve been using TinyPNG, a user-friendly PNG resizer that doesn’t compromise the size or quality of your PNG images.

 

How to Add a User to a WordPress Multisite Via Database as an Administrator

150 150 rhecht

WP_MultiSiteA while back we were given permission to host and edit a clients’ website, built on WordPress with Multisite functionality. However, for various reasons we were unable to get in touch with the previous developer who had Admin access to the sites. Since we were hosting their website and database, we at least had that. The solution then was to add a new user (us) through the back-end. The question that remained was, how?

Here is what we did:

1. Access the database

Once the database was created and uploaded, we needed to access it. Our personal favourite desktop tool for the job is HeidiSQL.

2. Add a new user

To do this, go to the wp_users table. From there, you can add your username, user_nicename, email, etc.

The password though is a bit tricky. Assuming that the encryption is a standard MD5 Hash and not with SALT, you can insert a password (say it’s 123456) as follows:

"Update [table_prefix - usually wp_]users set user_pass=md5('123456') where ID=[id # of user you are trying to update];"

1 - add user info without password

3. Add User to sites

Now that the basic user information is added, now we need to associate it with a site. To do so you would add the following fields:

  • wp_capabilities -> a:1:{s:13:”administrator”;s:1:”1″;}
  • wp_user-settings -> editor=tinymce&mfold=o&align=center&libraryContent=browse&urlbutton=custom&imgsize=full
  • wp_user_level -> 10

Do this for all sites, wp_, wp_1_. wp_2_, wp_3, etc.

2 - usermeta convention

4. Add Site Admins in wp_sitemeta

Okay, great. Now you have added yourself as an admin for each sites. However, you still aren’t yet set to change Network Settings. For this, you need to go to [table_prefix – usually wp_]sitemeta. From there search for a meta_key called “site_admins.” The syntax is in the screenshot below. Let’s analyze the syntax.

a:3:{i:0;s:5:"admin";i:1;s:9:"user12345";i:2;s:10:"user234567";}

  • “a:3″ -> for network Admins, there will be 3. The succeeding text will now list them.
  • “i:0″, “i:1″, ”i:2″ -> This is the user order: Admin1, Admin2, Admin3, etc.
  • “s:5″, “s:9″, “s:10” -> This represents the number of characters of the declared username! This apparently was added as a security feature of sorts. If the number of characters are off than this will not work!
  • “admin,” “irisemedia,” etc. -> This is the declared username that will be associated with the Network Admins

3 - sitemeta convention

Now, try logging in and see if it works.

Post originally published here: http://www.irisemedia.com/blog/2013/04/30/how-to-add-a-user-to-a-wordpress-multisite-via-database-as-an-administrator.html

Get-Simple CMS – A Non-MySQL, XML Data-Based Content Management System (CMS)

150 150 rhecht

get-simple-logo-screenI have been using WordPress for building most of my websites and plan to continue doing so. It has become a very robust platform that can do many things. However, I find that with the robustness, WordPress can bog down the page load time on a shared hosting server, especially on Godaddy. The requirements on a MySQL database can cause a sluggish, overloaded MySQL server to slow down an otherwise-perfectly fast site.

Enter a CMS that utilizes XML files for data that’s not as robust as WordPress but “does the job.” I recently was introduced to a CMS called “Get-Simple CMS,” and am hooked. Get-Simple is a very lightweight Content Management System (CMS) that is relatively limited in features. However, it requires no MySQL database and is already looks like it has the basic array of materials for a CMS. It has a photo gallery, basic shopping cart, SEO plugin, custom SEO-friendly URLs, a WYSIWYG editor, an XML sitemap, a contact form, and more. It’s also very easy to theme from any HTML theme you choose. What’s more is that it loads very fast.

I strongly recommend Get-Simple to anyone looking for a simple 5-20 page site with some “kick.” I’ve been using it for my personal site and so far like it’s functionality, though again, it’s not as feature-rich as WordPress.

For more XML-based Content Management Systems, visit the following links:

Solution to Annoying WordPress Error Warning: Invalid argument supplied for foreach() wp-includes/query.php on line 2762

150 150 rhecht

Initial post by Blackspotradish, this saved me hours of frustration!

This was an annoying bug on one of my wordpress + buddypress for a while and the fix is amazingly simple :

Edit your wp-includes/query.php around line 2762

// Always sanitize
foreach ( $this->posts as $i => $post ) {
    $this->posts[$i] = sanitize_post( $post, 'raw' );
}

and replace by :

// Always sanitize
if ( $this->post_count > 0 ) {
    foreach ( $this->posts as $i => $post ) {
        $this->posts[$i] = sanitize_post( $post, 'raw' );
    }
}

How to Install & Setup WordPress Multisite

150 150 rhecht

Since version 3.0, you  had the option to activate “WordPress Multisite,” which is great considering that it allows you to run as many sites as you want from a single WordPress installation (whereas previously it was one website per WordPress installation).

If you run a lot of sites, or you have lots of clients that you keep websites for, it can be a lot of maintenance to go to each one individually and update them on a regular basis. With WordPress Multisite, you can update all the plugins and themes with just one click, which is a huge time-saver. I currently run a network of about 20 sites and it makes it so much easier to keep everything updated. You could have a much larger network of sites and it would be no more difficult to update them all. Not to mention that, when you have a bunch of WordPress sites running on a single web server, it can slow everything else down. Having only one installation means less resources are being drained on your web server.

The benefits of WordPress Multisite are massive and I thoroughly recommend it to anyone who wants to run more than one site, unless there is a very good reason for keeping the sites separate from one another.

If you find this tutorial a little too daunting,  hire me to do it for you. However, if you’re comfortable fiddling with code, here is how to do it.

WordPress Multisite Step 1: Back Everything UP!!!

You’re about to be making some significant changes to your core files and in particular, your database, so be sure to take a thorough backup of both even if you automate your database backups. This is standard procedure and “I pity the fool” who doesn’t back everything up prior to updating core files.

WordPress Multisite Step 2: Allow Multisite Installation

To avoid dangerous mistakes, you need  to intentionally enable the option to even install multisite. Fortunately, it doesn’t require much of you. Hunt down your wp-config.php file which should be in the root of your WordPress installation, find the “stop editing” line and insert the following line just above it, like so:

define('WP_ALLOW_MULTISITE', true);

/* That's all, stop editing! Happy blogging. */

WordPress Multisite Step 3: Setup the network

Now when you refresh your WordPress admin, you’ll see an additional option under the Tools menu called Network Setup. Head there. You’ll be presented with a few options, like what to call your network and the email address of your Super Admin (see A Quick Guide to User Roles). You may also be presented with the option to choose between sub-directory or subdomain installation. Unless you desperately want a subdirectory installation, I would strongly suggest subdomain installation. Fill the options out and hit the big old install button (but only if you promise me that backed up your site first).

WordPress Multisite Step 4: Enable the network

Now that your database is ready to get the network going, you need to edit a couple more files to make the network active. Fortunately, the clever WordPress monkeys made it very explicit and easy for you to understand.

After setting up the network, you should be presented with a page that shows you a few blocks of code. Enabling the network involves adding some code to two files: wp-config.php and .htaccess, both of which should be in your website’s root folder. The code for your wp-config.php will look something like the code below:

define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'wpsites.rafihecht.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

/* That's all, stop editing! Happy blogging. */

WordPress Multisite Step 5: Add a Wildcard Subdomain (optional)

At this point, you should also enable a “wildcard subdomain” in your hosting account, which will allow WordPress to use whatever subdomain it needs to create all the different sites. I’m going to show you how to do this in cPanel, since this should be available to most of you (especially if you use HostGator).

Once logged in to cPanel, hit the Subdomains icon. You’ll then have a small form that will enable you to add a new subdomain (above any subdomains that might already exist). Create a new subdomain of * on the domain of your WordPress master site, setting the document root as public_html, or wherever the root of your website is, if it’s not there.

Once you’ve successfully done that and added all the code that WordPress asks you to, you’ll need to login again. There should be a link at the bottom of the Network setup page. Click there and log back in, where your new multisite-enabled site will be waiting for you.
Note: this is optional as not every host, such as GoDaddy, will have the option to add a wildcard subdomain for security reasons. In that case you can always just do “wpsites.rafihecht.com/foo.”

WordPress Multisite Step 6: Tweaking your settings

How you set up your network will largely depend on how you want to run it. For example, on my network, I don’t want to allow anyone to be able to create their own site, though that is an option if you want to do that. I also don’t want to limit what kind of files can be uploaded (since I’m in charge of all the sites), or what size they can be, though if you have a more open network, you may want to put some of those restrictions in place.
To modify your network settings, you’ll need to go to the newly created Network Admin area; your original WordPress site will continue to have it’s own admin area, but there will be a new overarching Network Admin Area where you can install themes, plugins and add new sites and users from. To access it, you can go to the admin bar and find it under the My Sites menu. You can also go to yourdomain.com/wp-admin/network to get to the Network Admin area.

Once you’re at the dashboard, you can find the network setup page under Settings > Network Settings. Just have a good look through at everything and set up the options as you see fit for what your network needs are. You can of course change them if they are too strict or lax in the future.

If you’re going to disable new site registrations, so that only a Super Admin can create new sites, you might want to add another declaration to your wp-config.php file, just below all the ones you pasted earlier. This will redirect people to a specified site if they try to access a site that doesn’t exist (presumably your master site). For example, since I have the following declaration in my wp-config.php file, anyone trying to access wpsites.rafihecht.com/rjhsolutions, which does not exist, will be redirected to wpsites.rafihecht.com:

define( 'NOBLOGREDIRECT', 'http://wpsites.rafihecht.com');

WordPress Multisite Step 7: Adding a new network site

Now that your network is all set up, you’ll probably want to add your first network site. Doing so is a fairly simple process. Go to the Add New option under the Sites menu in your Network Admin area.

The process of adding the site is incredibly simple. Just three pieces of information are required of you; the site address, which is where your site will be accessed from. For example, if I was going to create a site at wpsites.rafihecht.com/parties, I would simple insert parties in this field.

You’re then asked for the Site Title and finally the Administrator’s email. If you want to add yourself as the site’s admin, just enter the same email address that you used in your existing profile. Alternatively, you can set it as someone completely new.

Once you click on Add Site, it will create the site for you and you are then given the option to go to the Dashboard, or Edit the Site. Simple huh!?

How about using custom domains for my new sites?

As you’ll have noticed, everything up to this point has allowed you to create new sites as subdomains to the Network Master Site, where you installed Multisite. But what if you want to use custom domains for your new sites? For example, I have WordPress Multisite installed on rafihecht.com, but RJH Solutions is a network site from that installation, even though it’s domain (doitwithwp.com) is not a subdomain of rafihecht.com.

Well, I’ve written a tutorial that walks you through that process. If you’ve gotten this far, it’s only a small step to be able to use individual domains for your network sites. Go ahead and read How to Set Up Domain Mapping for WordPress Multisite.

Content of this part of the blog post was courtesy of doitwithwp.com.

Meta-tutorial: How to Disable Multisite Once it’s on

Let’s say you made a mistake during the enabling process, but only figured it out in the end. Perhaps you realized after setting it up as a subdomain network that your host doesn’t have wildcard subdomain support and now you’re out of luck. Perhaps you would only like to run through the process again, to show someone how to do it or to work up a tutorial (like me!). Here’s how to un-do the network:

Only undo your multisite setup if you’re comfortable looking at things like this. Otherwise, just restore from your backups.

  1. First you will want to remove the lines you added to wp-config.php, so that it appears as it did before you started the network setup. Since these lines are all right next to each other, this should be simple enough.
  2. You will need to remove what you added to your .htaccess file as well, returning it to its previous version. If you have made no further customizations to your .htaccess file other than what you did with the network setup, than you can simply delete the .htaccess file.
  3. Delete your /blogs.dir directory within the /wp-content folder. This held all of your site’s uploads (but not your primary site, those are still in /wp-content/uploads).
  4. Finally, you will need to remove a few tables in your database. Open up phpMyAdmin and delete the following rows: every wp_#_ row (these were created for each of your sites, and the number of them depends on how many sites you created) and wp_blogs,wp_blog_versions, and wp_site. This will remove all of the tables created during the multisite setup process.

Of course, since you made a backup of your site before enabling multisite, you can always revert to your old database and files if you need to. This is just another way to achieve the same thing.

You will know this process works when you log back in and the Super Admin menu is gone. Now you can re-create your network, or continue on in single-site WordPress bliss.

Content of this part of the blog post was courtesy of : http://wpcandy.com/teaches/how-to-enable-multisite

 

How to Set Up Domain Mapping for WordPress Multisite

150 150 rhecht

So you’ve gone through setting up WordPress Multisite, and now you’re ready to start setting up new sites in your network. Only trouble is, you want to use unique domains for your sites instead of using subdomains of your main installation. Well, with a little extra effort, it’s entirely possible.

Install the required plugin

There’s an excellent plugin that will do most of the hard work for you. Install the WordPress MU Domain Mapping plugin and Network Activate the plugin.

Before you proceed any further, there’s a couple of things that you have to do manually. Access your site’s installation, either using FTP or your hosting Control Panel and go to wp-content/plugins/wordpress-mu-domain-mapping/ and locate the sunrise.php file. You must move this file up two levels, to the wp-content folder.

Once you’ve done that, find your wp-config.php file and add the following definition. Add it below your previous multisite rules (i.e. above the “Stop editing” line):

define( 'SUNRISE', 'on' );

Domain-Mapping.php
Move “domain-mapping.php” to the mu-plugins” folder at the wp-content “root” level. This is important as certain web servers won’t render the mapped URLs correctly unless this is done.

Configure the plugin

Now your plugin is correctly installed and when you head to the Network Admin area you’ll notice a menu under Settings called Domain Mapping. Click on that so that you can configure the plugin.
The main thing you need to be concerned with is setting the IP address of your server. To find this, log in to your hosting cPanel and on the main page, you should be able to see the IP address of your server in the information on the left-hand side. If you can’t find the IP address, you can get in touch with your host, or use one of many available free tools to convert the web address to an IP address.

If you fill out the IP address, you can ignore the CNAME field. Then, the remaining options are as follows:

  1. Remote Login – Means that logging in to one site will log you in to all sites.
  2. Permanent Redirect – This will create a 301 redirect on your subdomain (as opposed to a temporary 302 redirect) – highly recommended if the domain mapping will be permanent.
  3. User Domain Mapping Page – Creates a new menu in each site which allows that site’s users to map their own domains (instead of being controlled by the network’s Super Admin only).
  4. Redirect administration pages – Means that all administration pages will be kept on the original site’s domain, instead of on the mapped domains.
  5. Disable primary domain check – Means that multiple domains pointing to a single site will be treated as separate sites, instead of redirecting all domains to the noted primary domain (not recommended).

Map domains to your network sites

Now you’re ready to set up the domain for your new sites. You should have already created the site that you’re wanting to map your domain to. At the moment, it will just be a subdomain of your main site – it doesn’t have to be set up or looking perfect – it just has to exist.

Once you’ve purchased your domain, make sure that you set the nameservers for the domain to your hosting account’s nameservers. Then, go to your hosting account cPanel (which all good hosts, including HostGator, should have) and find the Parked Domains option under Domains.

Once in there, add your new domain as a parked domain, making sure that the document root shows as the same folder as your WordPress installation (probably /public_html). If you can’t do this (because you don’t have cPanel for instance), you need to set an A record on your new domain that points to the IP address of your hosting server (which you found out earlier).

Now is the final step. You’ll need to know the “Site ID” of the site you want to map the domain to. If you click on Sites > Sites in the Network Admin, and click on the name of the site (as if to edit it), the URL will include the site ID. It will look something like this (where the Site ID is 2 in the example):

http://wpsites.rafihecht.com/wp-admin/network/site-info.php?id=2

Now back in your Network Admin, go to Domains under the Settings Menu. You’ll see a section for adding a new domain, with three fields: one for the site ID, which you just found out, the domain name and an option whether to set the domain as the primary domain for the site. This is because you can set more than one domain to point to a single site, so you want to specify which one should be the site’s primary domain.

Once you save that, with any luck (and assuming that DNS changes have propagated), if you go to your new domain in a web browser, you should find yourself at your new site.

I’ll grant you that it is a little bit fiddly, and it would be nice if WordPress would bring this into the core and make it a bit more of a fluid process, but once it is set up, you never need to look at it again; the plugin will keep serving up the right site at the right domain.

Did you manage to get through the setup process? Did you encounter any problems? If you need any help getting through this process, you can always ask a question here, or hire me to do it for you.

 

Content of this part of the blog post was courtesy of : http://www.doitwithwp.com/domain-mapping-for-wordpress-multisite/