Keyword

retrieving k2 users based on plugin value

  • telegraph
  • telegraph's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago - 11 years 2 months ago #116193 by telegraph
Hello,

I'm developing a plugin for K2, where you can select an extra value in your user profile, using your example plugin, to add a fields to the user profile form, i have:

<params group="user">
<param name="userCustomGroup" type="list" size="3" label="userCustomGroup" description="Select which group you belong to">
<option value="B">Business</option>
<option value="M">Media</option>
<option value="S">Sales</option>
</param>
</params>

Say I want to retrieve all users that selected the "Media" option in their profile, I want to do this when "onAfterK2Save" event is triggered, inside that plugin function.

Is there a clean programmatical way of loading a list of users that have "Media" value for that field?

or do should I just go ahead and build a SQL query something like

SELECT * FROM `k2_users` WHERE `plugins` LIKE '%Media%'

............the SQL query route looks really ugly and inefficient somehow, thus leading me to believe that there's got to be a better way.

Any help would be greatly appreciated, thanks in advance

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum