Commit 6803e00e authored by salvamomo's avatar salvamomo

Finished README.txt and added some code style amendments

parent 295d9965
......@@ -5,16 +5,14 @@ CONTENTS OF THIS FILE
* INTRODUCTION
* INSTALLATION
* USAGE
* ROADMAP
INTRODUCTION
------------
Written by: Salvador Molina <salvador.molinamoreno@codeenigma.com>
The User Homepage module allows users with the 'configure own homepage' to set a
specific page of the site as their homepage. This means that they'll be
The User Homepage module lets users with the 'configure own homepage' permission
to set a specific page of the site as their homepage. This means that they'll be
redirected to this page upon login on the site.
For the time being, the module provides two blocks, each of them featuring a
......@@ -27,7 +25,7 @@ INSTALLATION
To install the User Homepage module:
1. Place its entire folder into the "sites/all/contrib/modules" folder of your
1. Place its entire folder into the "sites/all/modules/contrib/" folder of your
drupal installation.
2. In your Drupal site, navigate to "admin/modules", search the "User Homepage"
......@@ -40,11 +38,8 @@ To install the User Homepage module:
USAGE
-----
After installing the module...
TBC
ROADMAP
-------
1. Assign the 'configure own homepage' permission to the desired roles.
TBC
2. Navigate to "admin/structure/block" and assign the "Save as homepage button"
and "Reset homepage button" blocks in the regions of your theme where you
want them to appear.
......@@ -9,13 +9,13 @@
/*
* Implements hook_user_login().
*/
function user_homepage_user_login() {
function user_homepage_user_login(&$edit, $account) {
// We don't redirect if there's already a destination.
if (isset($_GET['destination'])) {
drupal_goto($_GET['destination']);
}
// Perform the custom redirect.
else if ($homepage = user_homepage_get_homepage()) {
else if ($homepage = user_homepage_get_homepage($account->uid)) {
$parsed_homepage = parse_url($homepage);
$options = array();
if (isset($parsed_homepage['query'])) {
......@@ -87,8 +87,7 @@ function user_homepage_block_view($delta = '') {
*
* @return array The form array.
*/
function user_homepage_button($form) {
$form = array();
function user_homepage_button($form, &$form_state) {
$form['user_homepage_button'] = array(
'#type' => 'submit',
'#value' => t('Save as homepage'),
......@@ -102,8 +101,7 @@ function user_homepage_button($form) {
*
* @return array The form array.
*/
function user_homepage_reset_button($form) {
$form = array();
function user_homepage_reset_button($form, &$form_state) {
$form['user_homepage_reset_button'] = array(
'#type' => 'submit',
'#value' => t('Unset configured homepage'),
......@@ -202,8 +200,9 @@ function user_homepage_build_homepage_path_from_request() {
);
$homepage_url = url(current_path(), $options);
// @TODO: Store the encoded url, stripping the first '/', as it will be added
//when calling drupal_goto(). Check if there's a cleaner way to achieve this.
// Store the encoded url, stripping the first '/', as it will be added when
// calling drupal_goto().
// TODO: Check if there's a cleaner way to achieve this without stripping '/'.
$encoded_url = rawurlencode(substr($homepage_url, 1));
return $encoded_url;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment