Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement custom fields #55

Open
Supermillhouse opened this issue Aug 7, 2017 · 7 comments
Open

How to implement custom fields #55

Supermillhouse opened this issue Aug 7, 2017 · 7 comments

Comments

@Supermillhouse
Copy link

Supermillhouse commented Aug 7, 2017

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
Copy link

OminiData commented Sep 22, 2017

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
Copy link
Contributor

Galixte commented Sep 23, 2017

@SchlesserClaude could you take a look, please?

@SchlesserClaude
Copy link
Contributor

SchlesserClaude commented Oct 5, 2017

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
Copy link

OminiData commented Oct 5, 2017

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
Copy link
Contributor

No, you need to change pf_steamid to user_steamid

@OminiData
Copy link

OminiData commented Oct 5, 2017

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants