Wordpress

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.

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

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