Skip to Content Skip to Menu

need sql help for privacy policy

17 years 7 months ago #36320 by slycaulfey
need sql help for privacy policy was created by slycaulfey
Need help with an sql statement. Trying to retrieve a single element from the type field in comprofiler_member table. It stores data in this format: Co Workers|*|Personal|*|Private
this statement will not work

select 1 from jos_comprofiler_members where referenceid=10 and memberid=11 and IN explode (type("|*|",Private))and accepted=1 and pending=0

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

  • p9939068
  • p9939068
  • OFFLINE
  • Posts: 186
  • Thanks: 0
  • Karma: 117
17 years 6 months ago #36366 by p9939068
Replied by p9939068 on topic Re:need sql help for privacy policy
what is it exactly you're trying to achieve? Your sql statement is definitely wrong.


Mike Feng
Creator of SIMGallery, SIMAnswers, and ParaInvite
www.simbunch.com
twitter.com/simbunch

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

17 years 6 months ago #36444 by slycaulfey
Replied by slycaulfey on topic Re:need sql help for privacy policy
Example:
Trying to retrieve a single element from the type field in `comprofiler_member` table. It stores data in this format: Co Workers|*|Personal|*|Private|*|Friends etc...
Lets say that we have a friends connection in community builder. Privacy policy can be set to run a sql statement to determine who sees what tab in community builder. I made a private tab which I want to show to users that I made a private connection to only. I want to run a sql statement to check if we have an active connection and that you have Private in the type column of the comprofiler_member table.

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

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 6 months ago #36445 by mikko
Replied by mikko on topic Re:need sql help for privacy policy
select 1 from jos_comprofiler_members where referenceid=10 and memberid=11 and type like '%Private%' and accepted=1 and pending=0

Just make sure that you do not have any options which contain "private" as a substring.

mikko

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

17 years 6 months ago #36500 by slycaulfey
Replied by slycaulfey on topic Re:need sql help for privacy policy
Thanks for the resonose mikko

I already tried that statement. Your privacy policy don't like the 'single quotes', and it don't work.

Notice: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''67'' at line 1 in C:\Program Files\xampp\htdocs\domain\includes\database.php on line 294

Notice: Trying to get property of non-object in C:\Program Files\xampp\htdocs\domain\components\com_comprofiler\plugin\user\plug_privacypolicy\privacypolicy.php on line 115

You get these two errors if you use that statement. I know that they are the defualt PP tab errors and don't really matter.
I set the contact info tab to Private Connection, which is a policy I made. The problem is that the tab don't show to private connections. And each time you click on any community builder connection you get the privacy policy updated alert(every time you do anything).

You also get this one when you click on a connection profile.
Notice: Unknown column 'Privacy' in 'field list' in C:\Program Files\xampp\htdocs\domain\includes\database.php on line 294

Other problems: If you create a new policy and select 'users can choose policy'. It saves it in backend, but when you run an action that updates plugin in front end, the backend goes back to 'No' and users can't see the new policy.

If you select a new default policy it is not reflected in front end.

If you run this as a policy:
select 1 from #__comprofiler_members where referenceid={$my} and memberid={$user} and type like '%Privacy%'and accepted=1 and pending=0;

It brakes the whole string because of the single quotes, if you remove them it don't work either, can't use double quotes "%Privacy%" or escape quotes \"%Privacy%\" either because they are removed after front end plugin update.

Here is the debug results in front end with single quotes.

UPDATE jos_comprofiler_plugin SET params ='userCanConfigure=11|*|12|*|15|*|16|*|21|*|33|*|34|*|2
pol1_title=Show to all users
pol1_sql=select 1;
enable_pol1=
pol2_title=Show to all registered users
pol2_sql=select 1 from #__comprofiler where {$my} > 0;
enable_pol2=
pol3_title=Show to users with connection
pol3_sql=select 1 from #__comprofiler_members where referenceid={$my} and memberid={$user} and accepted=1 and pending=0;
enable_pol3=
pol4_title=Private Connection
pol4_sql=select 1 from #__comprofiler_members where referenceid={$my} and memberid={$user} and type like '%Privacy%'and accepted=1 and pending=0;
enable_pol4=
pol5_title=
pol5_sql=
enable_pol5=
defaultPolicy=4' where element='privacypolicy'

Post edited by: slycaulfey, at: 2007/04/27 17:47

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

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 6 months ago #36504 by mikko
Replied by mikko on topic Re:need sql help for privacy policy
Seems that you found a bug in my code. Try using double quotes instead of single quotes. (I will fix the bug after I get some other work done first)

Mikko

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

Moderators: beatnantkrileon
Powered by Kunena Forum