Sunday, February 27, 2011

An example of OpenID, Facebook and Twitter authentication in Zend Framework 1.11

This is an example Zend Framework 1.11.3 application that uses OpenID (Google,
Yahoo, MyOpenId, AOL, OpenId) as well as Facebook Connect and Twitter Oauth for
authentication of users.

During authentication, information about a user (e.g. an email or a country) is fetched from the authentication provider.

Zend Framework 1.11 does not have a very good support for OpenID, not mentioning Facebook Connect and Twitter Oauth. Thus, to make it all work the following elements were used:
In some cases slight modifications to the above elements were made.

The demo of this application is here , while the source code is at GitHub. The user authentication is performed in a loginAction in UserController.php.

Hopefully, this example application will be useful to others as it was for me.

Sunday, February 06, 2011

Drupal 7: Add last update date to the footer of the page

I needed to add a date of last modification of the website made in Drupal 7. I did it by enable core module PHP Filter and creating a block located a footer block region. The body of the block was as follows:
<?php
// get date of most most recent change to a node
$result = db_query('SELECT title, changed FROM {node} WHERE status=1 ORDER BY changed DESC LIMIT 1');
$node = $result->fetchObject();
$date = date('d-M-Y g:i a', $node->changed);
echo "Last update: $date";
?>