Text

jQuery Masonry, by David DeSandro is an excellent jQuery plugin to enhance the layout of a page.

However, you may find that when using images in the content of the divs you are aligning with Masonry, you may get some overlapping where the script has lodaed before your images.

In order to fire the Masonry script once your images have loaded on the page, use the following code:

$(window).load(function() {
  $('#athediv').masonry({ columnWidth: 200 });
});
Text

Depending on who you want to see the SAEF (Stand Alone Entry Form), you’ll need to assign the relevant weblog to their Member Group.

In my case I have a form that a registered member can submit news to, but it’s not displaying on the front end. In order to correct this, log in to the Expression Engine control panel and go to:

Admin > Members and Groups > Member Groups > Edit Group > Weblog Assignment

Here you’ll have a list of all your weblogs and you can simply select ‘Yes’ for the weblogs you wish to allow a member to add content to.

Hey presto, your form is now visible on the front end and your users can add their content.

Text

Some settings can be an absolute nightmare to find in the Expression Engine Control Panel, and the setting for how often a user can search your site is one of them.

By default, these are the restrictions on the search priveleges for member groups:

  • Admins = No restriction
  • Members = 10 seconds
  • Guests = 15 seconds
  • Pending = 15 seconds
  • Banned = 60 seconds

In order to change these, you’ll need to go to:

Admin > Members and Groups > Member Groups > Edit Group > Search Privileges

There you’ll find ‘Number of seconds between searches’. Change this and the selected user group will then be able to search however many times you want.

Hopefully you can now avoid that awful grey box telling the user “You are only allowed to search every 15 seconds”.

Text

I’m not much of an article writer, especially on opinions, although I did do one a while ago about my iPhone, and there are some rangom things on here. But the majority of stuff I post is intended as a record of things I’ve learnde which may help me again in future, or hopefully benefit others who come across the same development issues. With that said, here I go anyway:

I used my friend Google to search for ‘define:Weblog’. Here’s a selection of the results:

A blog (a contraction of the term weblog) is a type of website, usually maintained by an individual with regular entries of commentary …
A website in the form of an ongoing journal; a blog
a website which contains posts or short dated entries in reverse chronological order.

Not once is it mentioned that a blog is for other people to commment on. And I believe they shouldn’t be. At least not directly.

If you’re writing a blog it’s basically a journal, whatever the subject matter, just one that anyone with access to an internet connection can read. If it was your journal, offline, would you be letting people write their comments on it?

If you want to discuss a topic of your chosing you’d use a forum. The Google results for ‘define:Forum’?

a public meeting or assembly for open discussion
A forum, or message board, is an online discussion site. It is the modern equivalent of a traditional bulletin board, and a technological evolution of the dialup bulletin board system.

If you want a good discussion on any matter, why not use a forum.

If you don’t want this so-called back-patting ‘designer clique’, disable comments on your blog. Sure it won’t stop it totally, but at least you won’t be encouraging it.

People can pat backs all day long by sharing things via social media, just don’t encourage it on your own site.

If people want to comment about your article or article or piece of work, they can do it on their own blog and reference it. At least then they’ll have to put some thought into a response. Which is exactly what you’ll have to do with this one.

Link

A Non-Blog: Weirdness in Expression Engine.

The text should say something like, “xx posts in xx categories have generated xx comments.”

Including the post you’re reading, the weblog called blog (I know, right) has 5 posts, 6 categories, and 22 comments (mind you, this is all in experimental phase right now).

My solution spits out 5…

Text

Many, many times have I had to convert a MySQL timestamp (YYYY-MM-DD HH:MM:SS) into a more human readable format directly from a MySQL query. I’ve always done this with DATE_FORMAT.

Today, however, I needed to do something a little different. A Unix formatted timestamp held in the database needed to be converted to a human readable format.

And this is the answer I came across, the rather useful FROM_UNIXTIME.

Text

I was looking for a way to create a historical log of every member that logged into an ExpressionEngine site. I came across the Statistics module which I was hoping would do the job, but this module only worked to display statistics of users currently logged in to the site, very much akin to what you would see in the footer of a forum.

What I needed to do in this case was to log a timestamp of when a member logged in to the site, and the members ID so that I can pull other data available on that member to generate reports at a later date.

So, first of all I need a new database table to hold this data. It’s very simple, and here’ the SQL I used to create it:

CREATE TABLE `UserLog` (

  `ID` mediumint(9) NOT NULL auto_increment,

  `MemberID` mediumint(9) NOT NULL,

  `LoginTimestamp` int(10) NOT NULL,

  PRIMARY KEY  (`ID`)

)

Now that we have our database table, we need the code to fill it.

