Identity services

I'm working with message_user_info

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

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

Jeremy P

Well-known member
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.
you're bang on !!

unserialize ('the above content');
array(3) {
string(14) "TerminalAddict"
string(14) "TerminalAddict"
string(23) ""

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

any clues?

Jeremy P

Well-known member
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..
$posts = $postModel->getAndMergeAttachmentsIntoPosts($posts);
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.