XF 2.1 Foreach loop $connectedProviders - No access.

Skyrider

Active member
Not sure in which department I should be asking this, but a friend of mine is attempting to dump in the foreach loops, but he can't access the dump information.

His quote to me:
I don't really get it .. I did a dump in the foreach loops but I can't access the stuff of that dump.

<xf:foreach loop="$connectedProviders" value="$provider" if="{$provider.isAssociated($user)}">
<dl class="pairs pairs--columns pairs--fixedSmall">
<dt>{$provider.title}</dt>
<dd>{$provider.renderAssociated($user)|raw}</dd>
</dl>

{{ dump($provider) }}
<xf:else />


Effectively, I'm looking for the code that gets called via {$provider.renderAssociated($user)|raw}

Simple terms. He wants to grab the info in the connected profiles table to view the raw info. Any idea why he can't access the dump information?

Regards,
Skyrider
 
Last edited:
To be a bit more specific error wise:

InvalidArgumentException: Accessed unknown getter 'provider_key' on XF:ConnectedAccountProvider[steam] src/XF/Mvc/Entity/Entity.php:194

Stack trace
#0 src/XF/Mvc/Entity/Entity.php(106): XF\Mvc\Entity\Entity->get('provider_key')
#1 internal_data/code_cache/templates/l1/s0/admin/user_extra.php(104): XF\Mvc\Entity\Entity->offsetGet('provider_key')
#2 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(SV\UserActivity\XF\Template\Templater), Array)
#3 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('user_extra', Array)
#4 src/XF/Mvc/Renderer/Json.php(84): XF\Template\Template->render()
#5 src/XF/Mvc/Renderer/Json.php(68): XF\Mvc\Renderer\Json->renderHtmlFallback('XF:User\\Extra', 'admin:user_extr...', Array)
#6 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Json->renderView('XF:User\\Extra', 'admin:user_extr...', Array)
#7 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(Hampel\JobRunner\XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(Hampel\JobRunner\XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#9 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#10 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#11 src/XF.php(391): XF\App->run()
#12 admin.php(13): XF::runApp('XF\\Admin\\App')
#13 {main}


Request state
array(4) {
["url"] => string(184) "/admin.php?users/skyrider.3086/extra&_xfRequestUri=%2Fadmin.php%3Fusers%2Fskyrider.3086%2Fedit&_xfWithData=1&_xfToken=xxxx&_xfResponseType=json"
["referrer"] => string(27) "https://thesiteurl"
["_GET"] => array(5) {
["users/skyrider_3086/extra"] => string(0) ""
["_xfRequestUri"] => string(35) "/admin.php?users/skyrider.3086/edit"
["_xfWithData"] => string(1) "1"
["_xfToken"] => string(43) "xxxxx"
["_xfResponseType"] => string(4) "json"
}
["_POST"] => array(0) {
}
}
 
Seeing someone doesn't know at this point, let me simplify it even more.

1585650186541.png

^ The dump information, of which my steam ID is listed under connected_accounts. Our objective is simple, to only show that specific steamID string within connected_accounts in plain text string format. But whenever my friend is attempting to do so, errors pop up. Like he's not allowed to convert it into text.

Anyone has a good idea to make it format properly (and good looking) within the adminCP?
 
You can fetch that string with $user.Profile.connected_accounts.steam, but depending on what exactly you're doing it might be better to go through $provider.getUserInfo($user).
 
You can fetch that string with $user.Profile.connected_accounts.steam, but depending on what exactly you're doing it might be better to go through $provider.getUserInfo($user).
Thanks, that does narrow it down. But how would one convert:
{{ dump($user.Profile.connected_accounts.steam) }}
Into a better normal text content/format?
 
In most of the connected_account_associated_ templates the usernames are simply wrapped in a <div>.

The first post mentions he's looking for the code that gets called via $provider.renderAssociated($user), which is basically just rendering one of those templates. Since this is a 3rd party provider I can't be sure which, but likely something like connected_account_associated_steam.
 
Back
Top Bottom