We are glad to welcome you to our Community Support Forums!
These forums are your way of communicating with the community of people developing and using tools provided by the OneAll platform.
The forums are run by the community and moderated by the OneAll team during office hours. Please stick to technical issues - and remember, no confidential information - these are public forums!

Using Event handler for custom fields to grab Steam_ID

I have tried following the example listed in listener.php to grab Steam id's on users registering with their steam logins. The issue i am having is i am unsure exactly wich $social[] variable is holding the steam ID for me to pass back to have added to the custom field. Ive been trying to take guess but havent found it yet.

Any suggestions or help would be greatly appreciated as this has great potential.

Best Answer

  • Hi Jeff,

    thank you very much for the update. I think that this code will also be useful for other users!

    Best Regards,

Answers

  • Well i finally got it. After catching a look at some of the oasl table sin my DB i found the session string and plugged away at the fields i was looking for. it so happens that the info i was looking for is an array im not used to seeing. The user id is stored in $social['user_accounts'][0]['userid'] and i was having trouble with how the fields are nested up to pull it in where i wanted it. Heres the snippet for anyone else looking to do this that goes into the listener.php in the modify_data function


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

  • There is no longer a place to put this code in version 3.4, help!!!
  • edited August 8
    Hi Ian,

    we have submitted the extension to the official phpBB extensions repository at https://www.phpbb.com and the phpBB team asked us to remove that 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.

    /*

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

    */

    // 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']);
    }
  • I put that back in and it didn't work, I also added back in
    'oneall_sociallogin.user_add_modify_data' => 'modify_data',
    but that didn't help either. Is there other supporting code that has been removed for this function to work or be called?
    This extensions PHP code is a little complex for me so it may take a bit of time for me to understand how it is sequenced to work out on my own and reintroduce the feature.
  • Hi Ian,

    you can find the latest version (before that code was removed) of the plugin here:
    https://secure.oneallcdn.com/extensions/phpbb/3.1.x-3.2.x/phpbb--3.1.x--3.2.x---oneall_social_login-3.3.zip
  • Thanks, I will try this out when I get home. I did try a previous version off of Git Hub but I may have grabbed and in-between version that didn't work. Thank you for your patience.
  • Hi again, tried this version and still not populating custom fields. I disabled the extension, replaced all the files, re enabled the extension, edited the listener file to have the event from above in it and, nope, not working.
    I have reverted back to 2.8 and can confirm it works fine with the code I am putting in, something has changed significantly between 2.8 and 3.4 to brake this function. Are there version 2.9-3.2 I can test to help you nail down when it got broken, unless you can identify why?
Sign in with your OneAll account to take part in the discussion.