Monday 29 June 2015

Yii 2 - Unable to find 'console\controllers\RbacController, RBAC yii rbac/init

I have installed the very latest version of Yii 2.0.4, and while using the Advanced Template with RBAC i got the below issue while running the command yii rbac/init



Exception 'yii\base\UnknownClassException' with message 
'Unable to find 'console\controllers\RbacController' 
in file: /var/www/yii/console/controllers/RbacController.php. Namespace missing?'


To overcome this simply edit the "namespace console\commands;" as   "namespace console\controllers;" in RbacController.php

RbacController - will be inside the console/controllers folder.

Once we set all correctly run yii rbac/init then we will get the values automatically in our migrated tables auth_item and auth_item_child




Wednesday 4 March 2015

Wordpress Year Pagination.

We have used Page No pagination in WordPress like

[15] [14] [13] ... [1]

Likewise we can create the Year pagination for our archive post. OK use the below code to simply past in your archive list area under the pagination part.


<?php
$current_year= date('Y'); // this will the current year
$archive_year = get_the_time('Y'); // this will get the year of the archive list
$starting_year= "2006"; // this will be our starting year
?>

<ul class="SOME CLASS">
<?php if($archive_year < $current_year ) { ?>
<li><a href="<?php echo get_year_link( $archive_year+1 ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year == $current_year ) { ?>
<li><a href="<?php echo get_year_link( $archive_year ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<li class="SOME CLASS FOR DIVIDER"></li>
<?php

for($i=date('Y'); $i>2005; $i--) {
$diff= $i-$archive_year;
if($diff>2&&$diff<4)
{
echo '<li><a href='.get_year_link( $current_year ).'>'.$current_year.'</a></li>';
echo '<li><a class="SOME CLASS">…</a></li>';
}

if($diff>-3&&$diff<3)
{
if ($i == $archive_year) {
echo '<li class="active"><a href='.get_year_link( $i ).'>'.$archive_year.'</a></li>';
}
else {
echo '<li><a href='.get_year_link( $i ).'>'.$i.'</a></li>';
}
}

if($diff>-4&&$diff<-2)
{
echo '<li><a class="SOME CLASS">…</a></li>';
echo '<li><a href='.get_year_link( $starting_year ).'>'.$starting_year.'</a></li>';
}
}
?>
<li class="SOME CLASS FOR DIVIDER"></li>
<?php if($archive_year <= $current_year && $archive_year > '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year-1 ); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year == $current_year && $archive_year == '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
<?php if($archive_year != $current_year && $archive_year == '2006') { ?>
<li><a href="<?php echo get_year_link( $archive_year); ?>"><i class="SOME CLASS"></i></a></li>
<?php } ?>
</ul>


So the above will output like below


Thursday 5 February 2015

Simple Mobile number subscription plugin Wordpress, Wordpress Mobile number subscription plugin

Simple Mobile number subscription plugin

== Description ==

This plugin will be handy for your users to add their numbers in your site, and you can use this plugin for your whatsapp subscription list

A few notes about the sections above:

*   Shortcode for widget
*   Admin can able to add, edit, delete the mobile number
*   "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on
higher versions... this is just the highest one you've verified.

== Installation ==

1. Upload `whatsapp-subscription` to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress



This is the shortcode that we need to use [ADD-SUBSCRIPTION-WHATSAPP]



Use this Wordpress Simple plugin: https://wordpress.org/plugins/whatsapp-subscription/




Tuesday 3 February 2015

Avoid Custom Codes in WordPress Core files



WordPress is the best blogger CMS open source, as well as hack-able one. So we need to keep updating everything regularly.

Themes
Plugins
WordPress version



WordPress version update comes with Manual update as well as One click update from the dashboard. But if you made any custom codes inside wp-admin/ or wp-includes folders, then it will be replaced and we will lose our files, functions etc.

So Always don't edit any core files of WordPress


as well as don't update any raw files inside wp-content/themes or wp-cotent/plugins, if you edit any WordPress themes then it will be big head ache as well as we need to be stay in the old version if we need our site in the same format, if you did any edits in the theme files and updating the version then we will entirely loose the site design, functions etc.

So always create a Child theme and put your edited files there


If we are following this formats, then by a single click we can update our versions, and our site will be get secured.



Sunday 1 February 2015

Whatsapp for sharing your Posts, Whatsapp PHP API for Wordpress, Whatsapp for Wordpress

We can see many sharing services like Addthis, Sharethis have already integrated the Whatsapp sharing services in their stream.


But it wont work in the Desktop version, as Whatsapp will work in latest Iphone and Chrome version. May be in the future days they will set the API for web sharing, but for now there is no such options in Whatsapp as well as in other Social Sharing Sites.

Ok, but we can do the sharing. Please refer this https://github.com/venomous0x/WhatsAPI, they are having the API to send the Whatsapp message from a mobile to other mobile.

Ok, here is the steps to set your API:


  • First we need to register our Mobile number with WART (https://github.com/shirioko/WhatsAPI/wiki/WhatsApp-Registration-Flow), check this site.


  • Once you register you will get a SMS code confirmation


  • We need to set the Code confirmation again in the same registration form and once set we will get the below 


  • Username
  • Password
  • Identity
         and this is what we need for the API



Please set the credentials inside the exampleFunctional.php file, and set the [$target] target mobile number to which you want to send your blog titles/ URLs.

The target numbers will get the Whatsapp Message from our WART registered Mobile number.


This Github URL is providing all the variables set for Whatsapp API from venomous0x
https://github.com/shirioko/WhatsAPI/wiki/WhatsApi-events

--------------------------------------------------------------------------------------------------------------------

We can use this API and integrate with our Blogger or Wordpress sites, we can set some AUTO system and send the messages to the Subscribed mobile numbers once we post a new articles in our site.


YES WHATSAPP IS WORKING.


--------------------------------------------------------------------------------------------------------------------

Why Whatsapp is not working in my ADDTHIS share code?

That is because it will be get worked inside the mobile device only with latest OS and CHROME versions. Also while referred to different forums, it is detailed that it will get worked in the latest Iphone devices.

If we run the Addthis - Whatsapp share inside the desktop version we will get the below link and it wont get worked

http://whatsapp//send?text=***************************************




Happy coding...