[SOLVED] CallUserTag how to pass and capture value in UDT

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

[SOLVED] CallUserTag how to pass and capture value in UDT

Post by applejack »

Using CallUserTag I need to be able to pass and capture a variable value but don't know the syntax?

The value is stored in $this->options["loop"] passed to it from a module call parameter.

The current code is as below with $this->options["udt"] being the name of the UDT.

Code: Select all

$options = UserTagOperations::get_instance()->CallUserTag($this->options["udt"], $tmp);
Last edited by applejack on Thu Jan 29, 2015 4:52 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: CallUserTag how to pass and capture value in UDT

Post by velden »

A UDT uses the parameters from the array $params variable.

So give it an array where the key is the expected parameter name and the value is, well, the value.

UDT named 'test':

Code: Select all

// take the value from the 'loop' parameter and add '_changed'. Then return the new string.
return $params["loop"] . '_changed';

Code: Select all

$parameters = array('loop' => 'test-value');
$options = UserTagOperations::get_instance()->CallUserTag("test", $parameters );
$options would contain the string 'test-value_changed'
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: CallUserTag how to pass and capture value in UDT

Post by applejack »

Many thanks Velden that helped me get it sorted.
Post Reply

Return to “Modules/Add-Ons”