How can I pull the twitter Var from

x4rl

Well-known member
PHP:
                            <xen:if is="{$identities}">
                                <xen:foreach loop="$identities" value="$identity">
                                    <dl><dt>{$identity.title}:</dt> <dd>{xen:string censor, $identity.value}</dd></dl>
                                </xen:foreach>
                            </xen:if>

For example if someone adds there twitter account in "Contact Details"
Than on there profile under the information tab there is

Twitter: Vodkaholic27

I need the var (output) for the user name, I can't seem to find it anywhere other than the code above..

Thanks
 
PHP:
$userModel = $this->getModelFromCache('XenForo_Model_User');
$identities = $userModel->getIdentities(XenForo_Visitor::getUserId());

and then you can access it via $identities['...']
 
PHP:
$userModel = $this->getModelFromCache('XenForo_Model_User');
$identities = $userModel->getIdentities(XenForo_Visitor::getUserId());

and then you can access it via $identities['...']
ragtek am not as good as you :D
So $identities['...'] will pull the users twitter name ?
Still trying to learn sorry :C
 
Ragtek posted the PHP for a listener (I think). If the $identities variable is exposed where you want it, you could probably just use it in templates.
 
Ragtek posted the PHP for a listener (I think). If the $identities variable is exposed where you want it, you could probably just use it in templates.
I did try $identities['twitter'] and $identities['7'] yesterday.. didn't work tho hmm
 
I think there's a tutorial here that explains how to make variables available in custom templates. I'll have a search.
 
You're better off creating a mod/add-on. Take a look at Kiers tutorial in the tutorial section.
 

I did try $identities['twitter'] and $identities['7'] yesterday.. didn't work tho hmm

First question, are you passing $identities into the template? (is this from the listener you were working on last night).... and if so, identities is an array, so you need to access the twitter part of the array like this.. {$identities.twitter} and if you wanted say google talk it would be {$identities.gtalk}
 
First question, are you passing $identities into the template? (is this from the listener you were working on last night).... and if so, identities is an array, so you need to access the twitter part of the array like this.. {$identities.twitter} and if you wanted say google talk it would be {$identities.gtalk}
Hey no Ive not added anything in php yet about this. (same listener as last night aye)
I tryed adding {$identities.twitter} in the template but also didn't work

You're better off creating a mod/add-on. Take a look at Kiers tutorial in the tutorial section.
This is what am trying to do :( right now (make an addon)
 
Hmm would it be {$user.id}{$identities.twitter} something like that so it knows to pull each members twitter name?

Am just trying everything and anything atm can't seem to work this out... Need more learning :C
 
The 2 variables won't do anything.

Put this code into your template:
Code:
{xen:helper dump, $identities}

This will dump the identities array if it exists, or return NULL if it doesn't.

If it returns null, replace the above code with:
Code:
{xen:helper dump, $user}
and see if the identity service is part of the $user array.
 
It's a custom template isn't it? I think you need to expose the variables to custom templates. Check the Have You Seen...? section for a tutorial, I'm sure Kier posted one...
 
It's a custom template isn't it? I think you need to expose the variables to custom templates. Check the Have You Seen...? section for a tutorial, I'm sure Kier posted one...
Aye I have that's why am here because am stuck :( oh well thanks away James
 
Top Bottom