Adding new variable for the Author Pane (Follow Links)

Here's how to adding new variable for the Author Pane (Follow links). The demo is on Bersosial.com.

function template_preprocess_author_pane(&$variables) {

  $variables['user_follow'] = '';
  $uid = $variables['account']->uid;
  $name1 = 'twitter';
  $name2 = 'googleplus';

  $twitter = db_query('SELECT path FROM {follow_links} WHERE uid = :uid and name = :name', array(':uid' => $uid, ':name' => $name1))->fetchField();
  $googleplus = db_query('SELECT path FROM {follow_links} WHERE uid = :uid and name = :name', array(':uid' => $uid, ':name' => $name2))->fetchField();
  
  if (!empty($twitter)) {
     $twitter = ' <a href="' .$twitter. '"><img typeof="foaf:Image" alt="Follow me on Twitter" title="Follow me on Twitter" src="/sites/all/modules/follow/icons/wpzoom26/icon-twitter.png"/></a> ';
     $variables['user_follow'] .= $twitter;
  }

  if (!empty($googleplus)) {
     $google = ' <a rel="author" href="' .$googleplus. '"><img typeof="foaf:Image" alt="Follow me on Google+" title="Follow me on Google+" src="/sites/all/modules/follow/icons/wpzoom26/icon-googleplus.png"/></a> ';
     $variables['user_follow'] .= $google;
  }

}

After that add the following code in author-pane.tpl.php or advanced-forum.naked.author-pane.tpl.php.

<?php /* Follow */ ?>
<?php if (isset($user_follow)): ?>
  <div class="author-pane-line author-follow">
    <?php print $user_follow; ?>
  </div>
<?php endif; ?>

Module used are Follow, Author Pane, and Advanced Forum.

Medium: Not too big, not too small

Evan Williams widely known as the co-founder of Blogger and Twitter (Blogger acquired by Google), and the steps to create new things continues, the most recent is Medium.

So what is Medium?

Medium is a new place on the Internet where people share ideas and stories that are longer than 140 characters and not just for friends. It’s designed for little stories that make your day better and manifestos that change the world. It’s used by everyone from professional journalists to amateur cooks. It’s simple, beautiful, collaborative, and it helps you find the right audience for whatever you have to say. More..

Medium currently still in beta release, posting is restricted to certain accounts. The registration process is very simple, we can sign in using our Twitter account.

Create an account on Medium now, who knows you are lucky to be invited. You can find me on Medium @danpros.

Latest Reform commit: Exclude UID 1

Here is the latest commit for one of my Drupal module, Reform.

But first, what is Reform module?

Perhaps sometimes you want something simple, such as limiting the minimum length and maximum length of a username. This module allows you to do simple things like that.
function reform_name_validate($form, &$form_state) {
  global $user;
  if (isset($form_state['values']['name'])) {
    if ($user->uid != 1) {
      if ($error = reform_validate_name($form_state['values']['name'])) {
        form_set_error('name', $error);
      }
    }
  }
}

UID 1 will always be able to pass through all the long and the short boundaries of username. Read the release note for Reform 7.x-1.0-alpha2.