1. davidunwin
  2. Support
  3. Wednesday, November 28 2018, 11:42 AM
We have set up privacy settings for a number of fields. What we would now like to do is set privacy setting on a number of the fields for our existing users. Essentially set the setting from Public to Site Users. Is there a script or something like it to achieve this?
Kind regards
admin Accepted Answer
Admin
Hi,
this is not necessary because you can set "Default Value" for privacy in each field.
Attachments (1)
  1. more than a month ago
  2. Support
  3. # 1
davidunwin Accepted Answer
Hi, We have the Default set to 'Site Members'. This works for any new user who registers on the site. However, Users who registered before we changed the default still have what was set before ie Private or Public. What we want to do is a mass change from for all users Privacy settings to 'Site Members' on the fields where we have 'Enable Privacy Controll' set to YES

David
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
Hi,
sorry there is not a script that do something like this. But you can manage this with SQL queries.

REMOVE ALL PRIVACY VALUES
If you need to reset all privacy values (so all user inherit default value) then you can delete all values from privacy column in the table #__jsn_users with a query like this:
UPDATE #__jsn_users SET privacy = '';


CHANGE PRIVACY VALUES
Privacy of each field is store with JSON format in the column called "privacy" (table #__jsn_users), so you can use these queries for each field:
UPDATE #__jsn_users SET privacy = REPLACE(privacy, '"privacy_fieldalias":"0"', '"privacy_fieldalias":"1"') WHERE INSTR(privacy, 'privacy_fieldalias') > 0;
UPDATE #__jsn_users SET privacy = REPLACE(privacy, '"privacy_fieldalias":"99"', '"privacy_fieldalias":"1"') WHERE INSTR(privacy, 'privacy_fieldalias') > 0;

The first query change privacy from Public to Site Members, the second from Private to Site Members

NOTE: we recommend you to make a backup of your DB before do this
  1. more than a month ago
  2. Support
  3. # 3
davidunwin Accepted Answer
Thank you for the information.
I will backup our site and try this. I also have test site I can try it on first.

Kind regards and thanks again for quick response.

David
  1. more than a month ago
  2. Support
  3. # 4
davidunwin Accepted Answer
Before I do this I want to ask something as I am not an SQL expert
Here is an example of one of our user's privacy entry.
{"privacy_email":"1","privacy_birthday":"1","privacy_address_line1":"0","privacy_city":"0","privacy_post_code":"0","privacy_telephone":"0","privacy_mobile":"0","privacy_next_of_kin":"99","privacy_emergency_telehone":"99","privacy_other_information":"99"}

You can see that some fields are set '1' some to '0' and some ' to '99'
So I am assuming :
0=public
1= site members
99=private
is that correct?

So if I want to set all the Privacy Fields (ie privacy_email,privacy_birthday, privacy_mobile) fields to 1 (site members) do I just have to run both SQL queries you had in your response above?

Kind regards
David
  1. more than a month ago
  2. Support
  3. # 5
  • Page :
  • 1


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