WP User Frontend PRO released

WP User Frontend PRO

A long awaited plugin!! Today I’ve released the PRO version of my plugin WP User Frontend. It comes with a bunch of really cool features.

  • Unlimited post type form creation
  • Drag-n-drop form builder
  • Custom taxonomy support
  • 13 variations of custom fields
  • Guest post support
  • Custom Redirection
  • Image upload on post content area
  • Post status selection on new post and edited post separately
  • New or edit post notification
  • Custom fields are generated also in admin area
  • Profile form builder
  • Different profile edit forms for different user roles
  • Drag-n-Drop profile form builder
  • Profile fields are generated on backend too
  • Avatar Upload
  • Frontend profile edit
  • Registration form builder
  • Captcha Support
  • Theme My Login compatible
  • Much more…

Why don’t you check out the features?

IMDB like post rating plugin for WordPress

I was looking for a plugin that will work like IMDB movie rating does, but didn’t found like what I wanted. And they were bloated with features like GD Star Rating. So spend some hours and wrote one myself.

Features

  1. Creates a table {wpprefix}_imdb_rating
  2. Using IMDB_Post_Ratings::init()->rating_input(); inside a post, provides a 10 star rating. Change the number using the filter ip_base_rating. Cool huh?
  3. You can give a rating, also then can remove the rating, give again, remove again, give again…

Functions

  1. IMDB_Post_Ratings::init()->rating_input( $post_id ) Inserts the rating star bars.
  2. IMDB_Post_Ratings::init()->get_top_rated() – get top rated posts. Supports 3 parameters, post_type, limit, offset
  3. IMDB_Post_Ratings::init()->get_rating( $post_id ) – returns rating for single post.

Screenshot

screenshot

Github

WP Project Manager, beta version released

I started working on this project almost 5 months ago. That time, I decided to create all the functionality on my own, without using WordPress custom post types and taxonomies. So I created my own database tables and created all the functions. But later on, it seemed like I made mistake choosing that path. As this was a lot of codes, I mean LOT of codes to rewrite, so I stopped right there.

Last month, again I took the project and wanted to finish it. So I kept working and managed to improve a lot and migrate everything to native WordPress, with custom post type.

So here is the demo of the plugin, how it works. It’s not refined yet, but that shouldn’t be really a problem if you are going to manage your projects right now. I haven’t submitted the plugin on WordPress repo yet, will do it soon..

Github Repo Download

Contribute:

This is a beta version right now and should have bugs. If you want to contribute on this project, you are more than welcome.

WordPress Settings API PHP Class – It has never been easier

Yesterday I was thinking to migrate my “WP User Frontend” plugins option panel to settings API which is using a manual option currently. So I thought why not write a PHP class that will solve my problems for every plugin or theme I’ll be writing? There are many existing framework like “Options Framework” and other stuffs, I wanted to keep it very simple and straight forward. So I came up with a very simple PHP class that builds your options panel with a simple file without extra hassle.

So here is how to use that class.

1. Create sections and fields array

We are going to build two array here. One contains the sections we are going to make, another one contains the fields belongs to every sections.

/**
 * Registers settings section and fields
 */
