register activation hook using in wordpress plugin

wordpress hooks are very important for wp developers. We can use the wp hooks in wordpress plugin and themes. Here in this article I will show you how to register the hook in wordpress plugin. I given the simple code sample which will give you the fare idea about using the wordpress hooks.

register activation hook using in wordpress plugin

register activation hook using in wordpress plugin
register activation hook using in wordpress plugin

register_activation_hook is very important function for creating the wordpress plugin. The function register_activation_hook registers a plugin function to be run when the plugin is activated.
You can use the register_activation_hook as follows:

<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php register_activation_hook($file, $function); ?>

If you can going to create the wordpress simple plugin then this function is very useful. this function you can use as follows in files.
If you have a function called myplugin_activate() in the main plugin file at either

* wp-content/plugins/myplugin.php or
* wp-content/plugins/myplugin/myplugin.php

you can use code as follows:

global $myvar;
$myvar='whatever';

function myplugin_activate() {
  global $myvar;
  echo $myvar; // this will be 'whatever'
}

register_activation_hook( __FILE__, 'myplugin_activate' );

1. register_activation_hook() must be called from the main plugin file – the one that has “Plugin Name: …” directive.
2. Your hook function must be in the same file as well. From that function it is ok to call other functions defined in other files.
3. Doing echo “My hook called!”; – does not work from it. So this is not a good way to judge whether it working or not.
4. Your global variables must be explicitly declared as global for them to be accessed from inside of my_activation_hook().

Check the sample wordpress plugin code.

<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
/*
Plugin Name: A Test
Description: A Test
*/

require_once (dirname(__FILE__) . '/my_other_file.php');

// This code *will not* work. Activation hook function must be defined in the main plugin file.
//    register_activation_hook (dirname(__FILE__) . '/my_other_file.php', 'my_other_function');

// This code will work.
register_activation_hook (__FILE__, 'test_activated');

// This is correct way to declare/access globals.
global $some_var;    // globals must be declared explicitly. Without this you will not be able to access '$some_var' from within 'test_activated()' function.
$some_var = 'hey';

//===========================================================================
function test_activated ()
{
   global $some_var; // Now it will be 'hey'.

   // This function is defined in 'my_other_file.php'
   my_other_function ();

   // This will not work, so don't try. If you need logging write something in temporary log file in here via fopen/fwrite.
	// If you want to quickly test if your activation hook works - put exit() into it. At least you'll see error during activation.
   echo 'test_activated called!';
}
//===========================================================================

?>

The function register_deactivation_hook registers a plugin function to be run when the plugin is deactivated.
following function will deactivate your plugin

register_deactivation_hook( __FILE__, 'myplugin_deactivate' );

Dont use WP-Robot plugin ever in WordPress blog

First reason I must say that google does not like the wp-robot wordpress plugin. Unique and good quality contents are what you need to RANK. Dont use WP-Robot plugin ever in WordPress blog.

What is Wp-Robot?

WP Robot is an autoblogging plugin for WordPress weblogs. It will enable the user to create targeted blog posts on any topic without having to write anything. Blogs will be set on auto-pilot and fresh content will be entered on a schedule that the user specifies and the posts can be on any topic and will be targeted to any keyword desired. Content can be taken from any source including Amazon, Ebay, ClickBank, and YouTube.

Many People think they will earn money easily from this plugin. But that is not true. If you use wp-robot plugin for month you will get to know. Not single article is indexed by google.
Because Google will check the article title and content and That content is duplicate then google never index that page.
Your articles will never comes in picture. It might be possible in that blog you will right the your own articles but still due to wp-robot google will never index your article.
Google might ban your domain name due to wp-robots. Earlier this is happened with some domain names due to wp-robots.
So My advice to all bloggers dont use wp-robots ever.

How can user delete their own account from WordPress site

Creating, editing and deleting the user account is a very basic need of any CMS. We can easily allow user to register their account in wordpress sites. We shown in this article, How can user delete their own account from wordPress site. We can use many wordpress plugins and create User profile and manage their profile.

How can user delete their own account from WordPress site

