PluginProbe
Private groups / trunk
Private groups vtrunk
trunk 1.5 1.6 1.7 1.8 1.8.1 1.9.1 1.9.2 2.0 2.0.1 2.2 2.3 2.4 2.5 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 116 releases
bbp-private-groups / includes / management_info.php

management_info.php in Private groups trunk, at includes/management_info.php

213 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php //************************* Management Info *************************//
2 function management_info () {
3 ?>
4 <?php
5 global $wpdb;
6 global $rpg_disable_groups ;
7 global $rpg_groups ;
8 global $rpg_topic_permissions ;
9 ?>
10 <?php settings_fields( 'rpg_group_settings' ); ?>
11
12 <table class="form-table">
13
14 <?php
15 $count=count ($rpg_groups) ;
16 for ($i = 0 ; $i < $count ; ++$i) {
17 $g=$i+1 ;
18 $display=__( 'Group', 'bbp-private-groups' ).$g ;
19 $name="group".$g ;
20 $item="rpg_groups[".$name."]" ;
21
22 ?>
23 <!------------------------- Group --------------------------------------------->
24 <tr valign="top">
25 <th>
26 <?php echo $display ;
27 if (!empty($rpg_disable_groups[$name])) {
28 echo ' <i>' ;
29 _e('Disabled', 'bbp-private-groups') ;
30 echo '</i>' ;
31 }
32 ?>
33 </th>
34
35 <td>
36 <?php _e('Group name :', 'bbp-private-groups') ; ?>
37 <?php $role_name = (!empty($rpg_groups[$name]) ? $rpg_groups[$name] : ''); ?>
38 <?php echo $role_name.'<br>' ; ?>
39 <?php _e('No. users in this group : ' , 'bbp-private-groups') ; ?>
40 <?php
41 $users=$wpdb->get_col("select ID from $wpdb->users") ;
42 $countu=0 ;
43 foreach ($users as $user) {
44
45 $check= get_user_meta( $user, 'private_group',true);
46 //single user check
47 if ($check==$name) $countu++ ;
48 //multiple group set
49 if (strpos($check, '*'.$name.'*') !== FALSE) $countu++;
50 }
51 echo $countu ;
52 ?>
53
54
55 <br>
56 <?php _e('Forums in this group :' , 'bbp-private-groups') ; ?>
57 <?php
58 $forum = bbp_get_forum_post_type() ;
59 $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='$forum'") ;
60 $countu=0 ;
61 echo '<ul><i>' ;
62 foreach ($forums as $forum) {
63 $meta = (array)get_post_meta( $forum, '_private_group', false );
64 foreach ($meta as $meta2) {
65 if ($meta2==$name) {
66 $ftitle=bbp_forum_title($forum) ;
67 echo '<li>'.$ftitle.'</li>' ;
68 $countu++ ;
69 }
70 }
71
72 }
73 echo '</ul></i>' ;
74
75 _e('No. forums that have this group set : ', 'bbp-private-groups' ) ;
76 echo $countu ;
77 ?>
78 </td>
79 </tr>
80
81
82 <!------------------------- FORUMS --------------------------------------------->
83 <?php }
84 ?>
85 </table>
86 <table>
87 <tr>
88 </tr>
89
90 <tr>
91 <th>
92 <?php echo 'Forums' ?>
93 </th>
94 <th>
95 <?php echo 'Groups' ?>
96 </th>
97 <?php
98
99 if (!empty ($rpg_topic_permissions) ) echo '<th>Topic Permissions</th>' ; ?>
100 </tr>
101
102 <?php if ( bbp_has_forums() ) :
103
104 while ( bbp_forums() ) : bbp_the_forum();
105 ?>
106 <tr>
107 <td style="vertical-align:top">
108 <?php bbp_forum_title() ; ?>
109 </td>
110
111 <td>
112 <?php
113 $id = get_the_ID () ;
114 $meta = get_post_meta( $id, '_private_group', false );
115 foreach ( $rpg_groups as $group => $details ) {
116 if ( is_array( $meta ) && in_array( $group, $meta ) ) {
117 $groupname=__('Group','bbp-private-groups').substr($group,5,strlen($group)) ;
118 $tp = '_private_group_'.$group ;
119 $perm = get_post_meta($id, $tp, true) ;
120 $value = (!empty ($perm ) ? $perm : '4' );
121
122 $valuename1 = __('Only View Topics/Replies', 'bbp-private-groups') ;
123 $valuename2 = __('Create/Edit Topics (and view all topics/replies)', 'bbp-private-groups') ;
124 $valuename3 = __('Create/Edit Replies (and view all topics/replies)', 'bbp-private-groups') ;
125 $valuename4 = __('Create/Edit Topics and Replies (and view all topics/replies)', 'bbp-private-groups') ;
126 $valuename5 = __('Create/Edit/view OWN Topics, create/edit Replies to those topics and view any Replies to those topics', 'bbp-private-groups') ;
127 $valuex = 'valuename'.$value ;
128 $valuename = $$valuex ;
129 echo $groupname.' '.$details ;
130 if (!empty ($rpg_topic_permissions) ) echo '<td>'.$valuename.'</td>' ;
131 echo '</td></tr><tr><td></td><td>';
132 } // end of if is in array $meta
133 } // end of foreach $rpg groups
134 //now display non logged in users
135 $valuename0 = __('No visibility or access to this forum', 'bbp-private-groups') ;
136 if (bbp_allow_anonymous()) {
137
138 $desc = __('Non-logged in & Anonymous Users', 'bbp-private-groups');
139 }
140 else {
141 $desc = __('Non-logged in users', 'bbp-private-groups');
142 }
143 echo '<tr><td></td><td>' ;
144 echo $desc ;
145 echo '</td><td>' ;
146 $perm = get_post_meta($id ,'_private_group_nonloggedin', true) ;
147 $value = (!empty ($perm ) ? $perm : '0' );
148 $valuex = 'valuename'.$value ;
149 $valuename = $$valuex ;
150 echo $valuename ;
151 ?>
152 </td>
153 </tr>
154
155 <?php
156 $sub_forums = bbp_forum_get_subforums() ;
157 if (!empty ($sub_forums) ) {
158 foreach ( $sub_forums as $sub_forum ) {
159 $id = $sub_forum->ID ;
160 $title = bbp_get_forum_title( $sub_forum->ID );
161 echo '<tr><td style="vertical-align:top"><i>'.$title.'</i></td><td>' ; ?>
162 <?php global $rpg_topic_permissions ;
163 $meta = get_post_meta( $sub_forum->ID, '_private_group', false );
164 foreach ( $rpg_groups as $group => $details ) {
165 if ( is_array( $meta ) && in_array( $group, $meta ) ) {
166 $groupname=__('Group','bbp-private-groups').substr($group,5,strlen($group)) ;
167 $tp = '_private_group_'.$group ;
168 $perm = get_post_meta($id, $tp, true) ;
169 $value = (!empty ($perm ) ? $perm : '4' );
170 $valuename1 = __('Only View Topics/Replies', 'bbp-private-groups') ;
171 $valuename2 = __('Create/Edit Topics (and view all topics/replies)', 'bbp-private-groups') ;
172 $valuename3 = __('Create/Edit Replies (and view all topics/replies)', 'bbp-private-groups') ;
173 $valuename4 = __('Create/Edit Topics and Replies (and view all topics/replies)', 'bbp-private-groups') ;
174 $valuename5 = __('Create/Edit/view OWN Topics, create/edit Replies to those topics and view any Replies to those topics', 'bbp-private-groups') ;
175 $valuex = 'valuename'.$value ;
176 $valuename = $$valuex ;
177 echo $groupname.' '.$details ;
178 if (!empty ($rpg_topic_permissions) ) echo '<td>'.$valuename.'</td>' ;
179 echo '</td></tr><tr><td></td><td>';
180 } // end of if is in array $meta
181 } // end of foreach $rpg groups
182 ?>
183 </td>
184 </tr>
185 <?php
186
187 } //end of foreach sub forums
188 } //end of !empty sub forums
189 ?>
190
191
192
193
194
195 <?php
196 endwhile;
197
198 endif;
199
200
201
202
203
204 ?>
205
206 </table>
207
208 </form>
209 </div><!--end sf-wrap-->
210 </div><!--end wrap-->
211
212 <?php
213 }