• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Identity services

#1
I'm working with message_user_info

I'm doing something like this:
Code:
	<xen:hook name="message_user_identities" params="{xen:array 'user={$user}'}">
	 <xen:foreach loop="{$user.identities}" key="$service1" value="$account1">
		<div id="{$service1}{$account1}">
		{$account1}
		</div>
	 </xen:foreach>
	</xen:hook>
but alas .. no worky worky
what am I doing wrong?
 
#4
note sure how to do that?
of if I need to?

this code can found further down the template
Code:
<xen:comment>
                <xen:foreach loop="{$user.identities}" key="$service" value="$account">
                    <dl class="pairsInline">
                        <dt>{$service}</dt>
                        <dd>{$account}</dd>
                    </dl>
                </xen:foreach>
                </xen:comment>
 

Jeremy P

Well-known member
#5
It's commented, and if you uncomment (remove the <xen:comments>) it'll throw an invalid argument for the foreach. My guess is it's something that's not really supported yet, but to be "fixed" in the future.

The output $user.identities is throwing indicates it hasn't been unserialized after being pulled from the database. This would be done in the controller using the unserialize() function in PHP. You would have to write an add-on or wait until this is done in the core unfortunately.
 
#6
you're bang on !!

unserialize ('the above content');
=
array(3) {
["facebook"]=>
string(14) "TerminalAddict"
["gtalk"]=>
string(14) "TerminalAddict"
["msn"]=>
string(23) "terminapaul@hotmail.com"
}

wonder what I can do now? ... learn how code an add-on.

any clues?
 

Jeremy P

Well-known member
#8
You would have to write an addon using a code listener for load_class_controller, extending controllers for pages that make use of message_user_info, and overwriting however $user is being set in the controller with an unserialized value for $user['identities'].

Otherwise if you're comfortable editing files, you could open up XenForo_ControllerPublic_Thread (library/XenForo/ControllerPublic/Thread.php) and after line ~69..
PHP:
$posts = $postModel->getAndMergeAttachmentsIntoPosts($posts);
add...
PHP:
foreach ($posts as $key => $post)
{
	$posts[$key]['identities'] = unserialize($post['identities']);
}
Not sure if the template is parsed for any other page, but the idea would be the same.