0

Running into some more UserCake problems. Right now I am trying to create a function to update first name (will use for lots of fields), however when I call the function the script stops. For some reason, I believe it doesn't seem to know where the function is? or that it even exists? Because whenever I submit the form, the page stops on the line that I call $loggedInUser->updateFirstName($first_name);

Here's what I'm working with:

funcs.php

if ($first_name != $loggedInUser->first_name) {
    if(trim($first_name) == "") {
        $errors[] = lang("ACCOUNT_SPECIFY_FNAME");
    }

    //End data validation
    if(count($errors) == 0) {
        $loggedInUser->updateFirstName($first_name);
        $successes[] = lang("ACCOUNT_FNAME_UPDATED");
    }
}

user_settings.php

//Change a user's first name
function updateFirstName($id, $first_name)
{
    global $mysqli,$db_table_prefix;
    $stmt = $mysqli->prepare("UPDATE ".$db_table_prefix."users
        SET 
        first_name = ?
        WHERE
        id = ?");
    $stmt->bind_param("si", $first_name, $id);
    $result = $stmt->execute();
    $stmt->close();
    return $result;
}

What I'm confused about is that the updateEmail() function works perfectly, it's exactly the same except for the actual field name being 'email'.

  • Through more testing, I found that it is calling the updateFirstname() which is returning 1. Which is all fine and dandy, but it is not updated the table data and just stopping on that function call still. – CoconuttMonkey Sep 30 '14 at 22:41

1 Answers1

0

It does not look like you are calling for the id with the function.

$loggedInUser->updateFirstName($id, $first_name);