Modifying Drupal 7 User Pictures in code

It took me a while to figure out how to modify or add a user picture from inside a custom module. Google was not much help. So here's the answer I found, hope it helps someone.

First, you need an actual Drupal file object. Something you could reference a file id from. Like $newbieFile->fid.

I referenced modules/user/user.module and includes/file.inc to figure this out.

 by david.reagan on
How to fix Observium when graphs show 'Draw Error'

I've been using Observium at work to collect and graph SNMP logs for a couple years now. A while back the graphs started showing "Draw Error" instead of the actual graph. I poked at it a bit, but never got it fixed. I wasn't too worried since I want to use the ELK Stack for most of what Observium does in the future. Today, though, a coworker came and asked about Observium. So I decided to poke at it some more.

 by david.reagan on
Rise of the Tomb Raider review

# Rise of the Tomb Raider

ESRB Rating: M (Blood and Gore, Intense Violence, Strong Language)

Release Date: November 10, 2015

Platform: Xbox One

Genre: Action/Adventure

Should you get it? Yes.

## Intro

Second in the 2013 reboot, this game follows Lara's journey as she looks for the artifact her father was looking for when he died.

## The good

 by david.reagan on
Checking out the Drupal 8 RC

For the past couple weekends I've spent a few hours seeing if I could build a new personal site using Drupal 8. D8 recently released it's first couple release candidates, and set an official launch date. (November 19, 2015)

So far I've only created the very basics of a site. Nothing worth making public. Of course, I've also spent very little time on the project. That said, here are my initial thoughts.

Installation is just as easy as D7. No changes that I noticed.

 by david.reagan on
Digital Rights Management should be considered actively harmful

Why?

As I'm writing this, Guardians of the Galaxy is pre-ordered on Amazon. When it comes out, I'll get the full movie on a physical Blu-Ray disc. When I stick that disc in my computer's Blu-Ray drive, open up my Blu-Ray player program, and hit play... I'm going to get nothing. The app is going to pop up a message saying that I need to pay more money to upgrade the app so it can get past the DRM on my movie.

That's right, a legitimate customer cannot watch the Blu-Ray he legitimately purchased.

 by david.reagan on
Net Neutrality

Net Neutrality has been something of a major topic in some of the areas of the internet I visit. Unfortunately, I have yet to see anyone truly address the actual cause of the issue.

So, first, what is the issue?

Big internet service providers, currently, can limit the traffic of various companies. So Comcast could force Netflix's traffic to be slow. The ISP's want to take advantage of this, and charge companies like Netflix lots of money to keep their traffic fast.

 by david.reagan on
Review: Microsoft Sculpt Keyboard
A few months ago I bought the Microsoft Sculpt keyboard and mouse. This review is about the keyboard only. I picked up the mouse and immediately knew it wasn't something I wanted to use.
 
 
I don't know a lot about keyboards, so this is entirely subjective.
 
 
To summarize, if you like split keyboards, and like short action on your keypresses, then you will like this keyboard. 
 
 
Pros:
  • It's nice looking. Seriously.
 by david.reagan on
Taxes and Your Fair Share

 

So, there's a lot of people saying that the rich aren't paying enough taxes. That they aren't paying their fair share. The Left successfully villianized Mitt Romney for being rich. The Occupy movement wants the Government to take the rich's money and give it to them. A friend of mine recently posted a status that sounded like he was mad a rich person was looking to move to a place where he wouldn't be taxed so much. On and on it goes...

 by david.reagan on
Updating LDAP Boolean Attributes with PHP

Changing the value of an attribute in an LDAP directory via php generally uses the ldap_mod_replace function. Something like:

$newvals = array('attribute' => 'value);
ldap_mod_replace($ldap_connection, $dn, $newvals);

The problem I ran into was when the attribute was a boolean type. I kept getting:

 ldap_mod_replace(): Modify: Invalid syntax

 by david.reagan on
Follow posts via RSS: