New plugin: WP User Frontend

Today I am coming with a new WordPress plugin, named “WordPress User Frontend“. Some of us want something like that the subscriber/contributor will not be able to go in the WordPress backend and everything these user can control will be done from WordPress frontend.

Features:

So here is my plugin that solves your problem. This features of this plugin in it’s version 0.6 are follows:

  • User can create a new post and edit from frontend
  • They can view their page in the custom dashboard
  • Users can edit their profile
  • Administrator can restrict any user level to access the WordPress backend (/wp-admin)
  • New posts status, submitted by users are configurable via admin panel. i.e. Published, Draft, Pending
  • Admin can configure to receive notification mail when the users creates a new post.
  • Configurable options if the user can edit or delete their posts.
  • Users can upload attachments from the frontend
  • Admins can manage their users from frontend
  • Pay per post or subscription on posting is possible

Continue reading

Simple server to server file downloader script

About a month ago I wrote a script for my own need. It can download files from another server to your server. I just wrote it for my own purpose and it’s pretty simple and stupid enough. But hey, it works ;)

<?php
if (isset($_POST['sub']))
{
    if (filter_var($url = $_POST['url'], FILTER_VALIDATE_URL))
    {
        define('UPLOAD_DIR', dirname(__FILE__) . '/files/');
        $length = 5120;

        $handle = fopen($url, 'rb');
        $filename = UPLOAD_DIR . substr(strrchr($url, '/'), 1);
        $write = fopen($filename, 'w');

        while (!feof($handle))
        {
            $buffer = fread($handle, $length);
            fwrite($write, $buffer);
        }

        fclose($handle);
        fclose($write);
        echo "<h1>File download complete</h1>";
    }
    else
    {
        echo "<h2>Invalid url</h2>";
    }
}
?>
<form action="" method="POST">
    <p>
        <label for="url">Url:</label>
        <input type="text" size="50" name="url" id="url" />
    </p>
    <p>
        <input type="submit" name="sub" value="download" />
    </p>
</form>

This script has a form input field to make the operation simpler. The downloaded files will be saved on a directory named /files. I am just sharing it, may be it will help you in anyways :)

PHP class for sending, receiving and checking SMS status with GrameenPhone’s Aloashbei API

I saw everyone is participating in the GrameenPhone Aloashbei API contest and it’s began and I am late :P . So why not doing something that makes other’s life easy? So I decided to make a PHP class to do that job for you. You don’t need to know how to work with SOAP. Just instantiate a class, set the parameter and send, VOILA!!!

With the Aloashbei SMS API, you can send SMS, Check the SMS status and receive SMS. You can track location of any GP mobile number with the Location Locator API. It will provide you the longitude and latitude of the phone numbers current position. You can send MMS with the MMS API. You can charge any user who buys any content through the Charging API.

So we are going to build php class that will do these thing easily. Here I will built the SMS class. We can send SMS to any number and if it’s successful, it will return us a message ID. With this message ID, we can check the status of that sent message. To make a complete Aloashbei API class, we’ll first make a basic class and will extend it for other purposes. So here is the basic class that we will extend. It’ll hold the values for setting up the variables and will set user/password initially.

The file Structure:

  • class.Aloashbei.php
  • class.AloashbeiSMS.php
  • sms.php
  • includes/WebService_GP_ADP_BizTalk_SMS_Orchestrations.wsdl

Continue reading

Translate or convert WordPress date/time/comment number to Bangla digit

Today I worked with a WordPress site Bangladesh Linux Users Alliance, which is a complete Bangla language based site. You can translate with the Bangla language pack, but you can’t convert the English digits to it’s corresponding Bangla digit. So I visited the WordPress codex and found some filters that can do that job very easily.

Here is your function that will convert the digit

/**
 * This function converts all english number's to bangla number
 */
function make_bangla_number( $str ) {
    $engNumber = array(1,2,3,4,5,6,7,8,9,0);
    $bangNumber = array('১','২','৩','৪','৫','৬','৭','৮','৯','০');
    $converted = str_replace($engNumber, $bangNumber, $str);

    return $converted;
}

Now we need to add some filters that will hook to this places and convert the digit’s to Bangla.

