I realize I have been taking my time with SamTodo 1.2, so here is a little something you can do until multi-user support becomes native.
Note: Please backup everything (including your database) before trying this!
STEP 1
EDIT _model\global\act_config.php
Add an $account_name2, and $account_password2 underneath the originals so it looks something like this:
|
1 2 3 4 5 6 |
// SamTodo login information
$account_name = "sam";
$account_password = "password";
$account_name2 = "sam2";
$account_password2 = "password2"; |
STEP 2
EDIT _model\account\act_login.php
Change line 13 to 25 from:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
if(($_REQUEST["accountName"] == $account_name) && ($_REQUEST["accountPassword"] == $account_password)) {
// establish their ID and name as session variables for use elsewhere
$_SESSION["accountID"] = "00000000-0000-0000-0000-000000000000"; // account ID's will be used in a later release
$_SESSION["accountName"] = $account_name;
// redirect to main
header( "Location: " . $root_path . "main.default" );
}
else
{
$error = 1;
} |
To:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
if(($_REQUEST["accountName"] == $account_name) && ($_REQUEST["accountPassword"] == $account_password)) {
// establish their ID and name as session variables for use elsewhere
$_SESSION["accountID"] = "00000000-0000-0000-0000-000000000000"; // account ID's will be used in a later release
$_SESSION["accountName"] = $account_name;
// redirect to main
header( "Location: " . $root_path . "main.default" );
}
elseif (($_REQUEST["accountName"] == $account_name2) && ($_REQUEST["accountPassword"] == $account_password2)) {
// establish their ID and name as session variables for use elsewhere
$_SESSION["accountID"] = "00000000-0000-0000-0000-000000000001"; // account ID's will be used in a later release
$_SESSION["accountName"] = $account_name2;
// redirect to main
header( "Location: " . $root_path . "main.default" );
}
else
{
$error = 1;
} |
STEP 3
EDIT your samtodo_tasks table
Add a new column named ‘taskCreator’, make it a varchar of length 12 (or however long your username’s max length may be)
STEP 4
EDIT _model/main/act_task_editor.php
Change lines 30 to 38 from:
|
1 2 3 4 5 6 7 8 9 |
// compose a query to edit existing task
$q_edit_task = "UPDATE " . $table_prefix . "tasks
SET
taskName = '$name',
taskDescription = '$description',
taskCategory = '$category',
taskComplete = '$complete',
taskPriority = '$priority'
WHERE taskID = '" . cleanQuery($_REQUEST["taskID"]) . "'"; |
To:
|
1 2 3 4 5 6 7 8 9 10 |
// compose a query to edit existing task
$q_edit_task = "UPDATE " . $table_prefix . "tasks
SET
taskName = '$name',
taskDescription = '$description',
taskCategory = '$category',
taskComplete = '$complete',
taskPriority = '$priority',
taskCreator = '" . $_SESSION["accountName"] . "'
WHERE taskID = '" . cleanQuery($_REQUEST["taskID"]) . "'"; |
STEP 5
EDIT same file as above _model/main/act_task_editor.php
Change line 51 to 53 from:
|
1 2 3 |
// compose a query to insert new task
$q_add_task = "INSERT INTO " . $table_prefix . "tasks (taskID, taskName, taskDescription, taskCategory, taskDate, taskComplete, taskPriority)
VALUES ('$new_uuid','$name','$description','$category','$date','$complete','$priority')"; |
To:
|
1 2 3 |
// compose a query to insert new task
$q_add_task = "INSERT INTO " . $table_prefix . "tasks (taskID, taskName, taskDescription, taskCategory, taskDate, taskComplete, taskPriority, taskCreator)
VALUES ('$new_uuid','$name','$description','$category','$date','$complete','$priority','" . $_SESSION["accountName"] . "')"; |
STEP 6
EDIT _view/main/dsp_main.php
Under line 97, which is:
|
1 |
<td><a href="<?php echo $myself; ?>&orderBy=catName&ascDesc=<?php echo $ascdescnext; if(isset($_REQUEST["completed"])){ ?>&completed=<?php echo $_REQUEST["completed"]; } ?>">Category</a> <?php if($orderby == 'catName'){ echo $ascdesc; } ?></td> |
Add:
|
1 |
<td>Creator</td> |
STEP 7
EDIT same file as above _view/main/dsp_main.php
Under line 121, which is:
|
1 |
$task_date = $q_tasks_row["DateAdded"]; |
Add:
|
1 |
$task_creator = trim($q_tasks_row["taskCreator"]); |
STEP 8
EDIT same file as above _view/main/dsp_main.php
Under line 157, which is:
|
1 |
<td><?php echo $task_category; ?></td> |
Add:
|
1 |
<td><?php echo $task_creator; ?></td> |
STEP 9
EDIT same file as above _view/main/dsp_main.php
Change line 190 from:
|
1 |
<tr><td colspan="7">No tasks found that meet this criteria.</td></tr> |
To:
|
1 |
<tr><td colspan="8">No tasks found that meet this criteria.</td></tr> |
Et voilĂ ! You are done.
Additionally you could also add further users by expanding Step 1 and 2.
If you have any questions, let me know!