• Home
  • About
  • Resume

Posts tagged: php

Shorten URL in HelloTXT WordPress plugin

By , 12/28/2011 10:24 PM

HelloTXT is a very cool service that can post your updates to multiple social networks with a single click. You can feed it data in multiple ways from RSS feeds to Android phones. One such way is a small neat WordPress plugin by Matthew Phillips. Once installed in your blog it will ping HelloTXT whenever you write a new post, notifying all your connected services from Facebook to Twitter.

One small drawback of v1.0.1 of this plugin (current as of this writing) – if permalink URL of your post is very long (pretty ones tend to be) – it gets cut off during HelloTXT notification, since status update has to be within 140 characters length. But there’s an easy solution. Open PHP source of the plugin in any text editor and in function hellotxt_notification locate line:

$link = get_permalink($post->ID);

This is the line that gets permalink of your post. To replace it with shortened URL we can call API of TinyURL service:

$link = file_get_contents("http://tinyurl.com/api-create.php?url=".get_permalink($post->ID));

and Voila! short links are being sent to HelloTXT

Solution for WordPress CURL IPv6 error “Network is unreachable”

By , 06/03/2011 3:35 PM

I am using FeedWordPress plugin on some of my sites to pull data from Google News RSS feeds. It was working fine, but after I moved to a new host, I started to get errors like:

Failed to connect to 2a00:1450:8006::63: Network is unreachable

Note the IPv6. Google have been supporting it for a while and news.google.com resolves to IPv6 first (similar error happens in WordPress admin dashboard in “Incoming Links” section). Unfortunately network of my new host didn’t support IPv6, so I had to find solution to force WordPress to use IPv4. Enter class-http.php. Continue reading 'Solution for WordPress CURL IPv6 error “Network is unreachable”'»

Fix for first release of Unique Article Wizard multisite WordPress plugin

By , 03/10/2011 9:05 AM

If you’re using UAW plugin in your WordPress MU/3.0+ blog, starting version 3.1.26 it supports multisite environment (ability to have individual settings for subdomain blogs). But initial release had a bug resulting in errors of missing config.php as well as

permission denied – your token does not match our records

To fix this error, open file article_mods.php and locate function uaw_add_article. In global declaration after $win add , $blog_id. Then locate line

$uaw_config_file = getcwd() . ($win == "" ? '/config.php' : '\\config.php');

and replace it with

if ($blog_id == '1') 
   {$uaw_config_file = getcwd() . ($win == "" ? '/config.php' : '\\config.php');}
else
   {$uaw_config_file = getcwd() . ($win == "" ? '/config_'.$blog_id.'.php' : '\\config_'.$blog_id.'.php');}

Upload modified file to you UAW plugin directory, overwriting the old one and you’re good to go

PHPBB: Update template file by purging cache

By , 01/05/2010 5:17 PM

Scenario: You’re trying to update a template file in your PHPBB 3.0.x forum, for example to include Google Adsense code into overall_header.html file to display banner on top of all the pages. But after modifying and uploading the file nothing changes, board still displays old template.

What is happening – PHPBB displays cached version of the template. Forum software caches commonly used files to improve performance. The solution is to purge cache.
Purgin Cache in PHPBB 3.0.x board
Login to your forum Administration Control Panel and click Run Now in Purge the cache section. After purging is complete changes in your template take effect.

WordPress MU: Delete Empty Posts

By , 12/11/2009 4:29 PM

Sometimes I bring information to a couple of my other WordPress blogs via RSS feed. It’s a nice feature, allowing you to create several posts at once without manual entry. Unfortunately if RSS feed is broken or improperly formatted it can result in blank posts imported into the blog.

I was looking for a WordPress plugin that would allow me to mass-delete empty posts, but apparently none exist. You can delete posts based on date, tags, category, but not the content. Fortunately if you have access to phpMyAdmin of your MySQL installation – there is a solution. Continue reading 'WordPress MU: Delete Empty Posts'»

Panorama Theme by Themocracy