Posts

How to fix Login with Facebook “Error: Can’t Load URL" using hybridauth in CodeIgniter

You can fix Login with Facebook “Error: Can’t Load URL" using hybridauth in CodeIgniter by following steps:
1. Visit "http://developers.facebook.com/apps/" and select the app you wish to fix
2. Switch your Facebook app to "public" or "online
3.Click  "+ Add Product" link from left hand menu
4. Select Web and enter you site url and hit save
5. Click on Settings menu item under Facebook Login
6. Enable "Embedded Browser OAuth Login"
7. Set "Valid OAuth redirect URIs " under Products => Facebook Login tab    Like: https://www.example.com/index.php/hauth/endpoint?hauth.done=Facebook
7. Save your changes
8. Enjoy

Post custom parameters in Ajax using jQuery

Use below code as per your requirement

$.ajax({
url: "text.php",
type: "POST",
data:{ 'campaign_name': cam_name,'contacts_list':'1,2,3','group_list':'11','sms':'Hello World','speech_text':'Hi Anna, Arun this side', },
success: function(data){
alert(data);
},
error: function (jqXHR, textStatus, errorThrown){
alert('Error adding / update data');
}     
});

Redirect http to https in codeigniter

Follow below steps to redirect you non-http site to https without using .htaccess

Change Configuration: go to application/config/config.php and enable hooks to true$config['enable_hooks'] = TRUE; Create new file hooks.php if not exist other wise open file and paste code           $hook['post_controller_constructor'][] = array(                                 'function' => 'redirect_ssl',                                 'filename' => 'ssl.php',                                 'filepath' => 'hooks'                                 ); Now create a new folder hooks if not exist under application folder and then create new file ssl.php and add below code to ssl.php  <?php function redirect_ssl() {     $CI =& get_instance();     $class = $CI->router->fetch_class();     $exclude =  array('client');     if(!in_array($class,$exclude)) {       $CI->config->config['base_url'] = str_replace(…

Remove html5 attribute required

Use this code
$('#exp_date').removeAttr('required');​​​​​or if you want to use in javascript document.querySelector('#exp_date').required =false;

Add custom logo in wordpress login page

Put below code to your active themes functions.php

function wpAdminLoginLogo(){
    $custom_logo_id = get_theme_mod( 'custom_logo' );
    $logo_image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo $logo_image[0];?>);
padding-bottom: 30px;
height: auto !important;
background-size:210px;
width: 100%;
}
</style>
<?php
}
add_action( 'login_enqueue_scripts', 'wpAdminLoginLogo' );

Fatal error: Call to undefined function base_url() in CodeIgniter

You need to load the url helper within controller constructor or  function. $this->load->helper('url');OR
Add below code under application/config/autoload.php that looks like $autoload['helper']= array('url');

Update Custom Order Meta After a Successful Order in WooCommerce

Add this code at the bottom of your theme's functions.php

/* Add Shop Location Meta after order create*/ 
add_action( 'woocommerce_thankyou', 'rb_checkout_save_order_meta'); 
function rb_checkout_save_order_meta( $order_id ) { 
   update_post_meta( $order_id, 'shop_location', 'WW'); 
}