oneall / social-login-phpbb

Social Login for phpBB allows your users to login and register with 40+ social networks. It increases your phpBB user registration rate by simplifying the registration process.
https://docs.oneall.com/plugins/guide/social-login-phpbb/
52 stars 33 forks source link

How to implement custom fields #55

Open Supermillhouse opened 7 years ago

Supermillhouse commented 7 years ago

Now that this custom field function has been removed how do I store custom data into the database?

394 - Event handler for custom fields and user row modifications.
395 -
/
396 - public function modify_data ($event)

This was a bit of code I used to use but there is no ware to put it in the latest commit?

$event['cp_data'] = array ( // For example: a custom field named 'steamid': 'pf_steamid' => $social['user_accounts'][0]['userid'], // Risk of E_NOTICE and NULL. );

OminiData commented 6 years ago

i would also like to know that too so i could get it to put the steam id from steam auth into the steam field so it can Work together with my steam status

Galixte commented 6 years ago

@SchlesserClaude could you take a look, please?

SchlesserClaude commented 6 years ago

Hello,

we have submitted the extension to the official phpBB extensions repository at https://www.phpbb.com and the phpBB team asked us to remove the event function as it only served as example and they don't want to see examples in the code.

This was removed from event/listener.php

/**
     * Event handler for custom fields and user row modifications.
     */
    public function modify_data ($event)
    {
        global $phpbb_log, $user;

        // The data retrieved from the social network profile.
        $social = $event['social_profile'];

        // The following code serves as example for custom changes.

        /*

                  // For Steam
                  $event['cp_data'] = array (
                'pf_steamid' => $social['user_accounts'][0]['userid'],  
            );

        */

        // Uncomment following line if you need logs.
        // $phpbb_log->add ('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_EDIT', time(), $event['cp_data']);
    }
OminiData commented 6 years ago

so if in my db the profile field is user_steamid then i should change 'pf_steamid' => $social['user_accounts'][0]['userid'], to 'pf_steamid' => $social['user_steamid'][0]['userid'], right?

SchlesserClaude commented 6 years ago

No, you need to change pf_steamid to user_steamid

OminiData commented 6 years ago

arh alright and are you also able to do that for multiple fields lets say user links it to hes steam profile then it will take hes steam id into user_steamid and then if he links example also links facebook then it will takes hes first name into pf_firts_name and last name into the pf_last_name

and also are user_accounts the DB tabel from phpbb?

SchlesserClaude commented 6 years ago

You can add this code for debugging to see the full data retrieved:

print_r($event['social_profile']);
exit;

Yes, the mapping corresponds to the user_accounts table.