add_filter( 'get_the_time', 'make_bangla_number' );
add_filter( 'the_date', 'make_bangla_number' );
add_filter( 'get_the_date', 'make_bangla_number' );
add_filter( 'comments_number', 'make_bangla_number' );
add_filter( 'get_comment_date', 'make_bangla_number' );
add_filter( 'get_comment_time', 'make_bangla_number' );

Continue reading

Installing hackintosh iATKOS v7 (Mac OS X leopard 10.5.8) on Dell Inspiron 1545 and my experience

Some month ago I was trying to install Hackintosh on my Dell Inspiron 1545. That was iDeneb DVD. I managed to install it in my laptop. But after installing from that DVD, I couldn’t boot into Mac. I was getting “boot error” message. In that time I was using windows 7 and didn’t know how to fix this issue. So my hackintosh exploration stopped.

Some days ago I managed another ISO of iATKOS v7 and burned it for testing for the second time. I found deviato’s tutorial from here and again installed it. While booting from the DVD I was getting some problems like kernel panic, it’s being hanged with some wired message. But again and again I was trying and finally able to see the installation window. Then I moved forward and opened the disk utility from the installation window. I created a 13GB partition for installing mac and formatted the drive in NTFS format before from GParted from my ubuntu 10.04 installation.

From the Mac disk utility I formatted my 13GB NTFS formatted drive in Mac OS Extended (Journaled) file system. Then I moved forward and installed the Mac OS X leopard successfully. After rebooting I got the same “boot error” message like my previous installation. Again I stopped here, I saw in some blogs to install patched grub2. As I don’t use windows in my laptop, I use ubuntu and the version is 10.04 (lucid lynx) and obviously I use grub2. My ubuntu grub was not there because I installed Mac and it removed my grub. So I booted into ubuntu with a flash USB drive (pen drive) and installed grub2 again to boot into my original installed ubuntu. Again rebooted and logged into my installed ubuntu and ran this command (sudo update-grub) to update my grub to see that if it finds the mac partition, it will be great. And I surprised to see that this update found the Mac installation and added an entry to my grub boot loader. I was really amazed at that time.
Continue reading

Print array elements recursively

Few minutes ago just got a tweet from phpfour (Emran Hasan) that his company is looking for PHP developers. I just visited the announcement page of their site and clicked the apply online button just for testing. There I saw an array written in PHP to solve it. It looked interesting to me and just wrote code for it. Here it is:

<?php
$array = array(
			array(141,151,161),
			2,
			3,
			array(101, 202, 303),
			"php",
			"5"
		);

/**
 * print array elements recursively
 *
 * @param array
 */
function recurse ($array)
{
	//statements
	foreach ($array as $key => $value)
	{
		# code...
		if( is_array( $value ) )
			recurse( $value );
		else
			echo $key . ' => ' . $value . '<br>';
	}
} // End recurse

recurse($array);

/*
output
0 => 141
1 => 151
2 => 161
1 => 2
2 => 3
0 => 101
1 => 202
2 => 303
4 => php
5 => 5
*/

It’s Fun :D

WordPress Plugin: GAF affiliate widget

Hello there, another wp plugin from me ;) . I was thinking to be a Freelancer.com affiliate (previous GetAFreelancer) and  looking for some wordpress widget as I want to show the links in my blog sidebar. I found a plugin built by Masnun bro, but it gets related projects from freelancer.com according to your post and shows below of your post . So i thought, why i don’t I built one before anyone creates before me? :P . So here is the plugin screenshot:

gaf_widget

Widget setting screenshot

So i don’t need to describe what to do after installing the plugin, right? It’ll show the selected links to your sidebar like this:

Displaying links from freelancer.com

So why don’t you add this plugin to your blog and make some money? :D

punBB extension: We miss you!

Just wrote a punBB plugin for Projanmo Forum and now sharing with the community. The plugin describes it’s uses. You will find the configuration at Administration → Settings → Features Here is the screenshot:

Version: 0.1

Download: We miss you

Version: 0.2
Changlog:
* added plugin “active / inactive” feature, defult mode is set to “inactive”
* added plugin execution duration configuraton, it was executing in every page load on the previous version

Requesting bug report :)