cancel 1and1 Extended PHP Support php4 nag

How to Cancel 1and1’s Extended PHP Support (php 4)

How to Cancel 1and1’s Extended PHP Support (php 4)

About 10 days ago I received a notification that I had to do some changes in my 1and1 control panel.
I was being lazy but started exchanging emails with the support.
At the end I had to go in the control panel and change the php versions to my sites.
I picked php 5.4 for now instead of going straight to php 5.5 or php 5.6

cancel 1and1 Extended PHP Support php4 nag

Steps
1) 1and1 Control Panel | Hosting | Manage Webspace | PHP Settings select your

cancel 1and1 Extended PHP Support php4 select domain

2) Then go to http://cancel.1and1.com/ and look for “1&1 PHP4 Extended Support” which should be at the end.

cancel 1and1 Extended PHP Support php4

Password Protect (Basic Authentication) with Nginx

This code allows me to password protect a site and only allow it to be accessed either by supplying the correct password defined in your.pwd OR if it is called by PayPal. that’s the code I had to use for on the staging environment on one of my products (MiniAds).

location / {
satisfy any;
allow 192.168.1.0/32;
# PayPal servers ; 2014-10-21
allow 66.211.170.66;
allow 216.113.188.202;
allow 216.113.188.203;
allow 216.113.188.204;
deny  all;
auth_basic  "Restricted";
auth_basic_user_file  /var/www/pwd/your.pwd;
index  index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}

test
nginx -t

Rreload configuration
nginx -s reload

 

Related: https://www.paypal-community.com/t5/Merchant-services-Archive/IPN-server-s-ip-s/td-p/126274

How to Delete a WordPress User Using PHP

From time to time when you’re developing plugins/themes you may need to delete some test user accounts. Here is a way to do it.

You can either create an MU Plugin (by creating a file in mu-plugins/some-code.php) or adding it in functions.php in your current (child) theme.

Then go to the admin area. I was receiving errors (function doesn’t exist) when I wasn’t in the admin area.

You have to be careful with this code.

add_action('admin_init', 'abc_quick_del', 10);
// !!!
function abc_quick_del() {
$user = get_user_by( 'login', 'some_username');
if (!empty($user->ID)) {
echo "Deleting user ID: " . $user->ID . "<br/>\n";
wp_delete_user( $user->ID );
} else {
echo "Account not found.";
}
}

 

 

How to Properly Redirect to a New Site using .htaccess

From time to we need to redirect an old site to redirect to a new site.

The good thing about the redirect snippet below is that that it will also append the parameters sent to the old site to the new one.
That is very important especially if you’re running ads or have links that have tracking parameters e.g. oldsite.com/?utm_source=orbisius.com

RewriteEngine On
RewriteCond %{HTTP_HOST} ^youroldsite.com$
RewriteRule ^/?(.+) http://yournewsite.com$1 [R=301,QSA,L]

 

How to Configure php Mail’s Function on Windows with Mandrill

Normally, php mail’s function doesn’t *work* on Windows because there is no sendmail server running by default.

Some people got it working using Fake Sendmail and Stunnel  & an external service such as Gmail/Yahoo, and others using msmtp.

I didn’t want my gmail or other credentials saved on the computer or a too complicated solution that may be hard to troubleshoot so I decided to use the Mandrill service to send emails from my development machine.

So the steps are the following

  1. Download Fake Sendmail
  2. Extract the archive contents in c:\usr\lib
    Important Note: if you’re running Windows 7 or 8 (not sure for Vista) you need to set XP Compatibility Mode. To do that right click on Sendmail.exe and click on properties and then enable XP compatibility mode (shown below).
  3. Edit php.ini (shown below)
  4. Signup for Mandril
  5. Create an API key (which will be your password) by going to Settings
  6. Configure Fake Sendmail (shown below)
  7. Restart Web Server or restart computer if that’s easier.

Enable XP Compatibility Mode on Fake Sendmail

Enable XP Compatibility Mode on Fake Sendmail

php.ini configuration (partial)


