Wednesday, 8 January 2014

Uncaught TypeError: Object [object Object] has no method 'live'

Uncaught TypeError: Object [object Object] has no method 'live'
.live() is a deprecated function (from 1.7+) and removed completely from jQuery 1.9+.

You can instead use .on() or .bind() methods:

http://api.jquery.com/on/
http://api.jquery.com/bind/

Tuesday, 7 January 2014

Parent child relationship mysql query

Create table like this :-

CREATE TABLE `nodeslist` (
  `NodeID` mediumint(9) NOT NULL AUTO_INCREMENT,
  `NodeTypeID` tinyint(3) unsigned NOT NULL,
  `NodeCode` char(20) NOT NULL,
  `NodeLocationName` char(75) NOT NULL,
  PRIMARY KEY (`NodeID`),
) ;

Here this query to select tree struture data :-

 SELECT
    p.NodeID as parent_id,
    c1.NodeID as child_id_1,
    c1.ParentNode as parent_id_1,
    c2.NodeID as child_id_2,
    c2.ParentNode as parent_id_2,
    c3.NodeID as child_id_3,
    c3.ParentNode as parent_id_3
FROM
    nodeslist p
LEFT JOIN nodeslist c1
    ON c1.ParentNode = p.NodeID
LEFT JOIN nodeslist c2
    ON c2.ParentNode = c1.NodeID
LEFT JOIN nodeslist c3
    ON c3.ParentNode = c2.NodeID
WHERE
    p.ParentNode=0;

Select all child and subchild for particular Parent ID:-

SELECT NodeID,ParentNode,NodeTypeID
FROM nodeslist
WHERE NodeID = 1
OR ParentNode = 1
OR ParentNode IN (SELECT NodeID
    FROM nodeslist
    WHERE ParentNode = 1 OR
    ParentNode IN (SELECT NodeID
    FROM nodeslist
    WHERE ParentNode = 1)

  );

Wednesday, 27 November 2013

My client isn't accepting my username and password for SMTP emails

We suggest making some adjustments in your mail client's settings so you aren't always prompted to enter your username and password. Please check the following settings in your mail client:
  • Make sure that you've entered your full email address (e.g. username@gmail.com)
  • Re-enter your password to ensure that it's correct. Keep in mind that passwords are case-sensitive.
  • Make sure your mail client isn't set to check for new mail too often. If your mail client checks for new messages more than once every 10 minutes, your client might repeatedly request your username and password.
Now, please follow the steps below to resolve the problem:
  1. Open your web browser and sign in to Gmail at http://mail.google.com/mail. If you see a word verification request, type the letters in the distorted picture and finish signing in.
  2. Close your browser and try accessing your messages in your email client again.
  3. If you're still having problems, visit http://www.google.com/accounts/DisplayUnlockCaptcha and sign in with your Gmail username and password. If necessary, enter the letters in the distorted picture.
  4. Click Continue.
  5. Restart your mail client and try accessing messages in your email client again.

Remove Wordpress Logo in Admin Bar

Add following code in your themes function.php
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );

function remove_wp_logo( $wp_admin_bar ) {
	$wp_admin_bar->remove_node( 'wp-logo' );
}

Add Custom Logo in Wordpress

1)Add following function in your themes function.php
2)upload customlogo.png image in your themes image folder
function custom_login_logo() {
	echo '';
}
add_action('login_head', 'custom_login_logo');

Hide / Remove Menu and SubMenu in wordpress Admin Panel

Remove a top level admin menu.
remove_menu_page( $menu_slug )
Here menu_slug has menu's slugname or page


Remove an admin submenu.
remove_submenu_page( $menu_slug, $submenu_slug )

Use following php code for theme's function.php
Ex:- for slug name
add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() {
  $page =remove_menu_page( 'plugins' );
  $page = remove_submenu_page( 'themes', 'widgets' ); // widget page under themes
}
Ex:- for filename/page
add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() {
  $page =remove_menu_page( 'plugins.php' );  
  $page = remove_submenu_page( 'themes.php', 'widgets' ); // widget page under themes
}

Wednesday, 30 October 2013

Moodle course list in every where for custom php

You can copy & paste following php code for every where
 
$con = mysql_connect("hostname","username","password");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("moodledatabase", $con) or die(mysql_error());
$query_course_list = "SELECT c.id AS courseid, c.fullname FROM mdl_course c where category != 0";
$courses = mysql_query($query_course_list);
$output = '';
echo $output;