Dynamically creating views in Drupal

The Views module can be broken down into three main parts: the query builder, the display builder and the user interface. Usually, we use the interface to control the other two parts, but sometimes situations call for query and display logic that the interface cannot provide.
A good introduction to dynamic views is the function views_embed_view(). [...]

Continue Reading...

Use the output buffer to debug a SOAP server

I’m working on a Quickbooks module for Drupal Ubercart. By implementing a SOAP server, it is possible to allow the Quickbooks Web Connector (QWC) to pull down XML snippets representing store information. We’re using the SOAP server module for Drupal, which extends services.
Quickbooks is the event horizon – you have know idea what it does with [...]

Continue Reading...

Figuring out the Facebook API

A lot has been said about Facebook’s service oriented API, most of it bad. Recently I used the PHP Facebook SDK to make an app that gathers Facebook photos from users who want to make an online collage. The project is scrapwalls.com, and the Facebook import feature is now live. Anyway, I didn’t think the [...]

Continue Reading...

JSON output from Javascript

Have you ever wished that html forms could send more than just key value pairs to the server? While working with the Facebook API, I found that I needed to send an array of objects back to the server for processing when the user submits the form. JSON was the ideal solution, but I soon [...]

Continue Reading...

HTML playground for drupal

Recently I had to build this. It’s a simple little app that uses the forms API. Think w3schools.com “try it yourself.”

function sg_games_menu(){

 

        $items[‘html-sandbox’] = array(

             ‘title’ => t(‘HTML sandbox’),

             ‘page callback’ => ‘sg_games_html’,

             ‘access arguments’ => array(‘access [...]

Continue Reading...

How to: Force download of links in Magento

It’s an easy fix. I’ll tell you about the hack way to do it, if you like doing it the right way have fun creating 7-8 files.

Continue Reading...

Pseudo Random Algorithm

Ever wanted to program something that looks like a random outcome, but comes out the same way every time based on some kind of input? Here is one way. The modulus (%) operator is the key because it produces an output that seems to vary randomly. I had to implement something like this in Javascript.

function [...]

Continue Reading...

R integration with PHP

Recently, I needed to do some statistical tests on data from within a Drupal Module. Having found no PHP libraries suitable for the task, I decided to try and run code in R from within PHP. This post helped out a great deal.
As far as I can tell, the only way to do this is [...]

Continue Reading...

How to: Make sure Buddypress loads first

Often, it doesn’t matter whether your Buddypress plugin loads before or after Buddypress. However, if you are using groups API, or extending other Buddypress plugins, your class extensions require that Buddypress be loaded beforehand. Functions hooked into actions that occur before Buddypress loads that use Buddypress functions will cause problems as well if the load [...]

Continue Reading...

How to: use email addresses as usernames in Buddypress

Just spent about 5 hours on this one, enjoy …
I’ve seen this question come up on a lot of forums – people want to use email addresses as usernames in Buddypress. It makes sense – emails are easy to remember. But Buddypress has made this difficult to do. Andy Peatling added the following constant to [...]

Continue Reading...