Expanding Member Search

rated by 0 users
This post has 10 Replies | 1 Follower

shakes
Top 75 Contributor
Posts 307
Points 4,670
By: shakes
Posted: Sun, May 11 2008 5:58 PM

 

I have added quite a few parameters to the user profile. Most are bool values controlled by check boxes and some are dropdowns and text boxes. My next step is to be able to search for users based on my new profile criteria. The only customization info I have found so far is this: http://gabe19.blogspot.com/2006/08/community-server-customization.html

It Refers to 2.1 and while I don’t think much has changed I don’t want to muck things up. Does anyone know what files I would need to modify to accomplish this. So far the only thing I am certain of is UserSearchForm.cs Or if someone has a lot of time on their hands and feels like doing some Community Server Charity work I would be eternally grateful for a little tutorial. 

peace shakes

Carolina Pulse

 
  • Post Points: 20 |
afscrome
Top 10 Contributor
Posts 2,727
Points 40,160
TelligentSupportTeam
By: afscrome
Posted: Sun, May 11 2008 6:20 PM In reply to

 

How have you added your extra profile options.  If you've added them via extended attributes, then I'll suggest that search is going to pretty much be off the table, unless you only have a small number of users due to performance issues.

My suggestion would be to make a custom control which derives from UserSearchForm, which overrides the DataSource, and QueryOverides.  You would have to add your additional profile search options to your QueryOverrides, then modify the DataSource to include them when getting the DataSource.  If you're using extended attributes, you'll have to do filter out your users by looping through the base datasource, and seeing if the values match the requested pattern.

 
  • Post Points: 35 |
shakes
Top 75 Contributor
Posts 307
Points 4,670
By: shakes
Posted: Sun, May 11 2008 7:28 PM In reply to

The new profile data is not in extended attributes. Everything has its own column etc in the user profile. I followed this tutorial to accomplish this (lots of direct sdk mods). http://proactivelogic.com/blog/index.php/2007/11/03/extending-community-server-2007-user-profiles-and-vista-setup/

To be honest my skills as far as sdk and C# are concerned are quite limited. I can extrapolate on things if I have some examples but that’s about it. If you have the time to provide a little more detail or perhaps an example that would be great. I do realize that is kind of a lot to ask though.

peace shakes

Carolina Pulse

 
  • Post Points: 5 |
shakes
Top 75 Contributor
Posts 307
Points 4,670
By: shakes
Posted: Fri, May 23 2008 1:25 AM In reply to

 

Crome,

            If you would be willing to write a tutorial on expanding the member search that would be something I would be willing to pay for. This is important to a personal project I am working on and as I said I can extrapolate on ideas well enough but need a little guidance. If this is something you or anyone else would be interested in please let me know.

peace shakes

Carolina Pulse

 
  • Post Points: 20 |
afscrome
Top 10 Contributor
Posts 2,727
Points 40,160
TelligentSupportTeam
By: afscrome
Posted: Fri, May 23 2008 11:49 AM In reply to

Someone else's got there first - have a look at http://dev.communityserver.com/forums/t/499676.aspx

 
  • Post Points: 20 |
shakes
Top 75 Contributor
Posts 307
Points 4,670
By: shakes
Posted: Wed, Jul 2 2008 12:04 AM In reply to

Crome,

I wanted to see if you would be interested in doing a little paid work on this. Jons info got me going in the first place however this time around its not quite far enough. Please let me know.

peace shakes

Carolina Pulse

 
  • Post Points: 20 |
Jon_ProactiveLogic
Top 500 Contributor
Posts 62
Points 1,040
By: Jon_ProactiveLogic
Posted: Wed, Jul 16 2008 7:14 AM In reply to

Hi Shakes,

No promises, but I will be looking into this area soon for my own hobby project.  If I do expand the user search, I will write up some notes.

Cheers,

Jon

Chief Technical Architect Proactive Logic, LLC http://proactivelogic.com/blog
Custom Web and Desktop Application Development
 
  • Post Points: 20 |
shakes
Top 75 Contributor
Posts 307
Points 4,670
By: shakes
Posted: Fri, Jul 18 2008 6:49 PM In reply to

Glad to see you are looking into this as well...it was your info that got me started...it was a great help by the way

peace shakes

Carolina Pulse

 
  • Post Points: 20 |
Jon_ProactiveLogic
Top 500 Contributor
Posts 62
Points 1,040
By: Jon_ProactiveLogic
Posted: Fri, Jul 18 2008 10:25 PM In reply to

Hi shakes, thanks!

I'm putting in an hour here or there on this over the next week or so.  So far I think I have a way to do it - without sdk mods.

I actually figured out how to do all the stuff in my article without modifying the sdk - just adding my own code outside of CS and updating themes.


So far so good.  I will report back...

Jon

Chief Technical Architect Proactive Logic, LLC http://proactivelogic.com/blog
Custom Web and Desktop Application Development
 
  • Post Points: 5 |
Jon_ProactiveLogic
Top 500 Contributor
Posts 62
Points 1,040
By: Jon_ProactiveLogic
Posted: Sat, Jul 19 2008 11:13 AM In reply to

Hi all,


I got this to work this morning, but I want to clean it up before I post it, and I don't know when I will get the time, so in the mean time....

The short of it is that I'm using QueryOverrides attributes (you can use the SetAttribute call on the QueryOverrides instance) to put in my own values to search on from the UI / Theme.  Example:

this.UserListInstance.QueryOverrides.SetAttribute("MySearchParam", "MySearchParamValue");  

Note: I added an ID named "UserListInstance" and use the CSControlUtility to get a reference to the userlist control.

I have implemented my own CommonDataProvider which inherits from the SqlCommonDataProvider, where I now tie in my custom data.  I do not modify any sdk code anymore.

For search I override:

public override UserSet GetUsers(UserQuery query, bool returnModerationCounters)

I copied ALL of the code from the SDK for this method, into my own implementation.  I also copied the code from the SqlGenerator in the SDK into my own code so I can tweak the sql query generated.

Within this method, I pull the extended attributes off of the query passed in (which come from the queryoverrides set in the theme).

Example:
string mySearchValue =query.ExtendedParameters.Get("MySearchParam");

Then in the code I copied from the BuildMemberQuery, if I see an extended attribute was pased in, I add a inner join to my custom table based on user ID, and to the where clause to filter on the value passed in.

It's not as elegant as I would like, but not bad either!

I saw a hint in another post from Jose that it looks like they will be coming up with a way to do extended attribute storage differently in the future.  The REST api seems cool - but I'd be more intereted in a solid extensibility story at the data layer.  Maybe all of my work in this area will no longer be needed, but for now, it works!

Let me know what you think...

Cheers,

Jon

 

Chief Technical Architect Proactive Logic, LLC http://proactivelogic.com/blog
Custom Web and Desktop Application Development
 
  • Post Points: 20 |
shakes
Top 75 Contributor
Posts 307
Points 4,670
By: shakes
Posted: Tue, Aug 5 2008 8:43 PM In reply to

So i am still struggling with this...my approach is to add my info directly to the sdk...its the road i have been going down anyway...so in that vain i have modified my custom search.aspx, usersearchform.cs, userquery.cs (components), and userquery.cs (communityserver.controls) with my custom info...i get errors but hey its no big...i still need to add something to sqlgenerator.cs. My question is are these all the files i need to look at to get this done? Am i missing one or using one i dont need.

peace shakes

Carolina Pulse

 
  • Post Points: 5 |
Page 1 of 1 (11 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com