BP_Activity_Privacy

BP_Activity_Privacy Class.

Defined (1)

The class is defined in the following location(s).

/includes/bp-activity-privacy-loader.php  
  1. class BP_Activity_Privacy { 
  2.  
  3. var $profile_activity_privacy_levels = array(); 
  4. var $groups_activity_privacy_levels = array(); 
  5.  
  6. var $profile_activity_visibility_levels = array(); 
  7. var $groups_activity_visibility_levels = array(); 
  8.  
  9. function __construct() { 
  10. global $bp; 
  11.  
  12. // Register the visibility levels 
  13. $this->profile_activity_privacy_levels = array( 
  14. 'public', 'loggedin', 'adminsonly', 'onlyme' 
  15. ); 
  16.  
  17. $this->groups_activity_privacy_levels = array( 
  18. 'public', 'loggedin', 'adminsonly', 'onlyme' 
  19. ); 
  20.  
  21. if ( bp_is_active( 'friends' ) ) { 
  22. $this->profile_activity_privacy_levels [] = 'friends'; 
  23. $this->groups_activity_privacy_levels [] = 'friends'; 
  24.  
  25. if ( bp_is_active( 'groups' ) ) { 
  26. $this->groups_activity_privacy_levels [] = 'groupfriends'; 
  27. $this->groups_activity_privacy_levels [] = 'grouponly'; 
  28. $this->groups_activity_privacy_levels [] = 'groupmoderators'; 
  29. $this->groups_activity_privacy_levels [] = 'groupadmins'; 
  30.  
  31. //mentioned 
  32. // https://buddypress.trac.wordpress.org/changeset/7193 
  33. if ( function_exists('bp_activity_do_mentions') ) { 
  34. if ( bp_activity_do_mentions() ) { 
  35. $this->profile_activity_privacy_levels [] = 'mentionedonly'; 
  36. $this->groups_activity_privacy_levels [] = 'mentionedonly';  
  37. }  
  38. } else { 
  39. //$this->profile_activity_privacy_levels [] = 'mentionedonly'; 
  40. //$this->groups_activity_privacy_levels [] = 'mentionedonly';  
  41.  
  42. // Register the visibility levels 
  43. $this->profile_activity_visibility_levels = array( 
  44. 'public' => array( 
  45. 'id' => 'public',  
  46. 'label' => __( 'Anyone', 'bp-activity-privacy' ),  
  47. 'default' => true,  
  48. 'position' => 10,  
  49. 'disabled' => false 
  50. ),  
  51. 'loggedin' => array( 
  52. 'id' => 'loggedin',  
  53. 'label' => __( 'Logged In Users', 'bp-activity-privacy' ),  
  54. 'default' => false,  
  55. 'position' => 20,  
  56. 'disabled' => false  
  57. ); 
  58.  
  59. if ( bp_is_active( 'friends' ) ) { 
  60. $this->profile_activity_visibility_levels['friends'] = array( 
  61. 'id' => 'friends',  
  62. 'label' => __( 'My Friends', 'bp-activity-privacy' ),  
  63. 'default' => false,  
  64. 'position' => 30,  
  65. 'disabled' => false  
  66. ); 
  67.  
  68. //mentioned 
  69. // https://buddypress.trac.wordpress.org/changeset/7193 
  70. if ( function_exists('bp_activity_do_mentions') ) {  
  71. if ( bp_activity_do_mentions() ) { 
  72. $this->profile_activity_visibility_levels['mentionedonly'] = array( 
  73. 'id' => 'mentionedonly',  
  74. 'label' => __( 'Mentioned Only', 'bp-activity-privacy' ),  
  75. 'default' => false,  
  76. 'position' => 40,  
  77. 'disabled' => false  
  78. );  
  79. }else { 
  80. /** 
  81. $this->profile_activity_visibility_levels['mentionedonly'] = array( 
  82. 'id' => 'mentionedonly',  
  83. 'label' => __( 'Mentioned only', 'bp-activity-privacy' ),  
  84. 'default' => false,  
  85. 'position' => 40,  
  86. 'disabled' => false  
  87. ); */  
  88.  
  89. $this->profile_activity_visibility_levels['adminsonly'] = array( 
  90. 'id' => 'adminsonly',  
  91. 'label' => __( 'Admins Only', 'bp-activity-privacy' ),  
  92. 'default' => false,  
  93. 'position' => 50,  
  94. 'disabled' => false  
  95. ); 
  96.  
  97. $this->profile_activity_visibility_levels['onlyme'] = array( 
  98. 'id' => 'onlyme',  
  99. 'label' => __( 'Only Me', 'bp-activity-privacy' ),  
  100. 'default' => false,  
  101. 'position' => 60,  
  102. 'disabled' => false  
  103. ); 
  104.  
  105. $this->groups_activity_visibility_levels = array( 
  106. 'public' => array( 
  107. 'id' => 'public',  
  108. 'label' => __( 'Anyone', 'bp-activity-privacy' ),  
  109. 'default' => true,  
  110. 'position' => 10,  
  111. 'disabled' => false  
  112. ),  
  113. 'loggedin' => array( 
  114. 'id' => 'loggedin',  
  115. 'label' => __( 'Logged In Users', 'bp-activity-privacy' ),  
  116. 'default' => false,  
  117. 'position' => 20,  
  118. 'disabled' => false  
  119. ); 
  120.  
  121. if ( bp_is_active( 'friends' ) ) { 
  122. $this->groups_activity_visibility_levels['friends'] = array( 
  123. 'id' => 'friends',  
  124. 'label' => __( 'My Friends', 'bp-activity-privacy' ),  
  125. 'default' => false,  
  126. 'position' => 30,  
  127. 'disabled' => false  
  128. ); 
  129. if ( bp_is_active( 'groups' ) ) { 
  130. $this->groups_activity_visibility_levels['groupfriends'] = array( 
  131. 'id' => 'groupfriends',  
  132. 'label' => __( 'My Friends in Group', 'bp-activity-privacy' ),  
  133. 'default' => false,  
  134. 'position' => 40,  
  135. 'disabled' => false  
  136. ); 
  137.  
  138. //mentioned 
  139. // https://buddypress.trac.wordpress.org/changeset/7193 
  140. if ( function_exists('bp_activity_do_mentions') ) {  
  141. if ( bp_activity_do_mentions() ) { 
  142. $this->groups_activity_visibility_levels['mentionedonly'] = array( 
  143. 'id' => 'mentionedonly',  
  144. 'label' => __( 'Mentioned Only', 'bp-activity-privacy' ),  
  145. 'default' => false,  
  146. 'position' => 50,  
  147. 'disabled' => false  
  148. );  
  149. } else { 
  150. /** 
  151. $this->groups_activity_visibility_levels['mentionedonly'] = array( 
  152. 'id' => 'mentionedonly',  
  153. 'label' => __( 'Mentioned only', 'bp-activity-privacy' ),  
  154. 'default' => false,  
  155. 'position' => 50,  
  156. 'disabled' => false  
  157. ); */  
  158.  
  159. if ( bp_is_active( 'groups' ) ) { 
  160. $this->groups_activity_visibility_levels['grouponly'] = array( 
  161. 'id' => 'grouponly',  
  162. 'label' => __( 'Group Members', 'bp-activity-privacy' ),  
  163. 'default' => false,  
  164. 'position' => 60,  
  165. 'disabled' => false  
  166. ); 
  167.  
  168. $this->groups_activity_visibility_levels['groupmoderators'] = array( 
  169. 'id' => 'groupmoderators',  
  170. 'label' => __( 'Group Moderators', 'bp-activity-privacy' ),  
  171. 'default' => false,  
  172. 'position' => 70,  
  173. 'disabled' => false  
  174. ); 
  175.  
  176. $this->groups_activity_visibility_levels['groupadmins'] = array( 
  177. 'id' => 'groupadmins',  
  178. 'label' => __( 'Group Admins', 'bp-activity-privacy' ),  
  179. 'default' => false,  
  180. 'position' => 80,  
  181. 'disabled' => false  
  182. ); 
  183. }  
  184.  
  185. $this->groups_activity_visibility_levels['adminsonly'] = array( 
  186. 'id' => 'adminsonly',  
  187. 'label' => __( 'Admins Only', 'bp-activity-privacy' ),  
  188. 'default' => false,  
  189. 'position' => 90,  
  190. 'disabled' => false,  
  191. ); 
  192.  
  193. $this->groups_activity_visibility_levels['onlyme'] = array( 
  194. 'id' => 'onlyme',  
  195. 'label' => __( 'Only Me', 'bp-activity-privacy' ),  
  196. 'default' => false,  
  197. 'position' => 100,  
  198. 'disabled' => false,  
  199. );  
  200.  
  201. $this->includes(); 
  202.  
  203. function includes() { 
  204. // Files to include 
  205. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-actions.php' ); 
  206. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-filters.php' ); 
  207. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-template.php' ); 
  208. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-functions.php' ); 
  209. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-cssjs.php' ); 
  210. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-ajax.php' ); 
  211.  
  212. // fix / integration with some plugins 
  213. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-integrations.php' ); 
  214.  
  215. // As an follow of how you might do it manually, let's include the functions used 
  216. // on the WordPress Dashboard conditionally:  
  217. if ( is_super_admin() && ( is_admin() || is_network_admin() ) ) { 
  218. include( BP_ACTIVITY_PRIVACY_PLUGIN_DIR . '/includes/bp-activity-privacy-admin.php' ); 
  219. $this->admin = new BPActivityPrivacy_Admin; 
  220.