PDA

View Full Version : Best way to run recurring command for every user


Rami114
04-07-2014, 01:44 PM
I have a standard vb4 forum to which I'm now trying to add external API verification into the registration. This is game related.

I've added 4 custom profile fields, two to do with the api lookup itself (which the user must provide at registration time) and 2 for me to keep track of api lookup and api reported membership.

When a user registers, I make the API call with the provided details and check that a game user is returned who matches the supplied username (well multiple game chars might be returned by I check for the username). If that checks out the user is created.

Additionally, I want to grant a group membership based on a secondary piece of information I get from the game API (in-game guild name). I.e. if their guild name is ours, I give them member level access.

I've got some test code up and running to talk to the API, and I've been digging into the VB code itself to get a feel for it. At the moment I'm looking at modifying the registration code. That's the situation as I stand (in case anyone goes 'OMG don't do it that way! Do X!).

The main question is, what's the best way to run a cronjob that goes over every user, checks their API details are still valid and, where needed, updates membership. I quite like data managers, but they are only valid in the current user context and I'd really want to run this for every user.

Is this the best approach, should I do this differently?

Thanks in advance,

Rami

ForceHSS
04-07-2014, 03:05 PM
Cron job is ok but a custom plugin might also be needed

Rami114
04-09-2014, 08:59 AM
Basically I ended up doing this by writing my own set of functions that talks straight to the DB. Fortunately local scripts can run in the VB context by including global (without incurring some odd no-user-defined error).

Data managers are great, but I'm still working out how to force some of them to work for a specific user.