Currently, I just have a handful of features and some views, but this is built upon years of work with small businesses and seeing what works. I’ve also got some basic integration for Buffer to allow time release of posts into your social streams.
I’ve got some ideas on how to use different levels of attention (regular, featured, sticky) in layers to organically create more or less emphasis on the content you want your site identified with. For example – if your website is trying to rank for “Custom Websites” and “Business Websites”, then items that are related to those topics should have a greater prominence on the site. In other words, there should be more links to those pages and they should be at the top of your lists more of the time.
The goal is a highly functional but simple system that does most of the work for you. Currently I have wrapped the blog portion, gallery, UX updates and some base configuration stuff to put it together. Expect to see this in Github within a few weeks.
Drupal Facebook Comments
One of the nifty widgets that Facebook offers is the ability to use their auth service to leave comments on your website. The integration into your site is relatively simple.
In the past I have sometimes added a custom block and pasted in the code to embed the widget. The problem with this approach is that this will just add comments for a single URL (like your entire site) as opposed to a single page. You can use the php filter to replace the URL in the widget code with the current page… but using the php filter is bad form. So, you are left with the option of creating a module or adding the code to a block in a module. Not too big a deal
Not all cool modules are on Drupal.org!
Recently, while doing a search for a Drupal module to integrate comments (because you never know!), I stumbled on a Beacon 9 blog post which shared their Drupal 7 Facebook Comments module. Its a simple module with some nice admin settings… handy!
One thing to note – this module actually relies on the core comment module. It replaces the comment form with the Facebook Comment form on the selected content types (you can select which ones in the admin UI)… and as an added bonus, it actually records the # of comments per node. Thats not a ton of info, but can be handy in views.
Of course, you could easily modify the module to NOT require the core comment module, or to work along side it, or as an alternate tab, etc… lots of options. But, its pretty cool that they have posted this out for people to use. So – thanks to Beacon 9 for their fine work, and remember – you can find good code even outside of the “official” contrib.
Nifty function : module_load_include()
So I ran across this nifty function, and I was once again blown away by how little things like this in the Drupal API can really make your life easier… if you know about them
Disclaimer – yes, this has been available since D6… I’m late to the party…
Ok, so what this little gem does is simply load a modules include file in php. Simple. So why is this so cool? Because – you don’t have to know where the file is located in the system to make it work! And if the file moves later, you are still golden.
So when might you use it? Well, for starters you might need to load up something like node.pages.inc or something if you are early in the stack OR on a PHP page that doesn’t have the full system loaded. You may also want to check if a function is loaded, and then load the necessary include IF its not.
This is a fun idea – what about loading a different include file if the user is anon or auth… or an admin… or a content creator/editor/etc. A simple IF statement or switch can let you load up completely different batches of code… without having to load them all. This would be especially handy if you wanted to have multiple versions of the same function.
Now, I am sure that some of these ideas are way less than ideal… and perhaps a bit too crazy for practical use. Still, this function does deserve a place in your DAK (drupal army knife)… and the fact that its still around in D8 means that I’m not the only one who thinks that.
Drupal Devel – dpm() bork… and the No Devel module.
I got a message from a client that some admin portions of their site were failing to come up. This is a Drupal 7 multi-site install, with a pseudo-sandbox for playing/testing (different database but same codebase). This client was in China, so his daytime is literally my night! He spent several hours trying to figure out the problem… and it was such a little thing.
Devel was turned off, but an errant dpm() function was active.
Turns out that one of the modules active on both the sandbox and the live had a dpm() function for debugging, and the live site didn’t have the Devel module running. For those who don’t know, devel is a super handy module that helps with development (go figure), and in this case the dpm() function was outputting an object in the code so we could easily see what was in it and how our function needed to interact with it.
However, when the devel module is NOT on, there is NO dpm() function, and so you can seemingly bork your site (depending on where/how the function is being called). In this case, it was just on a handful of admin pages, so the damage was minimal. However, in the wrong place… this could possible take down a site.
Normally, we don’t have these floating about and they should be removed as soon as they are not needed… but, stuff happens and sometimes one or two may end up slipping through the cracks (like now). Worse, the code could exist on a live site (or be shared like here) OR be migrated over to the live site unknowingly. Not so good.