C# .NET SSO Convert to PHP : UrlTokenDecode(), UrlTokenEncode(), PBKDF2

While implementing Absorb SSO into a Drupal CANVAS site, I needed to generate a key from a URL $_GET token variable which is generated by Absorb's proprietary SSO. When a user is directed to https://yourabsorbsite.myabsorb.com/account/externallogin, Absorb sends them back to your standard domain with a login token. For example, https://mydomain.com?token=MqsXexqpYRUNAH...

The documentation only showed how to accomplish this C#.

C# example

string idAndKey = "bob@company.com" + "7MpszrQpO95p7H";

Override Field Value in Drupal Views Attachment using hook_views_pre_render()

Overriding views data can typically be accomplished using the commonly used hook_preprocess_views_view(&$vars) hook. However, I ran into a situation where I was unable to override field data using the preprocess hook. While building a view to show a list of products within certain categories, I added an attachment view which rendered the taxonomy name and description. The client wanted to taxonomy name on one page to be different than the actual taxonomy name.

Simple and Cool jQuery CAPTCHA Plugin - Real Person

Simply create a form as you normally would and include a text field to use for the real person verification. In this example, my field would have a class of "your-captcha".

<script type="text/javascript">
$(function() {
	$('input.your-captcha').realperson();
});
</script>

So after you have the front-end working, we need to verify that the code entered was correct. Use this:

Vertically Align an Element with CSS : vertical-align behavior

A while back, i posted an article on vertical alignment of an element using jquery - Vertically Align an Element with jQuery - Vertical Align an Anchor or Div. However, this is not always the best solution if you are applying the vertical alignment on standard content. A quick and compliant way to apply vertical-align to an element:

Firebug Extension for AJAX Development

FirePHP enables you to log to your Firebug Console using a simple PHP method call. All data is sent via response headers and will not interfere with the content on your page.

FirePHP is ideally suited for AJAX development where clean JSON and XML responses are required.

http://www.firephp.org

Post to Facebook Wall/Timeline with the Facebook PHP SDK

<?php
 
 require_once '../facebook/facebook_sdk/src/facebook.php';
 
// configuration
 $appid = [APP ID];
 $appsecret = [SECRET APP KEY];
 $msg = 'Some message would go here.';
 $title = 'Some title would go here';
 $uri = 'http://nathanbolin.com';
 $desc = 'Some detailed message that shows beneath the title.

Drupal 7 Custom Views Layout - theme_preprocess_views_view_fields()

function NAME-OF-THEME_preprocess_views_view_fields(&$vars, $hook){
 
// machine name of view
if ($vars['view']->name == 'homepage_slideshow') {
 
    // add a wrapper before a certain field
    $vars['fields']['field_slide_image']->wrapper_prefix = '<div class="slideshow-content-wrapper-left">' .

Resize Image and Maintain Aspect Ratio with jQuery

// IMAGE MANIPULATION and MAINTAIN ASPECT RATIO
function resizeImageWithAspectRatio(img) {
	var maxWidth = 250; // Max width for the image
	var maxHeight = 75;    // Max height for the image
	var ratio = 0;  // Used for aspect ratio
	var width = img.width();    // Current image width
	var height = img.height();  // Current image height
 
	// Check if the current width is larger than the max
	if(width > maxWidth){
		ratio = maxWidth / width;   // get ratio for scaling image
		img.css("width", maxWidth); // Set new width
		img.css("height", height * ratio);  // Scale h

Configure LAMP Server for Drupal 7 and Migrate Development Site - No GUI, command line only

To start with, I created a tarball with bz2 compression of the dev site. Make sure to explicitly include .htaccess because the tar command, like the ls command does not include filenames with "." as the first character. Navigate to the root of your site and execute the following (-c create | -v verbose (lists files as it goes) | -j bz2 compression | -f file):

tar -cvjf nameofsite_date_of_copy.tar.bz2 * .htaccess

Also, you will need the mysqldump

Custom Drupal Views and Fields using hook_views_api() and hook_views_data()

Create a custom module to use a database table for a view.

Replace MODULENAME with the name of your module and TABLENAME with the name of your table.

Syndicate content