Bundschuh
07-03-2012, 09:57 AM
Hi there,
does somebody got an idea how to send custom field through mobile api?
E.g. the api call 'showthread' returns for a given threadid a list of all posts (see array below).
As you can see, it contains already the custom field 'field2' per default. The 'field2' is one of vBulletins predefined fields for the location.
Searching through source code I found a file called commonwhitelist_5.php. This file is used to generate the response array for mobile api responses. the variable $VB_API_WHITELIST_COMMON['post'] seems to hold all database field names which will be returned by the response. Beside 'postid', 'threadid' etc. there is also listed 'field2'.
So, adding further custom fields 0-X to whitelist variable will work and the api response contains its values.
But I couldn't find another solution yet. No hook oder templating system for mobile api.
Changing core files would only be the last option I would choose to make it work.
Does someone else came along this issue or has an idea to add custom field to api responses?
Greetings and TIA
Bundschuh
Array
(
[response] => Array
(
...
[postbits] => Array
(
[post] => Array
(
[postid] => ...
[posttime] => ...
[threadid] => ...
...
[userid] => 1
[username] => admin
...
[usertitle] => ...
[joindate] => ...
[field2] =>
...
[title] => ...
...
[message] => ...
[message_plain] => ...
[message_bbcode] => ...
)
...
does somebody got an idea how to send custom field through mobile api?
E.g. the api call 'showthread' returns for a given threadid a list of all posts (see array below).
As you can see, it contains already the custom field 'field2' per default. The 'field2' is one of vBulletins predefined fields for the location.
Searching through source code I found a file called commonwhitelist_5.php. This file is used to generate the response array for mobile api responses. the variable $VB_API_WHITELIST_COMMON['post'] seems to hold all database field names which will be returned by the response. Beside 'postid', 'threadid' etc. there is also listed 'field2'.
So, adding further custom fields 0-X to whitelist variable will work and the api response contains its values.
But I couldn't find another solution yet. No hook oder templating system for mobile api.
Changing core files would only be the last option I would choose to make it work.
Does someone else came along this issue or has an idea to add custom field to api responses?
Greetings and TIA
Bundschuh
Array
(
[response] => Array
(
...
[postbits] => Array
(
[post] => Array
(
[postid] => ...
[posttime] => ...
[threadid] => ...
...
[userid] => 1
[username] => admin
...
[usertitle] => ...
[joindate] => ...
[field2] =>
...
[title] => ...
...
[message] => ...
[message_plain] => ...
[message_bbcode] => ...
)
...