function wedevs_admin_init() {

    $sections = array(
        array(
            'id' => 'wedevs_basics',
            'title' => __( 'Basic Settings', 'wedevs' )
        ),
        array(
            'id' => 'wedevs_advanced',
            'title' => __( 'Advanced Settings', 'wedevs' )
        ),
        array(
            'id' => 'wedevs_others',
            'title' => __( 'Other Settings', 'wpuf' )
        )
    );

    $fields = array(
        'wedevs_basics' => array(
            array(
                'name' => 'text',
                'label' => __( 'Text Input', 'wedevs' ),
                'desc' => __( 'Text input description', 'wedevs' ),
                'type' => 'text',
                'default' => 'Title'
            ),
            array(
                'name' => 'textarea',
                'label' => __( 'Textarea Input', 'wedevs' ),
                'desc' => __( 'Textarea description', 'wedevs' ),
                'type' => 'textarea'
            ),
            array(
                'name' => 'checkbox',
                'label' => __( 'Checkbox', 'wedevs' ),
                'desc' => __( 'Checkbox Label', 'wedevs' ),
                'type' => 'checkbox'
            ),
            array(
                'name' => 'radio',
                'label' => __( 'Radio Button', 'wedevs' ),
                'desc' => __( 'A radio button', 'wedevs' ),
                'type' => 'radio',
                'options' => array(
                    'yes' => 'Yes',
                    'no' => 'No'
                )
            ),
            array(
                'name' => 'multicheck',
                'label' => __( 'Multile checkbox', 'wedevs' ),
                'desc' => __( 'Multi checkbox description', 'wedevs' ),
                'type' => 'multicheck',
                'options' => array(
                    'one' => 'One',
                    'two' => 'Two',
                    'three' => 'Three',
                    'four' => 'Four'
                )
            ),
            array(
                'name' => 'selectbox',
                'label' => __( 'A Dropdown', 'wedevs' ),
                'desc' => __( 'Dropdown description', 'wedevs' ),
                'type' => 'select',
                'default' => 'no',
                'options' => array(
                    'yes' => 'Yes',
                    'no' => 'No'
                )
            )
        ),
        'wedevs_advanced' => array(
            array(
                'name' => 'text',
                'label' => __( 'Text Input', 'wedevs' ),
                'desc' => __( 'Text input description', 'wedevs' ),
                'type' => 'text',
                'default' => 'Title'
            ),
            array(
                'name' => 'textarea',
                'label' => __( 'Textarea Input', 'wedevs' ),
                'desc' => __( 'Textarea description', 'wedevs' ),
                'type' => 'textarea'
            ),
            array(
                'name' => 'checkbox',
                'label' => __( 'Checkbox', 'wedevs' ),
                'desc' => __( 'Checkbox Label', 'wedevs' ),
                'type' => 'checkbox'
            ),
            array(
                'name' => 'radio',
                'label' => __( 'Radio Button', 'wedevs' ),
                'desc' => __( 'A radio button', 'wedevs' ),
                'type' => 'radio',
                'default' => 'no',
                'options' => array(
                    'yes' => 'Yes',
                    'no' => 'No'
                )
            ),
            array(
                'name' => 'multicheck',
                'label' => __( 'Multile checkbox', 'wedevs' ),
                'desc' => __( 'Multi checkbox description', 'wedevs' ),
                'type' => 'multicheck',
                'default' => array('one' => 'one', 'four' => 'four'),
                'options' => array(
                    'one' => 'One',
                    'two' => 'Two',
                    'three' => 'Three',
                    'four' => 'Four'
                )
            ),
            array(
                'name' => 'selectbox',
                'label' => __( 'A Dropdown', 'wedevs' ),
                'desc' => __( 'Dropdown description', 'wedevs' ),
                'type' => 'select',
                'options' => array(
                    'yes' => 'Yes',
                    'no' => 'No'
                )
            )
        ),
        'wedevs_others' => array(
            array(
                'name' => 'text',
                'label' => __( 'Text Input', 'wedevs' ),
                'desc' => __( 'Text input description', 'wedevs' ),
                'type' => 'text',
                'default' => 'Title'
            ),
            array(
                'name' => 'textarea',
                'label' => __( 'Textarea Input', 'wedevs' ),
                'desc' => __( 'Textarea description', 'wedevs' ),
                'type' => 'textarea'
            ),
            array(
                'name' => 'checkbox',
                'label' => __( 'Checkbox', 'wedevs' ),
                'desc' => __( 'Checkbox Label', 'wedevs' ),
                'type' => 'checkbox'
            ),
            array(
                'name' => 'radio',
                'label' => __( 'Radio Button', 'wedevs' ),
                'desc' => __( 'A radio button', 'wedevs' ),
                'type' => 'radio',
                'options' => array(
                    'yes' => 'Yes',
                    'no' => 'No'
                )
            ),
            array(
                'name' => 'multicheck',
                'label' => __( 'Multile checkbox', 'wedevs' ),
                'desc' => __( 'Multi checkbox description', 'wedevs' ),
                'type' => 'multicheck',
                'options' => array(
                    'one' => 'One',
                    'two' => 'Two',
                    'three' => 'Three',
                    'four' => 'Four'
                )
            ),
            array(
                'name' => 'selectbox',
                'label' => __( 'A Dropdown', 'wedevs' ),
                'desc' => __( 'Dropdown description', 'wedevs' ),
                'type' => 'select',
                'options' => array(
                    'yes' => 'Yes',
                    'no' => 'No'
                )
            )
        )
    );

    $settings_api = new WeDevs_Settings_API();

    //set sections and fields
    $settings_api->set_sections( $sections );
    $settings_api->set_fields( $fields );

    //initialize them
    $settings_api->admin_init();
}

add_action( 'admin_init', 'wedevs_admin_init' );

So this big chunk of code actually creating 3 settings section and within these 3 settings section, we are adding different field section with given types. e.g: text, select, textarea, checkbox etc.

Each fields array are under the same fields section key name that we are using as settings section. That way we are saying with fields belongs to which section.

Then we are creating our WeDevs_Settings_API class instance, setting the sections and fields and initialize them.

2. Register Options Page

Now it’s fairly easy. We need to just register a settings page, and display the form.

/**
 * Register the plugin page
 */
function wedevs_admin_menu() {
    add_options_page( 'Settings API', 'Settings API', 'delete_posts', 'settings_api_test', 'wedevs_plugin_page' );
}

add_action( 'admin_menu', 'wedevs_admin_menu' );

3. Display the Form

/**
 * Display the plugin settings options page
 */
function wedevs_plugin_page() {
    $settings_api = new WeDevs_Settings_API();

    echo '<div class="wrap">';
    settings_errors();

    $settings_api->show_navigation();
    $settings_api->show_forms();

    echo '</div>';
}

4. Retrieving the values

/**
 * Get the value of a settings field
 *
 * @param string $option settings field name
 * @param string $section the section name this field belongs to
 * @param string $default default text if it's not found
 * @return mixed
 */
function my_get_option( $option, $section, $default = '' ) {

    $options = get_option( $section );

    if ( isset( $options[$option] ) ) {
        return $options[$option];
    }

    return $default;
}

Now we can get those saved values by this little utility function. We can use like this echo my_get_option( 'field_name', 'section_name', 'default value' ); in our theme or plugins. If you have 4 settings section, only 4 options will be saved in the wp_options table. The options belongs to each section will be saved under those 4 option. So when you retrieve a section by get_option( 'section_name' ), you get all the section fields values under that section and they are stored as an array.

As a result, we get this -
Settings API PHP Class

So that was easy as pie!

Download Github

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

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