Hi all,
I'm having trouble trying to find out how to get the values from a User's Group.
Basically, I'd like to be able to get a custom API key that is stored with the User's Group. This is the beginning of creating an admin interface to be able to send push notifications for clients.
For example: (2 groups)
Group: Steve's Cars
Users: Steve, Andrew
OneSignalAPIkey: 123456789
GoogleAPIKey: AAAAAA123
Group: John's Phones
Users: John
OneSignalAPIkey: 111111129
GoogleAPIKey: BBBBBB123
I looked at the getOption() examples and Mark's ClientConfig, but maybe I'm doing it wrong or I'm using the wrong tools.
I'd like to be able to set up a call, where my code can just go and get the correct value OneSignalAPIkey, when a user asks for it.
If client "Steve" needs to send a push notication, then modx would need get the correct OneSignalAPIkey value stored in the relevant group settings.
I have a snippet (originally copied from the internet) like this, which is returning "No Key"
$key = $modx->getOption('OneSignalAPIkey', $scriptProperties, '', true);
if (!empty($key)) {
$setting = $modx->getObject('modUserSetting', array('key' => $key), false);
if ($setting) {
$output = $setting->get('value');
} else {
$output = 'Could not get setting object';
}
} else {
$output = 'No Key';
}
echo $key;
echo $output;
Thanks.