About visibility

Hi UNA team;

I need soome details about how visibiliity of objects are registered in the database.

For instance for a profile post I can see in the timeline table there is a visibility field, but if the visibility set to selected friends and multiple friends are set where is this information recorded?

Also for some objects I see negative values for visiblity field like -2 what does this mean please?

Best regards;

  • 384
  • More
Replies (9)
    • Hello @Cem !

      The privacy is system universal part that's wy we don't like when someone tries to edit itcodes directly. How it works by the Persons app example. It's enough to have the records in the install/sql/enable.sql file like:

      INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `spaces`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES

      ('bx_persons_allow_view_to', 'bx_persons', 'view', '_bx_persons_form_profile_input_allow_view_to', '3', '', 'bx_persons_data', 'id', 'author', 'BxPersonsPrivacy', 'modules/boonex/persons/classes/BxPersonsPrivacy.php')

      The values like -2 means that the item has been posted into context and in this case it has the "negative" id of context.

      • Thank you Leonid 👋

        I guess our site is one of the most customized UNA platforms. But we have one unique feature, we don't touch UNA code at all 😊. We have another tiny layer over it and we do every customization there.

        I only read the code and everyday respect more and more to this great work!

        We are thankful to UNA team for enabling us the UNA platform -a rare piece of programming art-. ❤️

        • Leonid could you also comment on this please:

          "but if the visibility set to selected friends and multiple friends are set where is this information recorded?"

          • This part depends form the

            `sys_privacy_groups`, `sys_privacy_groups_custom` and `sys_privacy_groups_custom_members` tables.

            • thank you Leonid !

              • This system seems like quite complex :)

                Could you please show an example SQL to find a profile post of user A, which is visible to selected friends B and C ? This will help me a lot. @LeonidS

                • Hello

                  A query for Posts module:

                  SELECT * FROM `bx_posts_posts` AS `tp` 
                  LEFT JOIN `sys_privacy_groups_custom` AS `tgc` ON `tp`.`id`=`tgc`.`content_id` AND `tp`.`author`=`tgc`.`profile_id` AND `tgc`.`object`='bx_posts_allow_view_to'
                  LEFT JOIN `sys_privacy_groups_custom_members` AS `tgcm` ON `tgc`.`id`=`tgcm`.`group_id` AND `tgcm`.`member_id` IN ('B', 'C')
                  WHERE `tp`.`author`='A' AND `tp`.`allow_view_to`='6'
                  
                  • thank you Anton now I understant the connections. 😊

                    • You are welcome!

                      Login or Join to comment.