The code below was added into the page which the user is redirected to once they have logged in. We need to make sure that this template has ‘Allow PHP?’ is enabled and the ‘PHP Parsing Stage’ is set to ‘Output’ for this to work.

{exp:member:custom_profile_data}

  <?php

    if ({current_time} == {last_activity}){

      global $DB;

      $DB->query('INSERT INTO UserLog (MemberID, LoginTimestamp)

        VALUES ({member_id}, {last_activity})');

    }

  ?>

{/exp:member:custom_profile_data}

There we go, you can copy and paste to your hearts content, but if you’d like to know what’s going on, and perhaps learn a little something, please read on.

Firstly we need to get the {last_activity} timestamp from the member that is logging in. This is basically the most recent time the user has logged in to the site, so we employ the {exp:member:custom_profile_data} tag to let us grab it.

Inside this tag we include our PHP. We compare the {last_activity} timestamp to the {current_time} timestamp. If they match, we know the user has just logged in, and that’s when we want to add a record to our UserLog database table.

We then use the ExpressionEngine database class to insert the {member_id} and {last_activity} timestamp into the table.

So there we have it. You’re now logging every member as they log in to your site. Once you’ve got some data in there you can explore the possibilities of generating reports and statistics on this data. I’ll be doing this myself soon, so I’ll be sure to share my ideas on this.

Link

ExpressionEngine Edit Menu Extension

Extremely useful extension for the ExpressionEngine Control Panel. It adds a drop-down menu to the Edit tab in the same mould as the Publish tab. This will save you a LOT of time when editing content.

Text

It was the best timing possible for me. My Orange contract was up in less than a month, and Apple go and sell their flagship mobile talkie device on a service provider other than O2. Rejoicing occured.

Before jumping ship on my Nokia n95 8GB, I considered the drawbacks;

  • Poor camera in comparison. Ah, I don’t use it that much anyway.
  • Storage limited to iTunes. That 16GB iPhone may be twice the capacity, but I can’t just wang any old files on it. I’ll have to get a passport hard drive for that now.
  • Applications aren’t (neccessarily) free. You could stick pretty much any application on that Nokia. I could even play Secret of Monkey Island!
  • Would the syncing and backup of calendars, emails and texts work as well?
  • Battery life. I got ~5 days from the Nokia. The iPhone is a lot less.

Then there were the advantages;

  • All data included in tariff. Internet anywhere with a signal and nothing extra to pay? Brilliant.
  • Great screen for watching TV and movies. Basically a bundled media player with the phone.
  • Great design, and the touch screen interface. My 3 year old boy can use it to play games on. The interface is so intuitive that he learnt to swipe to a new screen without even being shown.

So after a good few months of use, the things I’ve realised my next iPhone needs, if I’m going to get one, are;

  • I use the camera a lot more than I thought. It needs to be better. A lot better.
  • I don’t mind charging it everyday during the week on my PC, but weekends I can struggle. Longer battery life please. 2 days instead of 1 is all I’m asking.
  • Oh, and a louder speakerphone would be nice.

That’s it. Nothing outrageous. These are all hardware based, for lack of a better word, requests. So, if Apple can do just these 3 things, I may well get the next generation iPhone. Let’s see what they can do.

Disclaimer
This statement will not prevent me from changing my mind in the future if something better comes along. This is a completely personal opinion on the way I use my phone on a daily basis, and what I’m looking for from a mobile phone.

I’m fully aware other people have different requirements from their mobiel phone. They should always choose a phone on their own needs and weigh the pros and cons.

Unless they’re a blindly obedient fanboy.

Text

I’ve been working on a site which users must register to gain access. I’ve removed the need for a user to create a unique username by using their email address for their username. This also removes the need for the email field on the registration form.

However, the screen name, which I’m currently using to welcome the user to the site in a personal fashion, has to also be unique. Luckily the verification for unique screen names can be removed, so John Smith doesn’t have to call himself JSmith79 just to be able to register.

In order to remove the validation you’ll need to:

  1. Go into /system/core/
  2. Open core.validate.php
  3. Find “Is screen name taken?”
  4. Comment out the if statement below there

The resulting code should look like this:

/** --------------------------------

/**  Is screen name taken?

/** --------------------------------

if (strtolower($this->cur_screen_name) !=
strtolower($this->screen_name))

{

  $query = $DB->query("SELECT COUNT(*) AS count FROM exp_members

  WHERE screen_name = '".$DB->escape_str($this->screen_name)."'");

  if ($query->row['count'] > 0)
{ $this->errors[] = $LANG->line('screen_name_taken'); } }*/


And that’s it, users will now be able to choose whatever screen name they want, without the worry of duplicating that of another user.