How can user delete their own account from WordPress site
How can user delete their own account from WordPress site

But in wordpress deleting the User from wordpress site is not easy. Here in this article I will tell how can we easily delete the user account without administrator permission.

Using following wordpress plugin we can achieve this functionality.

User Self Delete

This plugin will allow your users to delete their own account without any need for interaction on the administrator’s behalf.

When a user wishes to delete their account, they are taken to a confirmation page where they must enter the word “yes” in order for the deletion to take place. Once they type “yes” and press the delete account button, they are redirected to the login page and they no longer exist as a user on your site.

BlackBerry Released for wordpress with Improved UI and Language

blackberry 1.4 version is released with new features. This version is very nice features including new UI and bug fixes. This app has new multilingual support.

BlackBerry Released for wordpress with Improved UI and Language

BlackBerry Released for wordpress with Improved UI and Language
BlackBerry Released for wordpress with Improved UI and Language

More information you will found on following site

http://blackberry.wordpress.org/

You will got the following language support.

The app now supports the following languages:
English
Italian
Finnish [Thanks Apuasi]
French [Thanks Yann Nave]
Indonesian [Thanks Kate of Pixel Insert]
German [Thanks Frank Wessel]
Portuguese (Portugal) [Thanks José Fontainhas]
Japanese [Thanks Nao]
Spanish [Thanks danivloven]
Colombian Spanish [Thanks Blanca Mancilla]
Polish [Thanks waclawjacek]

With this release they fixed following issues.

  • issue when modifying the properties of a picture attached to a post
  • startup issue on the splash screen that causing the app freezing
  • issue on the Stats view when a post title contains more double quote characters

You will find the following new Features.

  • Easier sign in process
  • Added support for HTTP authentication on password-protected self-hosted blogs
  • Improved the app’s ability for bug reporting and feedback
  • The file browser now remember the last opened folder

WordPress for BlackBerry 1.4 Released

Posted on 3 Aug 10 by Danilo Ercoli
 

WordPress for BlackBerry version 1.4 has been released to BlackBerry App World. Depending on your region or country, you might not see the latest version in the BlackBerry App World, but on your device you should now already see the latest version 1.4.   The following features have been added in version 1.4:

    • Easier sign in process

 

  • Added support for HTTP authentication on password-protected self-hosted blogs

 

 

  • Improved the app’s ability for bug reporting and feedback

 

 

  • The file browser now remember the last opened folder

 

 

This release contains many bug fixes, including:

    • issue when modifying the properties of a picture attached to a post

 

  • startup issue on the splash screen that causing the app freezing

 

 

  • issue on the Stats view when a post title contains more double quote characters

 

 

The app now supports the following languages:
English
Italian
Finnish [Thanks Apuasi]
French [Thanks Yann Nave]
Indonesian [Thanks Kate of Pixel Insert]
German [Thanks Frank Wessel]
Portuguese (Portugal) [Thanks José Fontainhas]
Japanese [Thanks Nao]
Spanish [Thanks danivloven]
Colombian Spanish [Thanks Blanca Mancilla]
Polish [Thanks waclawjacek]

wordpress comments captcha plugin

we got around 4000 spam comments daily. Spam comments are increasing daily. when we fed-up these comments, we deiced to use the Akismet plugin. That is not enough. So Here is a list of unique and best wordpress comments captcha plugin

wordpress comments captcha plugin

wordpress comments captcha plugin
wordpress comments captcha plugin

I recomend to use the capcha plugin for protecting from spam comments. I like the wp-recaptcha wordpress plugin and I recommend to use that plugin.

Here are some very nice wordpress capcha plugins for wordpress comments.

WP-reCAPTCHA

reCAPTCHA is an anti-spam method originating from Carnegie Mellon University which uses CAPTCHAs in a genius way. Instead of randomly generating useless characters which users grow tired of continuosly typing in, risking the possibility that spammers will eventually write sophisticated spam bots which use OCR libraries to read the characters, reCAPTCHA uses a different approach.

Raz-Captcha

Prevent registration spam and bots login by adding custom captcha tests in the registration page and/or login page

Featuring 5 different and customizable captcha algorithms with possibility to set your own random characters font, styles, colors background and more
For a working demo se login and register pages from the author home page

Simple CAPTCHA

A CAPTCHA for your comment system to prevent unwanted spams. Prevent automated spams by bots and most important naughty peoples. It’s simple and yet secure.

WP Captcha-Free

WP Captcha-Free blocks automated comment spam without resorting to CAPTCHAs. It does so by validating a hash based on time (and some other parameters) using AJAX when the form is posted. Comments posted via automated means will not have a hash or will have an expired hash and will be rejected. Unlike using a captcha, this does not place any burden on the commenter.

CAPTCHA-Godfather

This plug-in protects the form for posting comments from spam by 4 ways; CAPTCHA code, Session ID (which is different from PHPSESSID), Timestamp, IP Address. Also allows the webmaster to choose between fonts.

Security Captcha

Prevent registration spam and bots login by adding custom captcha tests in the registration page and/or login page

SI CAPTCHA Anti-Spam

Adds CAPTCHA anti-spam methods to WordPress on the comment form, registration form, login, or all. In order to post comments or register, users will have to type in the code shown on the image. This prevents spam from automated bots. Adds security. Works great with Akismet. Also is fully WP, WPMU, and BuddyPress compatible.

how to insert php code in wordpress post

Some time we need to execute and use the php code in wordpress post and page. There is solution for inserting the php code in to wordpress post.

how to insert php code in wordpress post.

 

how to insert php code in wordpress post
how to insert php code in wordpress post

I found very useful wordpress plugin for that. But my advise is don’t use this plugin ever try to put your php code as possible in wordpress theme.

Exec-PHP

The Exec-PHP plugin executes PHP code in posts, pages and text widgets.

Features:

  • Executes PHP code in the excerpt and the content portion of your posts and pages
  • Configurable execution of PHP code in text widgets (for WordPress 2.2 or higher)
  • Write PHP code in familiar syntax, eg. php ... ?>
  • Works in your newsfeeds
  • Information about which users are allowed to execute PHP with the current security settings (for WordPress 2.1 or higher)
  • Configurable user warnings for inappropriate blog and user settings (for WordPress 2.1 or higher)
  • Restrict execution of PHP code in posts and pages to certain users by using roles and capabilities
  • Update notifications through the ‘Plugins’ menu in WordPress if a new version of the Exec-PHP plugin is available (for WordPress 2.3 or higher)
  • Internationalization support (english and german included, many more available)
  • Comes with documentation

Inline PHP

The plugin can execute php string in posts/pages, and display the output as the contents of posts/pages. Just quote what you want to execute in <exec>...</exec> or [exec]...[/exec] tag.

You can put the php code in post following way.

       $filestr = file_get_contents('http://www.seocompany.ca/pagerank/page-rank-update-list.html');
       if (preg_match('/</pre>
.*<\/p>/ums', $filestr, $matches)){
           echo str_replace("

<a href="\&quot;#page-rank-update-list-history\&quot;">Top of Page Rank Update List History</a>
<pre>", "", str_replace("", "", $matches[0]));
       }
   

code syntax highlighter through wordpress plugins

When ever we write some code in post. That code need to visible very easily. Here are some code syntax highlighter through wordpress plugins which will be useful for developers and coders. There are some useful wordpress plugins for highlighting the code in wordpress post.

code syntax highlighter through wordpress plugins
code syntax highlighter through wordpress plugins

 

code syntax highlighter through wordpress plugins

While WordPress.com doesn’t allow you to use potentially dangerous code on your blog, there is a way to post source code for viewing. We have created a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:

To accomplish the above, just wrap your code in these tags:

 your code here
 

The language parameter controls how the code is syntax highlighted. The following languages are supported:

  • actionscript3
  • bash
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • erlang
  • fsharp
  • diff
  • groovy
  • javascript
  • java
  • javafx
  • matlab (keywords only)
  • objc
  • perl
  • php
  • text
  • powershell
  • python
  • ruby
  • scala
  • sql
  • vb
  • xml

If the language parameter is not set, it will default to “text” (no syntax highlighting).

Code in between the source code tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

There are some free plugins also helpful for syntax highlighting.  I specially like the SyntaxHighlighter Evolved wordpress plugin. SyntaxHighlighter Evolved allows you to easily post syntax-highlighted code to your site without loosing it’s formatting or making any manual changes.

You can download this plugin form here:

SyntaxHighlighter Evolved

There is another plugin for syntax highlighting which also really nice.

WP-Syntax provides clean syntax highlighting using GeSHi — supporting a wide range of popular languages. It supports highlighting with or without line numbers and maintains formatting while copying snippets of code from the browser.

It avoids conflicts with other 3rd party plugins by running an early pre-filter and a late post-filter that substitutes and pulls the code snippets out first and then pushes them back in with highlighting at the end. The result is source code formatted and highlighted the way you intended.

You can download the this from here:

WP-Syntax

How to Optimize Your WordPress Database using plugin

When we are using the wordpress sites then we need to clean the database always. If your site is having more than 500 articles then you need to worry about server performance.

How to Optimize Your WordPress Database using plugin

Mysql load will impact your server.  Many people are suggesting to use the WP-DBManager wordpress plugin. But forgot about plugin feature. That plugin specially made for database backup and managing the tables.

If you want to optimize your wordpress database then you need to use wp-optimize wordpress plugin. I found that is only plugin is helpful for really keep optimize your wordpress database.

I used that plugin. Before using that plugin my mysql database size was 135mb. After using that wp-optimize plugin features database size was 4mb. That means my database really optimized. My sites performance was also improved.

I really liked this wordpress plugin. Thanks to Ruhani Rabin who wrote this plugin.

How to Optimize Your WordPress Database using plugin
How to Optimize Your WordPress Database using plugin

You can download this plugin from here:

http://wordpress.org/extend/plugins/wp-optimize/

Simple but effective plugin allows you to extensively clean up your WordPress database and optimize it without doing manual queries.

What is features of wp-optimize?

  • Enable/Disable trackbacks for all published post
  • Enable/Disable comments for all published post
  • Removal of stale post revisions
  • Removal of stale unapproved and spam comments
  • Removal of trashed comments
  • Removal of akismet metadata from comments
  • Removal of other stale metadata from comments
  • Mobile device friendly, now you can optimize your site on the go
  • Removal of all trackbacks and pingbacks
  • Cleaning up auto draft posts
  • Removal of transient options
  • Clear out the post trash
  • Automatic cleanup of all the integrated options (also uses retention if enabled)
  • Ability to keep selected number of weeks data when cleaning up
  • Option to add or remove link on wp admin bar.
  • Enable/Disable weekly schedules of optimization
  • Apply native WordPress MySql optimize commands on your database tables without phpMyAdmin or any manual query.
  • Display Database table statistics. Shows how much space can be optimized and how much space has been cleared.
  • Enabled for Administrators only.

Every-time you save a new post or pages, WordPress creates a revision of that post or page. If you edit a post 6 times you might have 5 copy of that post as revisions. Imagine if your post or pages are long and big. It is a huge number of bytes that’s on your MySQL overhead. Now WP-Optimize allows you to optimize and shrink your posts table by removing not necessary post revisions from the database. As example, if you have a post which is approximately 100KB data and you have 5 revisions of that post, the total space wasted is about 500KB. And if you have 100 posts similar to it, you have 50MB database space wasted.

Restrict the Adults on wordpress website

Restrict the Adults on wordpress website, Many times you website content is not suitable for all the age group. There is very nice wordpress free plugin available.

Restrict the Adults on wordpress website

Restricted to Adults

There’s a lot of content which isn’t appropriate for all ages. The [Association of Sites Advocating Child Protection (ASACP)](http://www.asacp.org/ “ASACP) has developed the Restricted to Adults (RTA) tag which most online protection software respects.

Restrict the Adults on wordpress website
Restrict the Adults on wordpress website

Installing the RTA tag on a WordPress install can be somewhat complicated, so the Restricted to Adults plugin makes it one click — activate the plugin and your site is restricted to adults.