Fake Sendmail Configuration (Windows)
Make sure you edit the following.

  • default_domain=YOUR_DOMAIN_GOES_HERE
  • auth_username=YOUR_MANDRIL_EMAIL_GOES_HERE
  • auth_password=YOUR_MANDRIL_API_KEY_GOES_HERE

Note: if you’re configuring your own copy of the config file make sure you don’t use encryption i.e. smtp_ssl=none (as shown in the snippet). I’ve had no problems using the command line scripts, however, the php script would hang if Fake Sendmail used encryption.

Resources

  • http://glob.com.au/sendmail/
  • http://msmtp.sourceforge.net/
  • http://help.mandrill.com/entries/23744737-Where-do-I-find-my-SMTP-credentials-
  • http://help.mandrill.com/entries/21738467-Using-Mandrill-s-SMTP-integration-with-Web-Frameworks
  • http://www.php4every1.com/tutorials/enable-e-mail-in-php-on-windows/
  • http://wiki.uniformserver.com/index.php/Installing_Fake_Sendmail_for_Windows
  • http://stackoverflow.com/questions/21337859/sendmail-wamp-php

 

How to Make an Ajax Request When Twitter Bootstrap Alert is Dismissed

How to Make an Ajax Request when Twitter Bootstrap Alert is Dismissed

Twitter Bootstrap is an awesome CSS framework which speeds the UI development a lot.

I worked on one of my products (qSandbox.com) this weekend. I wanted to notify the user that their account has been upgraded. I wanted the message to be shown in the control panel. That’s in addition to the email confirmation.

I save the user specific message in a folder and if that file exist it is shown to the user.
The message will expire within 24hours but I wanted if the user dismissed the message so it is deleted.
That way the user won’t be bother with the message again.

The project uses Twitter Bootstrap 3.x so I used the dismissible alert which when clicked makes an ajax request to remove the message.

Here is a link to a working demo: https://gist.github.com/lordspace/d950dfbd81b4a7f7213a


Related

  • http://stackoverflow.com/questions/17128665/ajax-request-on-dismissal-of-twitter-bootstrap-alerts

 

 

How to Map an Associative Array to HTML Element (Data) Attributes?

If you’re a developer (you are reading this so you are) you’ve used jQuery to access different elements from a page.

It is super convenient to set data attributes to given HTML elements.
For example:

You can use jQuery to loop through all of the containers with ‘app_container’ class but how are you going to
tell which one you’re currently processing? yes, you can use element’s ID for that but if we want to put more data into that element we can achieve id using data attributes which can be accessed like so:

var id = $(‘app_container’).prop(‘id’);
var type = $(‘app_container’).data(‘type’);

Here is a PHP class that allows you to create HTML attributes from a php array.
If you pass the second parameter the key will be prefixed with ‘data-‘ prefix so they can be access via jQuery later.

Here is a link to the gist: https://gist.github.com/lordspace/fcc733e7e2a53ef427c3

This version of Evernote Web Clipper is no longer compatible with Evernote Service

Today I opened my chrome browser and was greeted by an annoying alert box from Evernote’s Web Clipper Google Chrome Extension.

this version of evernote web clipper is no longer compatible with evernote service

I’ve tried clicking OK and also ticking the “Prevent this page from creating additional dialogs” checkbox but still no success.

I had to simultaneously be pressing ESC key and right clicking on the Web Cliper’s icon.

I created a video how to remove Evernote’s Web Clipper from Chrome while seeing error: “This version of Evernote Web Clipper is no longer compatible with Evernote Service

 

How to Change Your WordPress.org Email and Password

In may be hard to find on WordPress.org the link to edit your email and password.
Normally, you’d expect the edit link on http://profiles.wordpress.org/YOURUSERNAME/ to do that but you have to go to a different location.

  1. Make sure you are logged in.
  2. Then visit link: https://wordpress.org/support/profile/YOURUSERNAME/edit

Video tutorial

Related

http://wordpress.org/support/topic/how-to-change-email-address-for-wordpressorg-user-profile?replies=3