Auto profile search

8 years 3 weeks ago #280660 by pranaydhruv
Auto profile search was created by pranaydhruv
Dear team,

I am trying to create a feature for my website to provide auto searches for users. How this will work is that user will have options to specify that they need in their prospective partners. these get stored in the Comprofiler table, i have created a query that fetches the prospective matches for each profile and sends them an email, till here it is fine , but i want to incorporate a couple more things to make this more meaningful.

1) The result of the query should show only those profiles which are not already a connection for that user. till now the query is mostly running from comprofiler table. but to incorporate this feature i am trying to apply a join in the query but i am still not able to bring the resulkt set down to only profiles which are non connections. I am trying to join the table t4qcm_comprofiler_members.

2) the result of the result of the query should also respect the users privacy settings such that if he has chosen to hide his photo it should be hidden in the email too. But i am unable to find the privacy details in the database, can you please point me to the right table or suggest a way out( i remember that privacy simply hides the HTML output,so maybe no table for privacy exists?)

Query :-
$gender ="Male";
$stmt = $connect->prepare("
	SELECT users.email,user_c.id AS user_id, user_c.firstname
 	AS user_firstname, partner_c.id AS partner_id, partner_c.firstname 
	AS partner_firstname
	,partner_c.lastname
	,partner_c.cb_religion
	,partner_c.cb_functionalarea
	,partner_c.avatar
	,partner_c.cb_dateofbirth
	FROM t4qcm_comprofiler AS user_c
	JOIN t4qcm_comprofiler AS partner_c 
	ON user_c.cb_complexion2 = partner_c.cb_complexion
	AND user_c.cb_religion2 = partner_c.cb_religion
	AND user_c.cb_smoking2 = partner_c.cb_smoking
	AND user_c.cb_drinking2 = partner_c.cb_drinking
	AND user_c.cb_eatinghabits2 = partner_c.cb_eatinghabits
	AND user_c.cb_height2 = partner_c.cb_height
	AND user_c.cb_weight2 = partner_c.cb_weight
	AND user_c.cb_maritalstatus2 = partner_c.cb_maritalstatus
	AND partner_c.cb_gender != user_c.cb_gender
	AND partner_c.cb_gender = '$gender'
	INNER JOIN t4qcm_comprofiler_members AS members
	ON user_c.id = members.referenceid
        AND partner_c.id != members.memberid
	INNER JOIN t4qcm_users AS users ON user_c.id = users.id
	LIMIT 0 , 30");

	$stmt->bind_param("s",$gender); 
	$stmt->execute();
		$stmt->bind_result($useremail,$userid,$userfirstname,$partnerid,$partnerfirstname,$partnerlastname,$partnerreligion,$partnerfunctionalarea,$partneravatar,$partnerdob);
$stmt->store_result();

Please Log in to join the conversation.

8 years 3 weeks ago #280693 by krileon
Replied by krileon on topic Auto profile search
Privacy checks are only applied to getFields API calls so it'll do nothing against your queries values. The easiest way to do what you're wanting is to create a userlist and use advanced filtering to filter it to meet your criteria. If you then want it shown on profile that can be done with an iframe for example. The userlist output will respect privacy settings.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 3 weeks ago #280704 by pranaydhruv
Replied by pranaydhruv on topic Auto profile search
Hello kyle,

my idea is to run this query in a loop and fetch the preferences of all females one day of the week and email them those profiles, and similar query on another weekday for males and email them their respective matches. For this i am using PHP mailer class.I plan to later point this file to a cron job which will be scheduled for those 2 days of the week and will auto run and send them matches based on the preferences they select. Doing this the way you suggest will need to publish a userlist for each profile and then email them ?

is there not other way to get this emailed for my case as explained ?
Maybe someway to add their connections based on which the query ca restrain from only suggesting non connections and also their privacy settings into a table from the query can fetch this info too ?



Thanks
Pranay

Please Log in to join the conversation.

8 years 3 weeks ago #280741 by krileon
Replied by krileon on topic Auto profile search
You don't need a userlist per user. You'd only need 1 userlist. The userlist would condition who it displays based off who is viewing it. I don't know how to help you in regards to email them. Your query usage will probably work fine, but you'll have to forget privacy usage as you won't be able to do privacy checks like that.

Only a few privacy values can be checked via query while most need to be done via API. You could have a checkbox field I suppose where a user can select if they want to be included in such emails then just check the value in the WHERE statement of your query.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 3 weeks ago - 8 years 3 weeks ago #280769 by pranaydhruv
Replied by pranaydhruv on topic Auto profile search
Hello Kyle,

to be specific i am only wanting the Photo privacy feature to be used in this mailer function That i have developed. Can you please guide me which table stores the Photo privacy setting of the user which i can query and use in mailer ?

Thanks
Pranay

Please Log in to join the conversation.

8 years 3 weeks ago - 8 years 3 weeks ago #280776 by krileon
Replied by krileon on topic Auto profile search
All privacy rules are stored in __comprofiler_plugin_privacy, but as I've already explained without API it won't matter as you'll only be able to check like 1 privacy rule (99 for private) as the others need API. You'd have to do this within CB or Joomla to have access to API. So for example a Code action or a Code field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.235 seconds

Facebook Twitter LinkedIn