I want to avoid regular registrations , as right now my setup simply kills unwanted people and spammers. The Steam ID number which you saw was used as an example , and will be changed to a variable which contains each user steam ID.This isn't especially straight forward.
The best I can think of is making use of custom fields.
So actually this may be a rewrite of what you've done so far - or at least a rethink of how to achieve it.
One thing I notice is that the steam ID is hard coded into the PHP script and your require once will only pull the data once per page.
So eventually you're going to need a way of passing each person's Steam ID so maybe using custom user fields is the way to capture that and feed it into your script.
Then, you could set up a user group promotion that puts people in different user groups based on the data returned?
Just thinking aloud but should work.
@Title. basically , I have a plugin which gets the data from a XML , and outputs text. I want to take the text and check for a certain word , if the word is there then put the user in a group. Help?
Why isn't it correct?
Does the xml file come from an external site? Do you need to set the group as soon as the user registers (otherwise you could do it in a cron entry)? If so, what do you do if the site is unavailable?@Title. basically , I have a plugin which gets the data from a XML , and outputs text. I want to take the text and check for a certain word , if the word is there then put the user in a group. Help?
The XML comes from an external site , I need the group set every 24 hours ( check the variable for any changes )Does the xml file come from an external site? Do you need to set the group as soon as the user registers (otherwise you could do it in a cron entry)? If so, what do you do if the site is unavailable?
I think I found what I need , but still unsure.
First this: XenForo_Model_UserGroup::changePrimaryUserGroupForUsers not sure if this will work , but basically from what I understood it changes the usergroup of the users I specify. I'm not even sure it's correct , I just figured as XenForo_Model_Usergroup is the class and the other part is a function , so yeah.
Aside from this , I was thinking of setting something like this:
if $myvar = mystring {
use the thing I mentioned above }
else { don't do anything }
I need help translating this to xenforo though.
Well the problem is I already have a steam ID variable , and if I use customField I'll need a way to use it's variable in the listener.You should use custom user fields. Make it required and everyone will have to fill it in once they've visited their profile AFAIK.
You can pass a validation callback to ensure they're entering a valid Steam ID (and whatever else you need to check), you may also be able to do the usergroup updating in the validation callback.
Could you possibly link me to a guide which will help be set this?This approach is correct. However you will need a lot of familiarization with Xenforo's manner of extension and coding. You should read and follow some of the basic addon creation tutorials on this site.
Flick through here: http://xenforo.com/community/resources/categories/development-tutorials.36/Can anyone possible point me to a guide ro reference how to use a xenforo controller in php?
Call me stupid , still didn't find anything.
public function changePrimaryUserGroupForUsers(array $userIds, $newPrimaryGroupId)
{
if (!$userIds)
{
return;
}
$db = $this->_getDb();
$userIdsQuoted = $db->quote($userIds);
XenForo_Db::beginTransaction($db);
$db->update('xf_user',
array('user_group_id' => $newPrimaryGroupId),
'user_id IN (' . $userIdsQuoted . ')'
);
$db->delete('xf_user_group_relation',
'user_id IN (' . $userIdsQuoted . ') AND user_group_id = ' . $db->quote($newPrimaryGroupId)
. ' AND is_primary = 0'
);
$db->update('xf_user_group_relation',
array('user_group_id' => $newPrimaryGroupId),
'user_id IN (' . $userIdsQuoted . ') AND is_primary = 1'
);
$this->_getPermissionModel()->updateUserPermissionCombinations($userIds);
XenForo_Db::commit($db);
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.