Skip to main content

Posts

Get Google Calendar Event List in WordPress

<a href="https://console.cloud.google.com/apis/credentials">Get Your Api Credentials Here</a> <a href="https://calendar.google.com/calendar">Get your Calender ID</a> <?php include_once("wp-load.php"); function  get_calender_events() { $params = array(); /*Get current date*/ $current_date  = date('Y-m-d H:i:s'); /*Convert it to google calendar's rfc_format */ $rfc_format = date("c", strtotime($current_date)); $params[] = 'orderBy=startTime'; $params[] ='maxResults=100'; $params[] = 'timeMin='.urlencode($rfc_format); $url_param = ''; foreach($params as $param) { $url_param.= '&'.$param; } $calender_id = "calender_id"; $client_key =  "client_key"; $url = "https://www.googleapis.com/calendar/v3/calendars/".$calender_id."/events?key=".$client_key."&singleEvents=true".$url_param; $list_events = wp_remote_post($url, ...

Hide admin menu in WP

function remove_menus() {     global $menu;     global $current_user; $author = wp_get_current_user(); if(isset($author->roles[0])){     $current_role = $author->roles[0]; }else{     $current_role = 'no_role'; } if($current_role != 'administrator'){      ?>    <style>                 #wp-admin-bar-new-content, #wp-admin-bar-updates, .ab-item , #wp-admin-bar-comments , .update-nag{             display:none;         }         </style> <?php         $restricted = array( __('Dashboard'),                             _...

CSV file generate

<?php // Database Connection $host="localhost"; $uname="root"; $pass=""; $database = "samrat"; $connection=mysql_connect($host,$uname,$pass); echo mysql_error(); //or die("Database Connection Failed"); $selectdb=mysql_select_db($database) or die("Database could not be selected"); $result=mysql_select_db($database) or die("database cannot be selected <br>"); // Fetch Record from Database $query="SELECT jos_users.email,jos_users.name,jos_vm_user_info.first_name,jos_vm_user_info.last_name,jos_vm_user_info.middle_name,jos_vm_user_info.phone_1,jos_vm_user_info.phone_2,jos_vm_user_info.address_1,jos_vm_user_info.city,jos_vm_user_info.state,jos_vm_user_info.country,jos_vm_user_info.zip FROM jos_users LEFT JOIN jos_vm_user_info ON jos_users.id = jos_vm_user_info.user_id"; $query="SELECT jos_users.email,jos_users.name,jos_vm_user_info.first_name,jos_vm_user_info.last_name,jos_vm_user_info.mid...

Add Event on google calendar

******************************************** <!DOCTYPE html> <!-- ***********  GOOGLE CALENDAR  *************************** https://console.developers.google.com/project/feisty-filament-107711/apiui/apiview/calendar/quotas --> <html>     <head>         <title>GOOGLE CALENDAR - insert, change and delete Google Calenda event</title>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <meta charset="UTF-8">         <style>             body{                 margin: 0;                 width: 100%;        ...

change all customer password in magento by code

Curn_customer .php <?php ini_set('max_execution_time', 3000); require_once('app/Mage.php'); //Path to Magento umask(0); Mage::app(); function getcustomers() {  /* Get customer model, run a query */  $collection = Mage::getModel('customer/customer')       ->getCollection()       ->addAttributeToSelect('*');  $result = array();  foreach ($collection as $customer) {   $result[] = $customer->toArray();  }  return $result; } //7917$result = getcustomers(); for ($x = 7721; $x <= 7917; $x++) { echo $customerid = $x; echo "<br>"; $newpassword = "catwalkhairextensions"; $customer = Mage::getModel('customer/customer')->load($customerid); $customer->setPassword($newpassword); $customer->save();  } ?>

Add plugin in WP with DB

<?php /*   Plugin Name: Samrat Test   Plugin URI: http://samratparida.blogspot.in/   Description: This plugin provides custom login and managing people and private profiles   Version: 1.0   Author: Samrat   Author URI: http://samratparida.blogspot.in/  */  global $jal_db_version; $jal_db_version = '1.0'; function jal_install() {  global $wpdb;  global $jal_db_version;  $table_name = $wpdb->prefix . 'Samrat';  $charset_collate = $wpdb->get_charset_collate();  $sql = "CREATE TABLE $table_name (   id mediumint(9) NOT NULL AUTO_INCREMENT,   time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,   name tinytext NOT NULL,   text text NOT NULL,   url varchar(55) DEFAULT '' NOT NULL,   UNIQUE KEY id (id)  ) $charset_collate;";  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );  dbDelta( $sql );  add_option( 'jal_db_version', $j...

Plugin in WP

<?php /*   Plugin Name: Custom Profile   Plugin URI: http://samratparida.blogspot.in/   Description: This plugin provides custom login and managing people and private profiles   Version: 1.0   Author: Samrat   Author URI: http://samratparida.blogspot.in/  */ //Plugin in WP global $table_name, $private_table, $user_tracking, $wpdb, $current_user; $table_name = $wpdb->prefix . "tmp_users"; $private_table = $wpdb->prefix . "private_group"; $user_tracking = $wpdb->prefix . "user_tracking"; define('CP_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))); require_once( ABSPATH . 'wp-includes/class-phpass.php'); /* * **********************************************************************************  * Hooks to fire when plugin is activated  * ************************************************************************************ */ register_activation_hook(__FILE__, 'ez_private_group'); register_activ...