News:

Wondering if this will always be free?  See why free is better.

Main Menu

Creating member directly into database

Started by Mex, November 19, 2014, 10:33:02 AM

Previous topic - Next topic

Mex

Hi there

I am making a website for a friend, the site will also have an SMF forum.
There will be a login/register on the website which will work directly with the forum database.

My question is, if I am to add a member via PHP, is it as simple as running an INSERT SQL query on the 'members' table?
Is there any other tables I need to INSERT or UPDATE?

Edit:

My query:

public function register_member()
{
$data = array(
'member_name' => $username,
'date_registered' => time(),
'posts' => 0,
'id_group' => 1,
'lngfile' => '',
'last_login' => time(),
'real_name' => $realName,
'instant_messages' => 0,
'unread_messages' => 0,
'new_pm' => 0,
'buddy_list' => '',
'pm_ignore_list' => '',
'pm_prefs' => 0,
'mod_prefs' => '',
'message_labels' => '',
'passwd' => $password,
'openid_uri' => '',
'email_address' => $email,
'personal_text' => '',
'gender' => 0,
'birthdate' => '0001-01-01',
'website_title' => '',
'website_url' => '',
'location' => '',
'icq' => '',
'aim' => '',
'yim' => '',
'msn' => '',
'hide_email' => 0,
'show_online' => 1,
'time_format' => '',
'signature' => '',
'time_offset' => 0,
'avatar' => '',
'pm_email_notify' => 0,
'karma_bad' => 0,
'karma_good' => 0,
'usertitle' => '',
'notify_announcements' => 1,
'notify_regularity' => 1,
'notify_send_body' => 0,
'notify_types' => 2,
'member_ip' => $ip,
'member_ip2' => $ip,
'secret_question' => '',
'secret_answer' => '',
'id_theme' => 0,
'is_activated' => 1,
'validation_code' => '',
'id_msg_last_visit' => 1,
'additional_groups' => '',
'smiley_set' => '',
'id_post_group' => 0,
'total_time_logged_in' => 0,
'password_salt' => $passwordSalt,
'ignore_boards' => '',
'warning' => 0,
'passwd_flood' => '',
'pm_receive_from' => 1
);
$this->db->insert('members', $data);
}

Arantor

No, use registerMember() in Subs-Members.php instead since there are other things beyond inserting into the database to do.

Kindred

However, the larger question is...   why?

Is the site code going to be custom, or another pre-built system?
If it's custom, why note just use the SMF members and functions directly rather than trying to link disparate systems (which may not be as secure as SMF is)?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Mex

Thanks guys.

I'll look into registerMember()

Mex

I tried including Subs-Members.php but this relies upon a loadLanguage function, which seems to be defined in Sources/Load.php.

Which PHP file(s) do I need to include?

Arantor

Basically just include SSI.php and then Subs-Members.php.

And answering the questions previously asked might also prove useful.

Mex

Apologies for not answering the other questions sooner.
I am using a custom built website with the CodeIgniter framework.

I will give the SSI file a go now.

Arantor

I thought CodeIgniter was abandoned these days after the devs were trying to find a buyer/maintainer for it?

Mex

The registration now works, thanks a lot.

Not sure about CodeIgniter, but wiki says:
Quote
On July 9, 2013, EllisLab announced that it is seeking a new owner for its CodeIgniter, stating lack of involvement as a reason.[11] On October 6, 2014, EllisLab announced that CodeIgniter will continue its development under the stewardship of the British Columbia Institute of Technology.[12]

Arantor

Huh, someone actually picked it up. I wonder if they will ever get around to jettisoning PHP 4 compatibility seeing how PHP 4 was discontinued years ago.

Advertisement: