1. hooman52
  2. General
  3. Monday, January 20 2020, 10:33 AM
Hi,
I need to add a user list module in user profile page to display other users by same profession for example. imagine I have a field named profession, and some users have "programmer" in profession field. visitor clicks on one of them and related users module displays other users that have "programmer"
is it possible or not? let me ask you help me in this issue.
thanks
admin Accepted Answer
Admin
Hi,
this is possible, you can use a Users List module to show users and configure it to show only members with value of the field profession same as profession of current displayed user.
To filter users you can use the module parameter called "Custom SQL Where" with a value like this:
profession = "{user profession displayed raw}"


Our Content Plugin will replace the code {user profession displayed raw} with the value of field "profession" of the current displayed user.

NOTE:
I assume your field have alias "profession", but in your case could be possible that your field have a different alias.

Docs:
Custom SQL Where: http://docs.easy-profile.com/index.php/article/sql-custom-where
Content Plugin: http://docs.easy-profile.com/index.php/article/content-plugin
  1. more than a month ago
  2. General
  3. # 1
hooman52 Accepted Answer
Pro
Hi,
My field "ixtisas" ( that I named profession before) is a select type with multiple selection. so user A has p1,p2 in profession and user B has p1 for example.
I use this syntax:
ixtisas LIKE '%"{user ixtisas displayed raw}"%'
Now when I display user B, module works fine and displays user A and user B. but when I go to user A profile. Module doesn't display any users.
I need to display all users that have p1 in their profession.
let me ask you help
thanks
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
unfortunately with mutiple value select is a bit complex, now your query works well if the current displayed user have only one value.
Try with something like this:
user_id IN (SELECT id FROM #__jsn_users WHERE ixtisas LIKE CONCAT('%',SUBSTRING_INDEX(REPLACE(REPLACE('{user ixtisas displayed raw}','[',''),']',''), ',',1),'%') OR ixtisas LIKE CONCAT('%',SUBSTRING_INDEX(REPLACE(REPLACE('{user ixtisas displayed raw}','[',''),']',''), ',',2),'%') OR ixtisas LIKE CONCAT('%',SUBSTRING_INDEX(REPLACE(REPLACE('{user ixtisas displayed raw}','[',''),']',''), ',',3),'%') OR ixtisas LIKE CONCAT('%',SUBSTRING_INDEX(REPLACE(REPLACE('{user ixtisas displayed raw}','[',''),']',''), ',',4),'%') OR ixtisas LIKE CONCAT('%',SUBSTRING_INDEX(REPLACE(REPLACE('{user ixtisas displayed raw}','[',''),']',''), ',',5),'%') OR ixtisas LIKE CONCAT('%',SUBSTRING_INDEX(REPLACE(REPLACE('{user ixtisas displayed raw}','[',''),']',''), ',',6),'%'))


NOTE: this WHERE statement is not very optimized, but it is compatible with the most of mysql versions (for example some mysql version already include json functions, so the query will be more optimized and simple)
  1. more than a month ago
  2. General
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.