Changeset 637712
- Timestamp:
- 12/12/2012 01:17:16 PM (13 years ago)
- Location:
- wp-bulletin-board
- Files:
-
- 12 edited
- 1 copied
-
tags/1.1.0 (copied) (copied from wp-bulletin-board/trunk)
-
tags/1.1.0/css/wpbb-light-style.css (modified) (3 diffs)
-
tags/1.1.0/php/facebook/wpbb-facebook.php (modified) (4 diffs)
-
tags/1.1.0/php/twitter/wpbb-twitter.php (modified) (1 diff)
-
tags/1.1.0/php/wpbb-forum.php (modified) (51 diffs)
-
tags/1.1.0/readme.txt (modified) (4 diffs)
-
tags/1.1.0/wp-bb.php (modified) (22 diffs)
-
trunk/css/wpbb-light-style.css (modified) (3 diffs)
-
trunk/php/facebook/wpbb-facebook.php (modified) (4 diffs)
-
trunk/php/twitter/wpbb-twitter.php (modified) (1 diff)
-
trunk/php/wpbb-forum.php (modified) (51 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/wp-bb.php (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-bulletin-board/tags/1.1.0/css/wpbb-light-style.css
r607181 r637712 1 1 /* 2 2 WPBB light style 3 4 To be used on a light background, preferably white5 6 This only affects the front end as the back end implements wordpress styling.7 3 */ 8 4 … … 30 26 font-weight:bold; 31 27 padding-bottom:10px; 28 } 29 30 /* Change the forum title position and color of the slash (/) character here */ 31 h2.wpbb-forum-title { 32 text-align:center; 33 padding-bottom:10px; 34 } 35 36 /* Change the color of the forum title link here, boldness, etc */ 37 h2.wpbb-forum-title a { 38 font-weight:bold; 39 color:purple; 32 40 } 33 41 … … 184 192 min-width: 500px; 185 193 white-space: pre-line; 194 text-align:left; 186 195 } 187 196 -
wp-bulletin-board/tags/1.1.0/php/facebook/wpbb-facebook.php
r607181 r637712 9 9 $user_id = get_current_user_id(); 10 10 11 if ($user_id !== 0) { // User is logged in 12 11 if ($user_id !== 0) 12 { 13 // User is logged in 13 14 $user_access_token = get_user_meta($user_id, 'wpbb_facebook_access_token', true); 14 15 if ($user_access_token != "" && is_user_logged_in()) { // User is logged into Facebook16 15 if ($user_access_token != "" && is_user_logged_in()) 16 { 17 // User is logged into Facebook 17 18 $logged_into_facebook = true; 18 19 if (count($_GET) == 0){19 if (count($_GET) == 0) 20 { 20 21 ?> 21 22 <div class="wpbb-centered"> … … 25 26 <?php 26 27 } 27 28 } 29 30 31 } else { // User is not logged in 32 33 // Registering for a Wordpress account through Facebook 28 } 29 } 30 else 31 { 32 /* 33 User is not logged in 34 Registering for a Wordpress account through Facebook 35 */ 34 36 if ((isset($_GET['register'])) && (isset($_GET['method'])) && (count($_GET) == 2)) { 35 37 … … 130 132 <br /> 131 133 <div class="wpbb-centered"> 132 <?php printf(__('Thank you for logging in to Facebook, %s!'), $facebook_user['name']); ?>134 <?php printf(__('Thank you for logging in to Facebook, %s!'), $facebook_user['name']); ?> 133 135 <br /><br /> 134 136 <?php _e('Please now enter the password for your Wordpress account you registered using Facebook.', 'wp-bb'); ?><br /><br /><?php … … 238 240 <div class="wpbb-message-success"> 239 241 <?php 240 _e('Thank you for registering. Please login with your Facebook username and password you just created', 'wp-bb');242 _e('Thank you for registering. Please login with your Facebook username and password you just created', 'wp-bb'); 241 243 ?> 242 244 </div> -
wp-bulletin-board/tags/1.1.0/php/twitter/wpbb-twitter.php
r611368 r637712 5 5 */ 6 6 7 if (count($_GET) == 0) { 7 if (count($_GET) == 0) 8 { 8 9 ?> 9 10 <div class="wpbb-centered"> -
wp-bulletin-board/tags/1.1.0/php/wpbb-forum.php
r607181 r637712 4 4 Checks if the plugin is deactivated 5 5 */ 6 7 6 8 7 // Since we're not in the admin area we must require the plugin.php file … … 18 17 <div style="text-align:center;font-weight:bold;color:red;"> 19 18 <?php 20 _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB ', 'wp-bb');19 _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB or delete this page', 'wp-bb'); 21 20 wpbb_exit(); 22 21 ?> … … 35 34 36 35 // Sets the default timezone used by all date/time functions in a script depending on server configuration option 37 if (ini_get('date.timezone.')) { 36 if (ini_get('date.timezone.')) 37 { 38 38 $timezone = ini_get('date.timezone'); 39 39 date_default_timezone_set($timezone); … … 48 48 define('POST_TABLE', $wpdb->prefix.'wpbb_posts'); 49 49 define('MESSAGES_TABLE', $wpdb->prefix.'wpbb_messages'); 50 define('UN_READ_TABLE', $wpdb->prefix.'wpbb_topics_unread'); 50 51 51 52 // The WP-BB plugin url on wordpress - only used if show footer option is set to yes … … 53 54 54 55 55 function wpbb_exit() { 56 function wpbb_exit() 57 { 56 58 get_header(); 57 59 get_footer(); … … 63 65 && (!is_user_logged_in()) 64 66 && (!isset($_GET['method'])) 65 && (!isset($_GET['state']))) { 66 if ($wpbb_facebook_options['allow_facebook'] == 'yes') { 67 && (!isset($_GET['state']))) 68 { 69 if ($wpbb_facebook_options['allow_facebook'] == 'yes') 70 { 67 71 require_once('facebook/wpbb-facebook.php'); 68 72 } 69 require_once(' wpbb-functions.php');73 require_once('functions.php'); 70 74 ?> 71 75 <div class="wpbb-centered-bold"> … … 77 81 } 78 82 79 if ($wpbb_options['maintenance_mode'] == 'on') { 80 if (current_user_can('manage_options')) { 83 if ($wpbb_options['maintenance_mode'] == 'on') 84 { 85 if (current_user_can('manage_options')) 86 { 81 87 ?> 82 88 <div class="wpbb-message-warning"> … … 84 90 </div> 85 91 <?php 86 } else { 92 } 93 else 94 { 87 95 ?> 88 96 <div class="wpbb-message-warning"> … … 90 98 </div> 91 99 <?php 92 if ($wpbb_facebook_options['allow_facebook'] == 'yes') { 100 if ($wpbb_facebook_options['allow_facebook'] == 'yes') 101 { 93 102 require_once('facebook/wpbb-facebook.php'); 94 103 } 95 require_once(' wpbb-functions.php');104 require_once('functions.php'); 96 105 wpbb_footer(); 97 106 wpbb_exit(); … … 103 112 */ 104 113 105 require_once(' wpbb-functions.php');106 107 /* 114 require_once('functions.php'); 115 116 /* 108 117 Checks a page supplied exists 109 118 */ … … 115 124 */ 116 125 117 if ($wpbb_facebook_options['allow_facebook'] == 'yes') { 126 if ($wpbb_facebook_options['allow_facebook'] == 'yes') 127 { 118 128 require_once('facebook/wpbb-facebook.php'); 119 129 } … … 126 136 $wpbb_twitter_options = get_option('wpbb_twitter_options'); 127 137 128 if ($wpbb_twitter_options['allow_twitter'] == 'yes') { 138 if ($wpbb_twitter_options['allow_twitter'] == 'yes') 139 { 129 140 require_once('twitter/wpbb-twitter.php'); 130 141 } … … 138 149 */ 139 150 151 140 152 if (empty($permalink_options)) 141 153 { 142 if (count($_GET) == 1) {143 require_once('wpbb-index.php');144 }145 154 if (count($_GET) == 1) 155 { 156 require_once('forum-index.php'); 157 } 146 158 147 159 /* … … 152 164 && (isset($_GET['current_page'])) 153 165 && (count($_GET) == 3)) { 154 require_once(' wpbb-view-forum.php');166 require_once('view-forum.php'); 155 167 } 156 168 … … 165 177 && (isset($_GET['current_page'])) 166 178 && (count($_GET) == 4)) { 167 require_once('wpbb-view-forum-topic.php'); 168 } 169 179 require_once('view-forum-topic.php'); 180 } 170 181 171 182 /* … … 177 188 && (isset($_GET['forum']) && isset($_GET['subforum'])) 178 189 && (count($_GET) == 4)) { 179 require_once(' wpbb-create-topic.php');190 require_once('create-topic.php'); 180 191 } 181 192 … … 184 195 && (isset($_GET['forum'])) 185 196 && (count($_GET) == 3)) { 186 require_once('wpbb-create-topic.php'); 187 } 188 197 require_once('create-topic.php'); 198 } 189 199 190 200 /* … … 197 207 && (isset($_GET['current_page'])) 198 208 && (count($_GET) == 4)) { 199 require_once(' wpbb-view-subforum.php');209 require_once('view-subforum.php'); 200 210 } 201 211 … … 211 221 && (isset($_GET['current_page'])) 212 222 && (count($_GET) == 5)) { 213 require_once(' wpbb-view-subforum-topic.php');223 require_once('view-subforum-topic.php'); 214 224 } 215 225 … … 221 231 && (isset($_GET['page_id'])) 222 232 && (count($_GET) == 2)) { 223 require_once(' wpbb-view-profile.php');233 require_once('view-profile.php'); 224 234 } 225 235 … … 232 242 && (isset($_GET['current_page'])) 233 243 && (count($_GET) == 3)) { 234 require_once(' wpbb-all-messages.php');244 require_once('all-messages.php'); 235 245 } 236 246 … … 243 253 && (isset($_GET['page_id'])) 244 254 && (count($_GET) > 1 && count($_GET) <= 3)) { 245 require_once(' wpbb-delete-message.php');255 require_once('delete-message.php'); 246 256 } 247 257 … … 255 265 && ((isset($_GET['view'])) && ($_GET['view'])) 256 266 && (count($_GET) == 3)) { 257 require_once(' wpbb-view-message.php');267 require_once('view-message.php'); 258 268 } 259 269 … … 265 275 && (isset($_GET['page_id'])) 266 276 && (count($_GET) == 2)) { 267 require_once(' wpbb-message-user.php');277 require_once('message-user.php'); 268 278 } 269 279 … … 281 291 && ($_GET['action'] != 'reply') 282 292 && ($_GET['action'] != 'sticky')))) { 283 require_once(' wpbb-edit-topic.php');293 require_once('edit-topic.php'); 284 294 } 285 295 … … 297 307 && ($_GET['action'] != 'reply') 298 308 && ($_GET['action'] != 'sticky')))) { 299 require_once(' wpbb-lock-topic.php');309 require_once('lock-topic.php'); 300 310 } 301 311 … … 313 323 && ($_GET['action'] != 'reply') 314 324 && ($_GET['action'] != 'edit')))) { 315 require_once(' wpbb-sticky-topic.php');325 require_once('sticky-topic.php'); 316 326 } 317 327 … … 329 339 && ($_GET['action'] != 'reply') 330 340 && ($_GET['action'] != 'sticky')))) { 331 require_once(' wpbb-delete-topic.php');341 require_once('delete-topic.php'); 332 342 } 333 343 … … 346 356 && ($_GET['action'] != 'reply') 347 357 && ($_GET['action'] != 'sticky')))) { 348 require_once(' wpbb-markread-topic.php');358 require_once('markread-topic.php'); 349 359 } 350 360 … … 363 373 && ($_GET['action'] != 'edit') 364 374 && ($_GET['action'] != 'sticky')))) { 365 require_once(' wpbb-reply-topic.php');375 require_once('reply-topic.php'); 366 376 } 367 377 … … 375 385 && (isset($_GET['current_page'])) 376 386 && (count($_GET) == 3)) { 377 require_once(' wpbb-unread-topics.php');387 require_once('unread-topics.php'); 378 388 } 379 389 … … 387 397 && (isset($_GET['current_page'])) 388 398 && (count($_GET) == 3)) { 389 require_once(' wpbb-unanswered-topics.php');399 require_once('unanswered-topics.php'); 390 400 } 391 401 392 402 // Not default or custom structure 393 403 394 } else { 395 396 if (count($_GET) == 0) { 397 require_once('wpbb-index.php'); 404 } 405 else 406 { 407 if (count($_GET) == 0) 408 { 409 require_once('forum-index.php'); 398 410 } 399 411 … … 405 417 && (isset($_GET['current_page'])) 406 418 && (count($_GET) == 2)) { 407 require_once('wpbb-view-forum.php'); 408 } 409 410 411 419 require_once('view-forum.php'); 420 } 421 412 422 /* 413 423 Viewing A Forum Topic … … 418 428 && (isset($_GET['current_page'])) 419 429 && (count($_GET) == 3)) { 420 require_once(' wpbb-view-forum-topic.php');430 require_once('view-forum-topic.php'); 421 431 } 422 432 … … 429 439 && (isset($_GET['forum']) && isset($_GET['subforum']) || isset($_GET['forum']) && !isset($_GET['subforum'])) 430 440 && (count($_GET) == 2 || count($_GET) == 3)) { 431 require_once(' wpbb-create-topic.php');441 require_once('create-topic.php'); 432 442 } 433 443 … … 440 450 && (isset($_GET['current_page'])) 441 451 && (count($_GET) == 3)) { 442 require_once(' wpbb-view-subforum.php');452 require_once('view-subforum.php'); 443 453 } 444 454 … … 453 463 && (isset($_GET['current_page'])) 454 464 && (count($_GET) == 4)) { 455 require_once(' wpbb-view-subforum-topic.php');465 require_once('view-subforum-topic.php'); 456 466 } 457 467 … … 462 472 if ((isset($_GET['profile'])) 463 473 && (count($_GET) == 1)) { 464 require_once(' wpbb-view-profile.php');474 require_once('view-profile.php'); 465 475 } 466 476 … … 474 484 && (isset($_GET['current_page'])) 475 485 && (count($_GET) == 2 || count($_GET) == 3)) { 476 require_once(' wpbb-all-messages.php');486 require_once('all-messages.php'); 477 487 } 478 488 … … 485 495 && (isset($_GET['delete_msg'])) 486 496 && (count($_GET) > 1 && count($_GET) <= 2)) { 487 require_once(' wpbb-delete-message.php');497 require_once('delete-message.php'); 488 498 } 489 499 /* … … 495 505 && ((isset($_GET['view'])) 496 506 && (count($_GET) == 2))) { 497 require_once(' wpbb-view-message.php');507 require_once('view-message.php'); 498 508 } 499 509 … … 504 514 if ((isset($_GET['message'])) 505 515 && (count($_GET) == 1)) { 506 require_once(' wpbb-message-user.php');516 require_once('message-user.php'); 507 517 } 508 518 … … 519 529 && ($_GET['action'] != 'reply') 520 530 && ($_GET['action'] != 'sticky')))) { 521 require_once(' wpbb-edit-topic.php');531 require_once('edit-topic.php'); 522 532 } 523 533 … … 534 544 && ($_GET['action'] != 'reply') 535 545 && ($_GET['action'] != 'sticky')))) { 536 require_once(' wpbb-lock-topic.php');546 require_once('lock-topic.php'); 537 547 } 538 548 … … 549 559 && ($_GET['action'] != 'reply') 550 560 && ($_GET['action'] != 'edit')))) { 551 require_once(' wpbb-sticky-topic.php');561 require_once('sticky-topic.php'); 552 562 } 553 563 … … 564 574 && ($_GET['action'] != 'reply') 565 575 && ($_GET['action'] != 'sticky')))) { 566 require_once(' wpbb-delete-topic.php');576 require_once('delete-topic.php'); 567 577 } 568 578 … … 574 584 && (isset($_GET['topic'])) 575 585 && ((isset($_GET['action']) 576 && ($_GET['action'] == 'markread') 586 && ($_GET['action'] == 'markread') 577 587 && ($_GET['action'] != 'delete') 578 588 && ($_GET['action'] != 'lock') … … 580 590 && ($_GET['action'] != 'reply') 581 591 && ($_GET['action'] != 'sticky')))) { 582 require_once(' wpbb-markread-topic.php');592 require_once('markread-topic.php'); 583 593 } 584 594 … … 596 606 && ($_GET['action'] != 'edit') 597 607 && ($_GET['action'] != 'sticky')))) { 598 require_once(' wpbb-reply-topic.php');608 require_once('reply-topic.php'); 599 609 } 600 610 … … 607 617 && (isset($_GET['current_page'])) 608 618 && (count($_GET) == 2)) { 609 require_once(' wpbb-unread-topics.php');619 require_once('unread-topics.php'); 610 620 } 611 621 … … 618 628 && (isset($_GET['current_page'])) 619 629 && (count($_GET) == 2)) { 620 require_once(' wpbb-unanswered-topics.php');630 require_once('unanswered-topics.php'); 621 631 } 622 632 } -
wp-bulletin-board/tags/1.1.0/readme.txt
r611368 r637712 3 3 Donate link: http://codebycarter.x10.mx/wp/donate/ 4 4 Tags: forum, bulletin board, twitter, facebook, discussion, discussion board, messaging, private message, topic, post, pagination, profile, subforum, wpbb 5 Requires at least: 3. 36 Tested up to: 3. 4.27 Stable tag: 1. 0.45 Requires at least: 3.0 6 Tested up to: 3.5 7 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 19 19 = Features = 20 * - Ease of Integration - WPBB creates a template file for your current template when you install or change your theme so you don't have to do anything. Everything can be managed from your admin area. 21 * - Translatable - WPBB can easily be translated into your preferred language! 22 * - Facebook registration - Allow your users to register on your Wordpress site via Facebook. This automatically creates a WP account for your Facebook users which they can then login to after authenticating. 23 * - Twitter - Enter your twitter account in your settings and your users will be able to follow your website / personal account with the click of a button. 24 * - Private Messaging System - Allow users to send messages to each other. 25 * - Member Profiles - All your WP users are automatically apart of your forum whenever you create it and have a "forum profile" which can be viewed on the forum which shows the users avatar, username, role, posts, website and signature. Signatures are apart of WPBB and allow your users to enter a signature which can be text or images and is displayed below their profile and posts. 26 * - Categories, Forums, Sub forums - Organise your forums into categories and your sub forums into forums. There is no limit to the amount of forums its parent can have, and each are ordered by its appearance in its parent. 27 * - Permissions system - Currently supports the ability to allow or disallow any role (even custom roles!) any specific permission (edit, view, read, post, reply, lock, delete, sticky). WPBB grabs all known roles from your WP site which you can set permissions for manually or copy existing permissions from a previous forum. 28 * - Topics - If you have the permissions to do so you can edit, lock, delete, sticky, view, read, post or reply with a topic. 29 * - Posts - You can edit and delete any post and the posts topic affects the posts status. You can create posts in two ways, creating a topic reply with presents the WP editor for improved formatting or you can use the quick reply feature (if it is enabled in your settings). 30 * - Pagination System - Supports a simple pagination system which organises your topics and posts - you can set the max topics/posts per page in your wpbb settings. 31 * - Unread Topics - WPBB collects a list of topics which have been posted when you were offline and displays them for you. You can mark any of them as read once you've read them. 32 * - Unanswered Topics - Similar to the above feature, unanswered topics are ones which haven't yet received any replies. 33 * - Admin area - The WPBB settings integrate with your existing WP admin area where you can easily manage your forums with ease. The WPBB overview allows you to change the order of a category, forum or sub forum, edit it and delete it with a single click. You can also create new categories, forums, sub forums and topics via the admin area. 34 * - Settings - WPBB is jam packed with settings that you can use to customise the forum any way you want to. 20 * Compatibility - Fully compatible with 3.5, 3.4, 3.3, 3.2, 3.1 and 3.0 21 * Ease of Integration - WPBB works with any theme, you can change your theme anytime and WPBB will automatically update itself. 22 * Translatable - WPBB can easily be translated into your preferred language! 23 * Facebook registration - Allow your users to register on your Wordpress site via Facebook. This automatically creates a WP account for your Facebook users which they can then login to after authenticating. 24 * Twitter - Enter your twitter account in your settings and your users will be able to follow your website / personal account with the click of a button. 25 * Private Messaging System - Allow users to send messages to each other. 26 * Member Profiles - All your WP users are automatically apart of your forum whenever you create it and have a "forum profile" which can be viewed on the forum which shows the users avatar, username, role, posts, website and signature. Signatures are apart of WPBB and allow your users to enter a signature which can be text or images and is displayed below their profile and posts. 27 * Categories, Forums, Sub forums - Organise your forums into categories and your sub forums into forums. There is no limit to the amount of forums its parent can have, and each are ordered by its appearance in its parent. 28 * Permissions system - Currently supports the ability to allow or disallow any role (even custom roles!) any specific permission (edit, view, read, post, reply, lock, delete, sticky). WPBB grabs all known roles from your WP site which you can set permissions for manually or copy existing permissions from a previous forum. 29 * Role Permissions - New in 1.1. Allows you to choose whether a role can only edit, lock, delete and sticky their own topics or everyones. 30 * Topics - If you have the permissions to do so you can edit, lock, delete, sticky, view, read, post or reply with a topic. 31 * Posts - You can edit and delete any post and the posts topic affects the posts status. You can create posts in two ways, creating a topic reply with presents the WP editor for improved formatting or you can use the quick reply feature (if it is enabled in your settings). 32 * Pagination System - Supports a simple pagination system which organises your topics and posts - you can set the max topics/posts per page in your wpbb settings. 33 * Unread Topics - WPBB collects a list of topics which have been posted when you were offline and displays them for you. You can mark any of them as read once you've read them. 34 * Unanswered Topics - Similar to the above feature, unanswered topics are ones which haven't yet received any replies. 35 * Admin area - The WPBB settings integrate with your existing WP admin area where you can easily manage your forums with ease. The WPBB overview allows you to change the order of a category, forum or sub forum, edit it and delete it with a single click. You can also create new categories, forums, sub forums and topics via the admin area. 36 * Settings - WPBB is jam packed with settings that you can use to customise the forum any way you want to. 37 * Tools - Tools help make your life easier. Tools such as updating your roles whenever you add, change or remove them and a tool to recreate the forum page if you ever accidentally delete it. 35 38 36 And m any more...39 And much much more! 37 40 38 41 == Installation == … … 60 63 Firstly always download the plugin again as the plugin is constantly updated. It is likely the problem you're having has been fixed already. If that doesn't work, create a topic here: http://wordpress.org/support/plugin/wp-bulletin-board 61 64 65 = How to Setup Facebook Integration = 66 67 1. https://developers.facebook.com/apps (register or login) 68 2. "Create New App" 69 3. Enter App Name, can be anything you want, don't worry about app namespace or web hosting. Click continue. 70 4. Facebook should've created the app for you and you'll see at the top the name of your app and the default avatar, next to that there is your App ID and App Secret Key. Enter those into your WPBB facebook settings. 71 5. You may want to enter a contact email and change any other settings to your liking but leave sandbox mode disabled and don't use the "Hosting URL" 72 6. Click "Website with Facebook Login" under "Select how your app integrates with Facebook" then enter the URL to your wpbb forum e.g. http://mysite.com/wordpress/forum 73 7. Save changes 74 75 = When I edit and save my forum or subforum, there is an error = 76 77 It is likely that you are updating a forum with roles that no longer exist. Go to your admin dashboard -> WPBB -> Tools -> Refresh Roles. Use this tool whenever you add, change or remove roles. Roles are like the ranks or capabilities that users have, e.g. subscriber, author, administrator, etc. 78 62 79 == Screenshots == 63 80 … … 71 88 72 89 == Changelog == 90 91 = 1.1.0 = 92 * Role permissions added which allow you to set whether a role can edit, lock, delete or sticky only their own topics or posts or everyones. 93 * Now compatible with wordpress versions 3.0, 3.1, 3.2, 3.3 and 3.5 94 * Fixes error in topic post editor 95 * (un)read topics are now used per user instead of globally as it should be 96 * Removed unneccessary forum prefix setting as you can include 'forum' in your own title 97 * Fixed post count not changing when deleting topics and/or posts and when editing topics and posts. 98 * Fixes a number of bugs translators encountered when trying to translate wpbb 99 * Clicking the search box now clears the textbox, more javascript will be added in the future for those that use it 100 * Added useful descriptions next to all the settings in the wpbb settings. 101 * New tool added which allows you to recreate your forums page if it was accidentally deleted or didn't create for some reason 102 * Last post/reply will now take you to that topic or post 103 * You can no longer create empty topics, posts or messages or give them empty titles 104 * You can now go straight to your newly created topic or post when creating a topic or reply. 105 * Updated FAQ 106 * Minor bug fixes and typos fixed. 73 107 74 108 = 1.0.4 = -
wp-bulletin-board/tags/1.1.0/wp-bb.php
r611368 r637712 4 4 Plugin URI: http://wordpress.org/extend/plugins/wp-bulletin-board/ 5 5 Description: An easy to use Bulletin board for Wordpress with Facebook and Twitter integration. 6 Version: 1. 0.46 Version: 1.1.0 7 7 Author: Jay Carter 8 8 Author URI: http://codebycarter.com … … 29 29 30 30 // Sets the default timezone used by all date/time functions in a script depending on server configuration option 31 if (ini_get('date.timezone.')) { 31 if (ini_get('date.timezone.')) 32 { 32 33 $timezone = ini_get('date.timezone'); 33 34 date_default_timezone_set($timezone); … … 35 36 36 37 // Define wpbb plugin directory 37 define('WPBB_DIR', plugin_dir_path(__FILE__)); 38 if (!defined('WPBB_DIR')) 39 { 40 define('WPBB_DIR', plugin_dir_path(__FILE__)); 41 } 38 42 // Contains categories, forums and subforums 39 define('CATEGORY_TABLE', $wpdb->prefix.'wpbb_categories'); 43 if (!defined('CATEGORY_TABLE')) 44 { 45 define('CATEGORY_TABLE', $wpdb->prefix.'wpbb_categories'); 46 } 40 47 // Contains all topics whether in a category, forum or subforum 41 define('TOPICS_TABLE', $wpdb->prefix.'wpbb_topics'); 48 if (!defined('TOPICS_TABLE')) 49 { 50 define('TOPICS_TABLE', $wpdb->prefix.'wpbb_topics'); 51 } 42 52 // Contains all posts inside a specific topic 43 define('POSTS_TABLE', $wpdb->prefix.'wpbb_posts'); 53 if (!defined('POSTS_TABLE')) 54 { 55 define('POSTS_TABLE', $wpdb->prefix.'wpbb_posts'); 56 } 44 57 // Contains all user messages 45 define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages'); 58 if (!defined('MESSAGE_TABLE')) 59 { 60 define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages'); 61 } 62 // Contains all topics for each user and whether they are read or not 63 if (!defined('UNREAD_TABLE')) 64 { 65 define('UNREAD_TABLE', $wpdb->prefix.'wpbb_topics_unread'); 66 } 46 67 // Define current version 47 define('WPBB_VERSION', 'v1.0.4'); 68 if (!defined('WPBB_VERSION')) 69 { 70 define('WPBB_VERSION', 'v1.1.0'); 71 } 48 72 // Define plugin url (wp plugin page) 49 define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board'); 73 if (!defined('WPBB_PLUGIN_URL')) 74 { 75 define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board'); 76 } 50 77 51 78 /* … … 53 80 */ 54 81 55 function wpbb_load_language() {56 load_plugin_textdomain('wp-bb', false, dirname(plugin_basename(__FILE__)).'/languages/');57 }58 82 add_action('plugins_loaded', 'wpbb_load_language'); 83 84 if (!function_exists('wpbb_load_language')) 85 { 86 function wpbb_load_language() 87 { 88 load_plugin_textdomain('wp-bb', false, dirname(plugin_basename(__FILE__)).'/languages/'); 89 } 90 } 59 91 60 92 /* … … 75 107 add_action('wp_enqueue_scripts', 'wpbb_register_styles'); 76 108 109 $options = get_option('wpbb_options'); 110 if ($options['post_to_forum'] == 'yes') 111 { 112 add_action('add_meta_boxes', 'wpbb_create_metaboxes'); // Metaboxes 113 add_action('save_post', 'wpbb_post_saved'); // Wordpress post saved 114 } 115 77 116 /* 78 117 All WPBB Admin (Non Page or DB related) Functions … … 81 120 */ 82 121 83 require_once('php/admin/ wpbb-admin-functions.php');122 require_once('php/admin/admin-functions.php'); 84 123 85 124 /* … … 87 126 */ 88 127 89 function wpbb_activate() { 90 // Create all neccessary database tables 91 wpbb_create_db_table(); 92 // Create options in DB for our settings 93 wpbb_create_options(); 94 // Create the user meta for all users currently registered 95 wpbb_setup_user_meta(); 96 // Creates the Forum page 97 wpbb_create_page(); 128 if (!function_exists('wpbb_activate')) 129 { 130 function wpbb_activate() 131 { 132 // Create all neccessary database tables 133 wpbb_create_db_table(); 134 // Create options in DB for our settings 135 wpbb_create_options(); 136 // Create the user meta for all users currently registered 137 wpbb_setup_user_meta(); 138 // Creates the Forum page 139 wpbb_create_page(); 140 } 98 141 } 99 142 … … 102 145 */ 103 146 104 function wpbb_uninstall() { 105 global $wpdb; 106 // Delete main options from database 107 delete_option('wpbb_options'); 108 // Delete theme options 109 delete_option('wpbb_theme_options'); 110 // Delete facebook options 111 delete_option('wpbb_facebook_options'); 112 // Delete twitter options 113 delete_option('wpbb_twitter_options'); 114 // Delete guest options 115 delete_option('wpbb_guest_options'); 116 // Delete the user meta 117 wpbb_delete_user_meta(); 118 // Delete post meta (this function is in wpbb-functions.php as the page is created in wpbb-forum.php) 119 wpbb_delete_post_meta(); 120 // Delete database tables 121 $wpdb->query("DROP TABLE ".CATEGORY_TABLE.", ".TOPICS_TABLE.", ".POSTS_TABLE.", ".MESSAGE_TABLE.";"); 122 } 123 124 function wpbb_delete_user_meta() { 125 global $wpdb; 126 $delete_user_meta = $wpdb->query("DELETE FROM ".$wpdb->prefix."usermeta WHERE meta_key LIKE 'wpbb_%';"); 127 } 128 129 function wpbb_delete_post_meta() { 130 global $wpdb; 131 $post_meta = $wpdb->prefix.'postmeta'; 132 $key = '_wp_page_template'; 133 $value = 'wpbb-template.php'; 134 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '$key' AND meta_value = '$value';"); 135 // Delete the meta data 136 delete_post_meta($post_id, $key, $value); 137 // Delete the page 138 wp_delete_post($post_id, true); 147 if (!function_exists('wpbb_uninstall')) 148 { 149 function wpbb_uninstall() 150 { 151 global $wpdb; 152 delete_option('wpbb_options'); 153 delete_option('wpbb_theme_options'); 154 delete_option('wpbb_facebook_options'); 155 delete_option('wpbb_twitter_options'); 156 delete_option('wpbb_guest_options'); 157 wpbb_delete_user_meta(); 158 wpbb_delete_post_meta(); 159 $wpdb->query("DROP TABLE ".CATEGORY_TABLE.", ".TOPICS_TABLE.", ".POSTS_TABLE.", ".MESSAGE_TABLE.", ".UNREAD_TABLE.";"); 160 } 161 } 162 163 if (!function_exists('wpbb_delete_user_meta')) 164 { 165 function wpbb_delete_user_meta() 166 { 167 global $wpdb; 168 $delete_user_meta = $wpdb->query("DELETE FROM ".$wpdb->prefix."usermeta WHERE meta_key LIKE 'wpbb_%';"); 169 } 170 } 171 172 if (!function_exists('wpbb_delete_post_meta')) 173 { 174 function wpbb_delete_post_meta() 175 { 176 global $wpdb; 177 $post_meta = $wpdb->prefix.'postmeta'; 178 $key = '_wp_page_template'; 179 $value = 'wpbb-template.php'; 180 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '$key' AND meta_value = '$value';"); 181 // Delete the meta data 182 delete_post_meta($post_id, $key, $value); 183 // Delete the page 184 wp_delete_post($post_id, true); 185 } 139 186 } 140 187 … … 143 190 */ 144 191 145 function wpbb_create_db_table() { 146 147 global $wpdb; 148 149 $options = get_option('wpbb_options'); 150 151 // This is not being activated the first time 152 //if (isset($options['version']) && $options['version'] != WPBB_VERSION) { 153 if ($options) { 154 155 wpbb_refresh_roles(); 156 157 } else { 158 192 if (!function_exists('wpbb_create_db_table')) 193 { 194 function wpbb_create_db_table() 195 { 196 global $wpdb; 197 $options = get_option('wpbb_options'); 198 if ($options) 199 { 200 wpbb_refresh_roles(); 201 } 159 202 $roles = wpbb_admin_get_all_roles('string', true); 160 161 203 $perms = "SET($roles) NOT NULL"; 162 163 204 $create_category_query = "CREATE TABLE ".CATEGORY_TABLE." ( 164 205 `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, 165 `name` VARCHAR( 25) NOT NULL,206 `name` VARCHAR(30) NOT NULL, 166 207 `description` VARCHAR(200) NOT NULL, 167 208 `forum` TINYINT(1) NOT NULL, … … 183 224 `id` INT(1) NOT NULL AUTO_INCREMENT, 184 225 `author` SMALLINT(1) NOT NULL, 185 `name` VARCHAR( 25) NOT NULL,226 `name` VARCHAR(35) NOT NULL, 186 227 `content` TEXT NULL, 187 228 `forum` TINYINT(1) NOT NULL, … … 215 256 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; 216 257 "; 258 259 $create_topic_unread_query = "CREATE TABLE ".UNREAD_TABLE." ( 260 `id` INT(1) NOT NULL, 261 `author` INT(1) NOT NULL, 262 `read` INT(1) NOT NULL 263 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 264 "; 217 265 218 266 $create_category_table = $wpdb->query($create_category_query); … … 220 268 $create_post_table = $wpdb->query($create_post_query); 221 269 $create_message_table = $wpdb->query($create_messages_query); 270 $create_topic_unread_table = $wpdb->query($create_topic_unread_query); 222 271 223 if ($create_category_table === false) { 272 if ($create_category_table === false) 273 { 224 274 $create_category_table_err = __('There was an error creating the table wpbb_categorie', 'wp-bb'); 225 error_log($create_category_table_err);275 error_log($create_category_table_err); 226 276 } 227 if ($create_topic_table === false) { 277 if ($create_topic_table === false) 278 { 228 279 $create_topic_table_err = __('There was an error creating the table wpbb_topics', 'wp-bb'); 229 280 error_log($create_topic_table_err); 230 281 } 231 if ($create_post_table === false) { 282 if ($create_post_table === false) 283 { 232 284 $create_post_table_err = __('There was an error creating the table wpbb_posts', 'wp-bb'); 233 285 error_log($create_post_table_err); 234 286 } 235 if ($create_message_table === false) { 287 if ($create_message_table === false) 288 { 236 289 $create_message_table_err = __('There was an error creating the table wpbb_messages', 'wp-bb'); 237 290 error_log($create_message_table_err); 238 291 } 292 if ($create_topic_unread_table === false) 293 { 294 $create_topic_unread_table_err = __('There was an error creating the table wpbb_topics_unread', 'wp-bb'); 295 error_log($create_topic_unread_table_err); 296 } 239 297 } 240 298 } … … 244 302 */ 245 303 246 function wpbb_create_options() { 247 // Retrieve options from database 248 $old_options = get_option('wpbb_options'); 249 // If options do not exist 250 if (!$old_options) { 251 $maintenance_message = __('This is the message that will be displayed to users when you disable the board. Edit this in your settings.', 'wp-bb'); 252 $forum_name = __('My WPBB Forum', 'wp-bb'); 253 $options = array( 254 'maintenance_mode' => 'off', 255 'maintenance_message' => $maintenance_message, 256 'forum_name' => $forum_name, 257 'forum_prefix' => 'no', 258 'allow_guests' => 'yes', 259 'allow_subforums' => 'yes', 260 'enable_quick_reply' => 'yes', 261 'topics_per_page' => 20, 262 'posts_per_page' => 20, 263 'topic_cutoff' => 15, 264 'post_cutoff' => 15, 265 'post_to_forum' => 'yes', 266 'show_footer' => 'no', 267 'version' => WPBB_VERSION 268 ); 269 $add_wpbb_options = add_option('wpbb_options', $options); 270 } else { 271 if (!isset($old_options['version'])) { 272 // Attempting to update a key in the options value will remove all the other keys so we must 273 // set all the other keys as well 304 if (!function_exists('wpbb_create_options')) 305 { 306 function wpbb_create_options() 307 { 308 // Retrieve options from database 309 $old_options = get_option('wpbb_options'); 310 /* 311 * Add all current roles to an array with a default value of 'yes' 312 * This is for our role permissions 313 */ 314 $roles = wpbb_admin_get_all_roles(); 315 $role_array = array(); 316 if ($roles) 317 { 318 foreach ($roles as $role) 319 { 320 $role_array[$role] = 'yes'; 321 } 322 } 323 // If options do not exist 324 if (!$old_options) 325 { 326 $maintenance_message = __('This is the message that will be displayed to users when you disable the board. Edit this in your settings.', 'wp-bb'); 327 $forum_name = __('My WPBB Forum', 'wp-bb'); 274 328 $options = array( 275 'maintenance_mode' => $old_options['maintenance_mode'],276 'maintenance_message' => $ old_options['maintenance_message'],277 'forum_name' => $ old_options['forum_name'],278 ' forum_prefix' => $old_options['forum_prefix'],279 'allow_ guests' => $old_options['allow_guests'],280 ' allow_subforums' => $old_options['allow_subforums'],281 ' enable_quick_reply' => $old_options['enable_quick_reply'],282 ' topics_per_page' => $old_options['topics_per_page'],283 ' posts_per_page' => $old_options['posts_per_page'],284 ' topic_cutoff' => $old_options['topic_cutoff'],285 'post_ cutoff' => $old_options['post_cutoff'],286 ' post_to_forum' => $old_options['post_to_forum'],287 ' show_footer' => $old_options['show_footer'],329 'maintenance_mode' => 'off', 330 'maintenance_message' => $maintenance_message, 331 'forum_name' => $forum_name, 332 'allow_guests' => 'yes', 333 'allow_subforums' => 'yes', 334 'enable_quick_reply' => 'yes', 335 'topics_per_page' => 20, 336 'posts_per_page' => 20, 337 'topic_cutoff' => 15, 338 'post_cutoff' => 15, 339 'post_to_forum' => 'yes', 340 'show_footer' => 'no', 341 'role_permissions' => $role_array, 288 342 'version' => WPBB_VERSION 289 343 ); 290 update_option('wpbb_options', $options); 291 } 292 } 293 /* Theme Options */ 294 $old_theme_options = get_option('wpbb_theme_options'); 295 if (!$old_theme_options) { 296 $add_wpbb_theme_options = add_option('wpbb_theme_options', array('theme' => 'light')); 297 } 298 /* Facebook Options */ 299 $old_facebook_options = get_option('wpbb_facebook_options'); 300 if (!$old_facebook_options) { 301 $facebook_app_id = __('Enter your Facebook App ID / API Key', 'wp-bb'); 302 $facebook_app_secret_key = __('Enter your App Secret Key', 'wp-bb'); 303 $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb'); 304 $facebook_state = __('Enter a long random string', 'wp-bb'); 305 $facebook_role = __('Enter the default role for new facebook registrations'); 306 $facebook_options = array( 307 'allow_facebook' => 'no', 308 'facebook_app_id' => $facebook_app_id, 309 'facebook_app_secret_key' => $facebook_app_secret_key, 310 'facebook_redirect_uri' => $facebook_redirect_uri, 311 'facebook_state' => $facebook_state, 312 'facebook_default_role' => $facebook_role 313 ); 314 $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options); 315 } 316 /* Twitter Options */ 317 $old_twitter_options = get_option('wpbb_twitter_options'); 318 if (!$old_twitter_options) { 319 $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb'); 320 $twitter_options = array( 321 'allow_twitter' => 'no', 322 'twitter_account' => $twitter_account 323 ); 324 $add_wpbb_twitter_options = add_option('wpbb_twitter_options', $twitter_options); 325 } 326 $old_guest_options = get_option('wpbb_guest_options'); 327 if (!$old_guest_options) { 328 $guest_options = array( 329 'guest_last_post' => '0000-00-00 00:00:00' 330 ); 331 $add_wpbb_guest_options = add_option('wpbb_guest_options', $guest_options); 344 $add_wpbb_options = add_option('wpbb_options', $options); 345 } 346 else 347 { 348 if (!isset($old_options['version'])) 349 { 350 $options = array( 351 'maintenance_mode' => $old_options['maintenance_mode'], 352 'maintenance_message' => $old_options['maintenance_message'], 353 'forum_name' => $old_options['forum_name'], 354 'allow_guests' => $old_options['allow_guests'], 355 'allow_subforums' => $old_options['allow_subforums'], 356 'enable_quick_reply' => $old_options['enable_quick_reply'], 357 'topics_per_page' => $old_options['topics_per_page'], 358 'posts_per_page' => $old_options['posts_per_page'], 359 'topic_cutoff' => $old_options['topic_cutoff'], 360 'post_cutoff' => $old_options['post_cutoff'], 361 'post_to_forum' => $old_options['post_to_forum'], 362 'show_footer' => $old_options['show_footer'], 363 'role_permissions' => $role_array, 364 'version' => WPBB_VERSION 365 ); 366 update_option('wpbb_options', $options); 367 } 368 } 369 /* Theme Options */ 370 $old_theme_options = get_option('wpbb_theme_options'); 371 if (!$old_theme_options) 372 { 373 $add_wpbb_theme_options = add_option('wpbb_theme_options', array('theme' => 'light')); 374 } 375 /* Facebook Options */ 376 $old_facebook_options = get_option('wpbb_facebook_options'); 377 if (!$old_facebook_options) { 378 $facebook_app_id = __('Enter your Facebook App ID / API Key', 'wp-bb'); 379 $facebook_app_secret_key = __('Enter your App Secret Key', 'wp-bb'); 380 $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb'); 381 $facebook_state = __('Enter a long random string', 'wp-bb'); 382 $facebook_role = __('Enter the default role for new facebook registrations'); 383 $facebook_options = array( 384 'allow_facebook' => 'no', 385 'facebook_app_id' => $facebook_app_id, 386 'facebook_app_secret_key' => $facebook_app_secret_key, 387 'facebook_redirect_uri' => $facebook_redirect_uri, 388 'facebook_state' => $facebook_state, 389 'facebook_default_role' => $facebook_role 390 ); 391 $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options); 392 } 393 /* Twitter Options */ 394 $old_twitter_options = get_option('wpbb_twitter_options'); 395 if (!$old_twitter_options) 396 { 397 $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb'); 398 $twitter_options = array( 399 'allow_twitter' => 'no', 400 'twitter_account' => $twitter_account 401 ); 402 $add_wpbb_twitter_options = add_option('wpbb_twitter_options', $twitter_options); 403 } 404 $old_guest_options = get_option('wpbb_guest_options'); 405 if (!$old_guest_options) 406 { 407 $guest_options = array( 408 'guest_last_post' => '0000-00-00 00:00:00' 409 ); 410 $add_wpbb_guest_options = add_option('wpbb_guest_options', $guest_options); 411 } 332 412 } 333 413 } … … 337 417 */ 338 418 339 function wpbb_admin_pages() { 340 341 $create_category = __('Create Category', 'wp-bb'); 342 $create_forum = __('Create Forum', 'wp-bb'); 343 $create_subforum = __('Create Subforum', 'wp-bb'); 344 $create_topic = __('Create Topic', 'wp-bb'); 345 $create_tools = __('Tools', 'wp-bb'); 346 $faq_support = __('FAQ & Support', 'wp-bb'); 347 $settings = __('WPBB Settings', 'wp-bb'); 348 349 // Main WPBB page 350 add_menu_page('WPBB Overview', 'WPBB', 'manage_options', 'wpbb_admin', 'wpbb_admin_display', '', 26); 351 352 // Create/Edit Category 353 add_submenu_page('wpbb_admin', 'WPBB Categories', $create_category, 'manage_options', 'wpbb_admin_categories', 'wpbb_admin_categories'); 354 355 // Create/Edit Forum 356 add_submenu_page('wpbb_admin', 'WPBB Forums', $create_forum, 'manage_options', 'wpbb_admin_forums', 'wpbb_admin_forums'); 357 358 // Create/Edit Subforum 359 add_submenu_page('wpbb_admin', 'WPBB Subforums', $create_subforum, 'manage_options', 'wpbb_admin_subforums', 'wpbb_admin_subforums'); 360 361 // Create/Edit Topics 362 add_submenu_page('wpbb_admin', 'WPBB Topics', $create_topic, 'manage_options', 'wpbb_admin_topics', 'wpbb_admin_topics'); 363 364 // Create Tools page 365 add_submenu_page('wpbb_admin', 'WPBB Tools', $create_tools, 'manage_options', 'wpbb_admin_tools', 'wpbb_admin_tools'); 366 367 // FAQ / First Installation Page 368 add_submenu_page('wpbb_admin', 'FAQ / Support', $faq_support, 'manage_options', 'wpbb_admin_help', 'wpbb_admin_help'); 369 370 // WPBB Settings 371 add_options_page('WPBB Settings', $settings, 'manage_options', 'wpbb_settings_page', 'wpbb_display_settings'); 372 } 373 374 function wpbb_create_template_file() { 375 // Get current theme directory 376 $template_directory = get_template_directory(); 377 // Check if required template file doesn't exist and if true create it 378 if (!file_exists($template_directory.'/wpbb-template.php')) { 379 // Check directory is writable 380 if (is_writable($template_directory)) { 381 // Copys wp-bb template file to your current theme 382 $template_file_path = WPBB_DIR.'/wpbb-template.php'; 383 $move_template_file = copy($template_file_path, $template_directory.'/wpbb-template.php'); 384 if (!$move_template_file) { 385 $move_template_file_failed = sprintf(__('Failed to move required wp-bb template file %s to theme directory %s. Please make sure both the file and directory exist or move the wp-bb template file to your current theme directory manually'), $template_file_path, $template_directory); 386 error_log($move_template_file_failed); 419 if (!function_exists('wpbb_admin_pages')) 420 { 421 function wpbb_admin_pages() 422 { 423 $create_category = __('Create Category', 'wp-bb'); 424 $create_forum = __('Create Forum', 'wp-bb'); 425 $create_subforum = __('Create Subforum', 'wp-bb'); 426 $create_topic = __('Create Topic', 'wp-bb'); 427 $role_permissions = __('Role Permissions', 'wp-bb'); 428 $create_tools = __('Tools', 'wp-bb'); 429 $faq_support = __('FAQ & Support', 'wp-bb'); 430 $settings = __('WPBB Settings', 'wp-bb'); 431 432 // Main WPBB page 433 add_menu_page('WPBB Overview', 'WPBB', 'manage_options', 'wpbb_admin', 'wpbb_admin_display', '', 27.7); 434 435 // Create/Edit Category 436 add_submenu_page('wpbb_admin', 'WPBB Categories', $create_category, 'manage_options', 'wpbb_admin_categories', 'wpbb_admin_categories'); 437 438 // Create/Edit Forum 439 add_submenu_page('wpbb_admin', 'WPBB Forums', $create_forum, 'manage_options', 'wpbb_admin_forums', 'wpbb_admin_forums'); 440 441 // Create/Edit Subforum 442 add_submenu_page('wpbb_admin', 'WPBB Subforums', $create_subforum, 'manage_options', 'wpbb_admin_subforums', 'wpbb_admin_subforums'); 443 444 // Create/Edit Topics 445 add_submenu_page('wpbb_admin', 'WPBB Topics', $create_topic, 'manage_options', 'wpbb_admin_topics', 'wpbb_admin_topics'); 446 447 // Role permissions 448 add_submenu_page('wpbb_admin', 'Role Permissions', $role_permissions, 'manage_options', 'wpbb_admin_role_permissions', 'wpbb_admin_role_permissions'); 449 450 // Create Tools page 451 add_submenu_page('wpbb_admin', 'WPBB Tools', $create_tools, 'manage_options', 'wpbb_admin_tools', 'wpbb_admin_tools'); 452 453 // FAQ / First Installation Page 454 add_submenu_page('wpbb_admin', 'FAQ / Support', $faq_support, 'manage_options', 'wpbb_admin_help', 'wpbb_admin_help'); 455 456 // Shortcut to WPBB settings - some people don't know they exist 457 add_submenu_page('wpbb_admin', 'WPBB Settings', $settings, 'manage_options', 'wpbb_settings_page', 'wpbb_display_settings'); 458 459 // WPBB Settings 460 add_options_page('WPBB Settings', $settings, 'manage_options', 'wpbb_settings_page', 'wpbb_display_settings'); 461 } 462 } 463 464 465 if (!function_exists('wpbb_create_template_file')) 466 { 467 function wpbb_create_template_file() 468 { 469 // Get current theme directory 470 $template_directory = get_template_directory(); 471 // Check if required template file doesn't exist and if true create it 472 if (!file_exists($template_directory.'/wpbb-template.php')) 473 { 474 // Check directory is writable 475 if (is_writable($template_directory)) 476 { 477 // Copys wp-bb template file to your current theme 478 $template_file_path = WPBB_DIR.'/wpbb-template.php'; 479 $move_template_file = copy($template_file_path, $template_directory.'/wpbb-template.php'); 480 if (!$move_template_file) 481 { 482 $move_template_file_failed = sprintf(__('Failed to move required wp-bb template file %s to theme directory %s. Please make sure both the file and directory exist or move the wp-bb template file to your current theme directory manually'), $template_file_path, $template_directory); 483 error_log($move_template_file_failed); 484 } 387 485 } 388 } else { // Is not writable and user should change permissions accordingly 389 $template_write_failed = sprintf(__('%s is not writable. Could not create required WPBB template file forum.php. Please change the folders permissions and visit your Wordpress site again or copy the file forum.php from your wp-bb plugin folder to your template folders directory manually.'), $template_directory); 390 error_log($template_write_failed); 391 } 392 } 393 } 394 395 function wpbb_create_page() { 396 // Check the page doesn't already exist (e.g. when reactivating) 397 global $wpdb; 398 $post_meta = $wpdb->prefix.'postmeta'; 399 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';"); 400 if ($post_id == NULL) { 401 $wpbb_page_title = __('Forums', 'wp-bb'); 402 $link = site_url().'/'.strtolower($wpbb_page_title); 403 $page = array( 404 'post_status' => 'publish', 405 'post_title' => $wpbb_page_title, 406 'comment_status' => 'closed', 407 'post_type' => 'page' 408 ); 409 global $forum_page; 410 $forum_page = wp_insert_post($page, false); 411 add_post_meta($forum_page, '_wp_page_template', 'wpbb-template.php', true); 412 } 413 // This function checks if the template file exists before doing anything 414 $template = wpbb_create_template_file(); 415 } 416 417 function wpbb_register_styles() { 418 $wpbb_theme_options = get_option('wpbb_theme_options'); 419 if ($wpbb_theme_options['theme'] == 'light') { 420 wp_register_style('wpbb-light-style', plugins_url('wp-bulletin-board/css/wpbb-light-style.css')); 421 wp_enqueue_style('wpbb-light-style'); 422 } else { 423 wp_register_style('wpbb-dark-style', plugins_url('wp-bulletin-board/css/wpbb-dark-style.css')); 424 wp_enqueue_style('wpbb-dark-style'); 486 else 487 { 488 // Is not writable and user should change permissions accordingly 489 $template_write_failed = sprintf(__('%s is not writable. Could not create required WPBB template file forum.php. Please change the folders permissions and visit your Wordpress site again or copy the file forum.php from your wp-bb plugin folder to your template folders directory manually.'), $template_directory); 490 error_log($template_write_failed); 491 } 492 } 493 } 494 } 495 496 if (!function_exists('wpbb_create_page')) 497 { 498 function wpbb_create_page() 499 { 500 // Check the page doesn't already exist (e.g. when reactivating) 501 global $wpdb; 502 $post_meta = $wpdb->prefix.'postmeta'; 503 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';"); 504 if ($post_id == NULL) 505 { 506 $wpbb_page_title = __('Forums', 'wp-bb'); 507 $link = site_url().'/'.strtolower($wpbb_page_title); 508 $page = array( 509 'post_status' => 'publish', 510 'post_title' => $wpbb_page_title, 511 'comment_status' => 'closed', 512 'post_type' => 'page' 513 ); 514 global $forum_page; 515 $forum_page = wp_insert_post($page, false); 516 add_post_meta($forum_page, '_wp_page_template', 'wpbb-template.php', true); 517 } 518 // This function checks if the template file exists before doing anything 519 $template = wpbb_create_template_file(); 520 } 521 } 522 523 /* 524 Wordpress post metaboxes 525 */ 526 527 if (!function_exists('wpbb_post_saved')) 528 { 529 function wpbb_post_saved($_post_id) 530 { 531 if (wp_is_post_revision($_post_id)) 532 { 533 return; 534 } 535 static $first = true; 536 if (!$first) return; 537 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) 538 { 539 return; 540 } 541 $post_metabox_nonce = isset($_POST['wpbb-post-metabox-nonce']); 542 if (!wp_verify_nonce($post_metabox_nonce, plugin_basename(__FILE__))) 543 { 544 return; 545 } 546 $_post_type = isset($_POST['post_type']); 547 if ('post' == $_post_type) 548 { 549 if (!current_user_can('edit_page', $_post_id)) 550 { 551 return; 552 } 553 } 554 $post_id = absint($_post_id); 555 $post_data = get_post($post_id, ARRAY_A); 556 $post_to_forum_id = NULL; 557 if (isset($_POST['wpbb-post-to-forum'])) 558 { 559 $post_to_forum_id = absint($_POST['wpbb-post-to-forum']); 560 } 561 if ($post_to_forum_id == NULL) 562 { 563 error_log(__('When copying the post to a WPBB forum, the wpbb-post-to-forum was NULL - a forum ID wasn\'t provided')); 564 } 565 $is_forum = NULL; 566 $is_subforum = NULL; 567 global $wpdb; 568 // Check to see if this forum is a forum or a subforum 569 $forum_or_subforum = $wpdb->get_results("SELECT `forum`, `subforum` FROM ".CATEGORY_TABLE." WHERE id = $post_to_forum_id;"); 570 if ($forum_or_subforum) 571 { 572 foreach ($forum_or_subforum as $forum) 573 { 574 if ($forum->forum > 0 && $forum->subforum == 0) 575 { 576 // Forum 577 $is_forum = true; 578 $is_subforum = false; 579 } 580 else if ($forum->subforum > 0 && $forum->forum == 0) 581 { 582 // Subforum 583 $is_subforum = true; 584 $is_forum = false; 585 } 586 } 587 } 588 if ($post_data) 589 { 590 $forum_id = ($is_forum) ? $post_to_forum_id : 0; 591 $subforum_id = ($is_subforum) ? $post_to_forum_id : 0; 592 $data = array( 593 'name' => $post_data['post_title'], 594 'author' => $post_data['post_author'], 595 'content' => $post_data['post_content'], 596 'forum' => $forum_id, 597 'subforum' => $subforum_id, 598 'status' => '', 599 'created' => $post_data['post_date'], 600 'last_reply' => $post_data['post_date'] 601 ); 602 $copy_post_to_forum = $wpdb->insert(TOPICS_TABLE, $data); 603 if ($copy_post_to_forum === false) 604 { 605 error_log(__('Failed to copy the wordpress post to the wpbb forum', 'wp-bb')); 606 } 607 else 608 { 609 // Update authors post count 610 wpbb_admin_update_user_meta($post_data['post_author'], 'increase'); 611 $first = false; 612 } 613 } 614 } 615 } 616 617 if (!function_exists('wpbb_display_metaboxes')) 618 { 619 function wpbb_display_metaboxes() 620 { 621 global $wpdb; 622 wp_nonce_field(plugin_basename(__FILE__), 'wpbb-post-metabox-nonce'); 623 ?> 624 <div id="minor-publishing-actions"> 625 <p class="description">Send a copy of this post to one of your WPBB forums or subforums or check "None" or disable this in your WPBB Settings</p> 626 <select name="wpbb-post-to-forum"> 627 <!-- Default --> 628 <option value="0">None</option> 629 <?php 630 // All forums and subforums 631 $forums = $wpdb->get_results("SELECT `id`, `name` FROM ".CATEGORY_TABLE." WHERE forum > 0 || subforum > 0;"); 632 if ($forums) 633 { 634 foreach ($forums as $forum) 635 { 636 ?> 637 <option value="<?php echo $forum->id; ?>"><?php echo $forum->name;?></option> 638 <?php 639 } 640 } 641 ?> 642 </select> 643 </div> 644 <?php 645 } 646 } 647 648 if (!function_exists('wpbb_create_metaboxes')) 649 { 650 function wpbb_create_metaboxes() 651 { 652 add_meta_box('wpbb-post-to-forum-meta-box', __('Post to WPBB Forum', 'wp-bb'), 'wpbb_display_metaboxes', 'post', 'side', 'high', NULL); 653 } 654 } 655 656 /* 657 Register and loads the style and javascript files depending on settings 658 */ 659 660 if (!function_exists('wpbb_register_styles')) 661 { 662 function wpbb_register_styles() 663 { 664 $wpbb_theme_options = get_option('wpbb_theme_options'); 665 if ($wpbb_theme_options['theme'] == 'light') 666 { 667 wp_register_style('wpbb-light-style', plugins_url('wp-bulletin-board/css/wpbb-light-style.css')); 668 wp_enqueue_style('wpbb-light-style'); 669 } 670 else 671 { 672 wp_register_style('wpbb-dark-style', plugins_url('wp-bulletin-board/css/wpbb-dark-style.css')); 673 wp_enqueue_style('wpbb-dark-style'); 674 } 675 wp_enqueue_script('jquery'); 676 wp_register_script('wpbb-search', plugins_url('wp-bulletin-board/js/wpbb-search.js'), 'jquery'); 677 wp_enqueue_script('wpbb-search'); 425 678 } 426 679 } … … 432 685 */ 433 686 434 function wpbb_admin_display() { 435 require_once('php/admin/wpbb-admin-main.php'); 436 } 687 if (!function_exists('wpbb_admin_display')) 688 { 689 function wpbb_admin_display() 690 { 691 require_once('php/admin/admin-main.php'); 692 } 693 } 694 437 695 438 696 … … 441 699 */ 442 700 443 function wpbb_admin_categories() { 444 require_once('php/admin/wpbb-admin-categories.php'); 701 if (!function_exists('wpbb_admin_categories')) 702 { 703 function wpbb_admin_categories() 704 { 705 require_once('php/admin/admin-categories.php'); 706 } 445 707 } 446 708 … … 449 711 */ 450 712 451 function wpbb_admin_forums() { 452 require_once('php/admin/wpbb-admin-forums.php'); 713 if (!function_exists('wpbb_admin_forums')) 714 { 715 function wpbb_admin_forums() 716 { 717 require_once('php/admin/admin-forums.php'); 718 } 453 719 } 454 720 … … 457 723 */ 458 724 459 function wpbb_admin_subforums() { 460 require_once('php/admin/wpbb-admin-subforums.php'); 725 if (!function_exists('wpbb_admin_subforums')) 726 { 727 function wpbb_admin_subforums() 728 { 729 require_once('php/admin/admin-subforums.php'); 730 } 461 731 } 462 732 … … 465 735 */ 466 736 467 function wpbb_admin_topics() { 468 require_once('php/admin/wpbb-admin-topics.php'); 737 if (!function_exists('wpbb_admin_topics')) 738 { 739 function wpbb_admin_topics() 740 { 741 require_once('php/admin/admin-topics.php'); 742 } 743 } 744 745 /* 746 Role Permissions 747 */ 748 749 if (!function_exists('wpbb_admin_role_permissions')) 750 { 751 function wpbb_admin_role_permissions() 752 { 753 require_once('php/admin/admin-role-permissions.php'); 754 } 469 755 } 470 756 … … 473 759 */ 474 760 475 function wpbb_admin_tools() { 476 require_once('php/admin/wpbb-admin-tools.php'); 761 if (!function_exists('wpbb_admin_tools')) 762 { 763 function wpbb_admin_tools() 764 { 765 require_once('php/admin/admin-tools.php'); 766 } 477 767 } 478 768 … … 481 771 */ 482 772 483 function wpbb_admin_help() { 484 require_once('php/admin/wpbb-admin-faq-support.php'); 485 } 486 773 if (!function_exists('wpbb_admin_help')) 774 { 775 function wpbb_admin_help() 776 { 777 require_once('php/admin/admin-faq-support.php'); 778 } 779 } 487 780 488 781 /* … … 490 783 */ 491 784 492 function wpbb_display_settings() { 493 require_once('php/admin/wpbb-admin-settings.php'); 785 if (!function_exists('wpbb_display_settings')) 786 { 787 function wpbb_display_settings() 788 { 789 require_once('php/admin/admin-settings.php'); 790 } 494 791 } 495 792 -
wp-bulletin-board/trunk/css/wpbb-light-style.css
r607181 r637712 1 1 /* 2 2 WPBB light style 3 4 To be used on a light background, preferably white5 6 This only affects the front end as the back end implements wordpress styling.7 3 */ 8 4 … … 30 26 font-weight:bold; 31 27 padding-bottom:10px; 28 } 29 30 /* Change the forum title position and color of the slash (/) character here */ 31 h2.wpbb-forum-title { 32 text-align:center; 33 padding-bottom:10px; 34 } 35 36 /* Change the color of the forum title link here, boldness, etc */ 37 h2.wpbb-forum-title a { 38 font-weight:bold; 39 color:purple; 32 40 } 33 41 … … 184 192 min-width: 500px; 185 193 white-space: pre-line; 194 text-align:left; 186 195 } 187 196 -
wp-bulletin-board/trunk/php/facebook/wpbb-facebook.php
r607181 r637712 9 9 $user_id = get_current_user_id(); 10 10 11 if ($user_id !== 0) { // User is logged in 12 11 if ($user_id !== 0) 12 { 13 // User is logged in 13 14 $user_access_token = get_user_meta($user_id, 'wpbb_facebook_access_token', true); 14 15 if ($user_access_token != "" && is_user_logged_in()) { // User is logged into Facebook16 15 if ($user_access_token != "" && is_user_logged_in()) 16 { 17 // User is logged into Facebook 17 18 $logged_into_facebook = true; 18 19 if (count($_GET) == 0){19 if (count($_GET) == 0) 20 { 20 21 ?> 21 22 <div class="wpbb-centered"> … … 25 26 <?php 26 27 } 27 28 } 29 30 31 } else { // User is not logged in 32 33 // Registering for a Wordpress account through Facebook 28 } 29 } 30 else 31 { 32 /* 33 User is not logged in 34 Registering for a Wordpress account through Facebook 35 */ 34 36 if ((isset($_GET['register'])) && (isset($_GET['method'])) && (count($_GET) == 2)) { 35 37 … … 130 132 <br /> 131 133 <div class="wpbb-centered"> 132 <?php printf(__('Thank you for logging in to Facebook, %s!'), $facebook_user['name']); ?>134 <?php printf(__('Thank you for logging in to Facebook, %s!'), $facebook_user['name']); ?> 133 135 <br /><br /> 134 136 <?php _e('Please now enter the password for your Wordpress account you registered using Facebook.', 'wp-bb'); ?><br /><br /><?php … … 238 240 <div class="wpbb-message-success"> 239 241 <?php 240 _e('Thank you for registering. Please login with your Facebook username and password you just created', 'wp-bb');242 _e('Thank you for registering. Please login with your Facebook username and password you just created', 'wp-bb'); 241 243 ?> 242 244 </div> -
wp-bulletin-board/trunk/php/twitter/wpbb-twitter.php
r611368 r637712 5 5 */ 6 6 7 if (count($_GET) == 0) { 7 if (count($_GET) == 0) 8 { 8 9 ?> 9 10 <div class="wpbb-centered"> -
wp-bulletin-board/trunk/php/wpbb-forum.php
r607181 r637712 4 4 Checks if the plugin is deactivated 5 5 */ 6 7 6 8 7 // Since we're not in the admin area we must require the plugin.php file … … 18 17 <div style="text-align:center;font-weight:bold;color:red;"> 19 18 <?php 20 _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB ', 'wp-bb');19 _e('The plugin is deactivated. Please reactivate the plugin to continue using WPBB or delete this page', 'wp-bb'); 21 20 wpbb_exit(); 22 21 ?> … … 35 34 36 35 // Sets the default timezone used by all date/time functions in a script depending on server configuration option 37 if (ini_get('date.timezone.')) { 36 if (ini_get('date.timezone.')) 37 { 38 38 $timezone = ini_get('date.timezone'); 39 39 date_default_timezone_set($timezone); … … 48 48 define('POST_TABLE', $wpdb->prefix.'wpbb_posts'); 49 49 define('MESSAGES_TABLE', $wpdb->prefix.'wpbb_messages'); 50 define('UN_READ_TABLE', $wpdb->prefix.'wpbb_topics_unread'); 50 51 51 52 // The WP-BB plugin url on wordpress - only used if show footer option is set to yes … … 53 54 54 55 55 function wpbb_exit() { 56 function wpbb_exit() 57 { 56 58 get_header(); 57 59 get_footer(); … … 63 65 && (!is_user_logged_in()) 64 66 && (!isset($_GET['method'])) 65 && (!isset($_GET['state']))) { 66 if ($wpbb_facebook_options['allow_facebook'] == 'yes') { 67 && (!isset($_GET['state']))) 68 { 69 if ($wpbb_facebook_options['allow_facebook'] == 'yes') 70 { 67 71 require_once('facebook/wpbb-facebook.php'); 68 72 } 69 require_once(' wpbb-functions.php');73 require_once('functions.php'); 70 74 ?> 71 75 <div class="wpbb-centered-bold"> … … 77 81 } 78 82 79 if ($wpbb_options['maintenance_mode'] == 'on') { 80 if (current_user_can('manage_options')) { 83 if ($wpbb_options['maintenance_mode'] == 'on') 84 { 85 if (current_user_can('manage_options')) 86 { 81 87 ?> 82 88 <div class="wpbb-message-warning"> … … 84 90 </div> 85 91 <?php 86 } else { 92 } 93 else 94 { 87 95 ?> 88 96 <div class="wpbb-message-warning"> … … 90 98 </div> 91 99 <?php 92 if ($wpbb_facebook_options['allow_facebook'] == 'yes') { 100 if ($wpbb_facebook_options['allow_facebook'] == 'yes') 101 { 93 102 require_once('facebook/wpbb-facebook.php'); 94 103 } 95 require_once(' wpbb-functions.php');104 require_once('functions.php'); 96 105 wpbb_footer(); 97 106 wpbb_exit(); … … 103 112 */ 104 113 105 require_once(' wpbb-functions.php');106 107 /* 114 require_once('functions.php'); 115 116 /* 108 117 Checks a page supplied exists 109 118 */ … … 115 124 */ 116 125 117 if ($wpbb_facebook_options['allow_facebook'] == 'yes') { 126 if ($wpbb_facebook_options['allow_facebook'] == 'yes') 127 { 118 128 require_once('facebook/wpbb-facebook.php'); 119 129 } … … 126 136 $wpbb_twitter_options = get_option('wpbb_twitter_options'); 127 137 128 if ($wpbb_twitter_options['allow_twitter'] == 'yes') { 138 if ($wpbb_twitter_options['allow_twitter'] == 'yes') 139 { 129 140 require_once('twitter/wpbb-twitter.php'); 130 141 } … … 138 149 */ 139 150 151 140 152 if (empty($permalink_options)) 141 153 { 142 if (count($_GET) == 1) {143 require_once('wpbb-index.php');144 }145 154 if (count($_GET) == 1) 155 { 156 require_once('forum-index.php'); 157 } 146 158 147 159 /* … … 152 164 && (isset($_GET['current_page'])) 153 165 && (count($_GET) == 3)) { 154 require_once(' wpbb-view-forum.php');166 require_once('view-forum.php'); 155 167 } 156 168 … … 165 177 && (isset($_GET['current_page'])) 166 178 && (count($_GET) == 4)) { 167 require_once('wpbb-view-forum-topic.php'); 168 } 169 179 require_once('view-forum-topic.php'); 180 } 170 181 171 182 /* … … 177 188 && (isset($_GET['forum']) && isset($_GET['subforum'])) 178 189 && (count($_GET) == 4)) { 179 require_once(' wpbb-create-topic.php');190 require_once('create-topic.php'); 180 191 } 181 192 … … 184 195 && (isset($_GET['forum'])) 185 196 && (count($_GET) == 3)) { 186 require_once('wpbb-create-topic.php'); 187 } 188 197 require_once('create-topic.php'); 198 } 189 199 190 200 /* … … 197 207 && (isset($_GET['current_page'])) 198 208 && (count($_GET) == 4)) { 199 require_once(' wpbb-view-subforum.php');209 require_once('view-subforum.php'); 200 210 } 201 211 … … 211 221 && (isset($_GET['current_page'])) 212 222 && (count($_GET) == 5)) { 213 require_once(' wpbb-view-subforum-topic.php');223 require_once('view-subforum-topic.php'); 214 224 } 215 225 … … 221 231 && (isset($_GET['page_id'])) 222 232 && (count($_GET) == 2)) { 223 require_once(' wpbb-view-profile.php');233 require_once('view-profile.php'); 224 234 } 225 235 … … 232 242 && (isset($_GET['current_page'])) 233 243 && (count($_GET) == 3)) { 234 require_once(' wpbb-all-messages.php');244 require_once('all-messages.php'); 235 245 } 236 246 … … 243 253 && (isset($_GET['page_id'])) 244 254 && (count($_GET) > 1 && count($_GET) <= 3)) { 245 require_once(' wpbb-delete-message.php');255 require_once('delete-message.php'); 246 256 } 247 257 … … 255 265 && ((isset($_GET['view'])) && ($_GET['view'])) 256 266 && (count($_GET) == 3)) { 257 require_once(' wpbb-view-message.php');267 require_once('view-message.php'); 258 268 } 259 269 … … 265 275 && (isset($_GET['page_id'])) 266 276 && (count($_GET) == 2)) { 267 require_once(' wpbb-message-user.php');277 require_once('message-user.php'); 268 278 } 269 279 … … 281 291 && ($_GET['action'] != 'reply') 282 292 && ($_GET['action'] != 'sticky')))) { 283 require_once(' wpbb-edit-topic.php');293 require_once('edit-topic.php'); 284 294 } 285 295 … … 297 307 && ($_GET['action'] != 'reply') 298 308 && ($_GET['action'] != 'sticky')))) { 299 require_once(' wpbb-lock-topic.php');309 require_once('lock-topic.php'); 300 310 } 301 311 … … 313 323 && ($_GET['action'] != 'reply') 314 324 && ($_GET['action'] != 'edit')))) { 315 require_once(' wpbb-sticky-topic.php');325 require_once('sticky-topic.php'); 316 326 } 317 327 … … 329 339 && ($_GET['action'] != 'reply') 330 340 && ($_GET['action'] != 'sticky')))) { 331 require_once(' wpbb-delete-topic.php');341 require_once('delete-topic.php'); 332 342 } 333 343 … … 346 356 && ($_GET['action'] != 'reply') 347 357 && ($_GET['action'] != 'sticky')))) { 348 require_once(' wpbb-markread-topic.php');358 require_once('markread-topic.php'); 349 359 } 350 360 … … 363 373 && ($_GET['action'] != 'edit') 364 374 && ($_GET['action'] != 'sticky')))) { 365 require_once(' wpbb-reply-topic.php');375 require_once('reply-topic.php'); 366 376 } 367 377 … … 375 385 && (isset($_GET['current_page'])) 376 386 && (count($_GET) == 3)) { 377 require_once(' wpbb-unread-topics.php');387 require_once('unread-topics.php'); 378 388 } 379 389 … … 387 397 && (isset($_GET['current_page'])) 388 398 && (count($_GET) == 3)) { 389 require_once(' wpbb-unanswered-topics.php');399 require_once('unanswered-topics.php'); 390 400 } 391 401 392 402 // Not default or custom structure 393 403 394 } else { 395 396 if (count($_GET) == 0) { 397 require_once('wpbb-index.php'); 404 } 405 else 406 { 407 if (count($_GET) == 0) 408 { 409 require_once('forum-index.php'); 398 410 } 399 411 … … 405 417 && (isset($_GET['current_page'])) 406 418 && (count($_GET) == 2)) { 407 require_once('wpbb-view-forum.php'); 408 } 409 410 411 419 require_once('view-forum.php'); 420 } 421 412 422 /* 413 423 Viewing A Forum Topic … … 418 428 && (isset($_GET['current_page'])) 419 429 && (count($_GET) == 3)) { 420 require_once(' wpbb-view-forum-topic.php');430 require_once('view-forum-topic.php'); 421 431 } 422 432 … … 429 439 && (isset($_GET['forum']) && isset($_GET['subforum']) || isset($_GET['forum']) && !isset($_GET['subforum'])) 430 440 && (count($_GET) == 2 || count($_GET) == 3)) { 431 require_once(' wpbb-create-topic.php');441 require_once('create-topic.php'); 432 442 } 433 443 … … 440 450 && (isset($_GET['current_page'])) 441 451 && (count($_GET) == 3)) { 442 require_once(' wpbb-view-subforum.php');452 require_once('view-subforum.php'); 443 453 } 444 454 … … 453 463 && (isset($_GET['current_page'])) 454 464 && (count($_GET) == 4)) { 455 require_once(' wpbb-view-subforum-topic.php');465 require_once('view-subforum-topic.php'); 456 466 } 457 467 … … 462 472 if ((isset($_GET['profile'])) 463 473 && (count($_GET) == 1)) { 464 require_once(' wpbb-view-profile.php');474 require_once('view-profile.php'); 465 475 } 466 476 … … 474 484 && (isset($_GET['current_page'])) 475 485 && (count($_GET) == 2 || count($_GET) == 3)) { 476 require_once(' wpbb-all-messages.php');486 require_once('all-messages.php'); 477 487 } 478 488 … … 485 495 && (isset($_GET['delete_msg'])) 486 496 && (count($_GET) > 1 && count($_GET) <= 2)) { 487 require_once(' wpbb-delete-message.php');497 require_once('delete-message.php'); 488 498 } 489 499 /* … … 495 505 && ((isset($_GET['view'])) 496 506 && (count($_GET) == 2))) { 497 require_once(' wpbb-view-message.php');507 require_once('view-message.php'); 498 508 } 499 509 … … 504 514 if ((isset($_GET['message'])) 505 515 && (count($_GET) == 1)) { 506 require_once(' wpbb-message-user.php');516 require_once('message-user.php'); 507 517 } 508 518 … … 519 529 && ($_GET['action'] != 'reply') 520 530 && ($_GET['action'] != 'sticky')))) { 521 require_once(' wpbb-edit-topic.php');531 require_once('edit-topic.php'); 522 532 } 523 533 … … 534 544 && ($_GET['action'] != 'reply') 535 545 && ($_GET['action'] != 'sticky')))) { 536 require_once(' wpbb-lock-topic.php');546 require_once('lock-topic.php'); 537 547 } 538 548 … … 549 559 && ($_GET['action'] != 'reply') 550 560 && ($_GET['action'] != 'edit')))) { 551 require_once(' wpbb-sticky-topic.php');561 require_once('sticky-topic.php'); 552 562 } 553 563 … … 564 574 && ($_GET['action'] != 'reply') 565 575 && ($_GET['action'] != 'sticky')))) { 566 require_once(' wpbb-delete-topic.php');576 require_once('delete-topic.php'); 567 577 } 568 578 … … 574 584 && (isset($_GET['topic'])) 575 585 && ((isset($_GET['action']) 576 && ($_GET['action'] == 'markread') 586 && ($_GET['action'] == 'markread') 577 587 && ($_GET['action'] != 'delete') 578 588 && ($_GET['action'] != 'lock') … … 580 590 && ($_GET['action'] != 'reply') 581 591 && ($_GET['action'] != 'sticky')))) { 582 require_once(' wpbb-markread-topic.php');592 require_once('markread-topic.php'); 583 593 } 584 594 … … 596 606 && ($_GET['action'] != 'edit') 597 607 && ($_GET['action'] != 'sticky')))) { 598 require_once(' wpbb-reply-topic.php');608 require_once('reply-topic.php'); 599 609 } 600 610 … … 607 617 && (isset($_GET['current_page'])) 608 618 && (count($_GET) == 2)) { 609 require_once(' wpbb-unread-topics.php');619 require_once('unread-topics.php'); 610 620 } 611 621 … … 618 628 && (isset($_GET['current_page'])) 619 629 && (count($_GET) == 2)) { 620 require_once(' wpbb-unanswered-topics.php');630 require_once('unanswered-topics.php'); 621 631 } 622 632 } -
wp-bulletin-board/trunk/readme.txt
r611368 r637712 3 3 Donate link: http://codebycarter.x10.mx/wp/donate/ 4 4 Tags: forum, bulletin board, twitter, facebook, discussion, discussion board, messaging, private message, topic, post, pagination, profile, subforum, wpbb 5 Requires at least: 3. 36 Tested up to: 3. 4.27 Stable tag: 1. 0.45 Requires at least: 3.0 6 Tested up to: 3.5 7 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 19 19 = Features = 20 * - Ease of Integration - WPBB creates a template file for your current template when you install or change your theme so you don't have to do anything. Everything can be managed from your admin area. 21 * - Translatable - WPBB can easily be translated into your preferred language! 22 * - Facebook registration - Allow your users to register on your Wordpress site via Facebook. This automatically creates a WP account for your Facebook users which they can then login to after authenticating. 23 * - Twitter - Enter your twitter account in your settings and your users will be able to follow your website / personal account with the click of a button. 24 * - Private Messaging System - Allow users to send messages to each other. 25 * - Member Profiles - All your WP users are automatically apart of your forum whenever you create it and have a "forum profile" which can be viewed on the forum which shows the users avatar, username, role, posts, website and signature. Signatures are apart of WPBB and allow your users to enter a signature which can be text or images and is displayed below their profile and posts. 26 * - Categories, Forums, Sub forums - Organise your forums into categories and your sub forums into forums. There is no limit to the amount of forums its parent can have, and each are ordered by its appearance in its parent. 27 * - Permissions system - Currently supports the ability to allow or disallow any role (even custom roles!) any specific permission (edit, view, read, post, reply, lock, delete, sticky). WPBB grabs all known roles from your WP site which you can set permissions for manually or copy existing permissions from a previous forum. 28 * - Topics - If you have the permissions to do so you can edit, lock, delete, sticky, view, read, post or reply with a topic. 29 * - Posts - You can edit and delete any post and the posts topic affects the posts status. You can create posts in two ways, creating a topic reply with presents the WP editor for improved formatting or you can use the quick reply feature (if it is enabled in your settings). 30 * - Pagination System - Supports a simple pagination system which organises your topics and posts - you can set the max topics/posts per page in your wpbb settings. 31 * - Unread Topics - WPBB collects a list of topics which have been posted when you were offline and displays them for you. You can mark any of them as read once you've read them. 32 * - Unanswered Topics - Similar to the above feature, unanswered topics are ones which haven't yet received any replies. 33 * - Admin area - The WPBB settings integrate with your existing WP admin area where you can easily manage your forums with ease. The WPBB overview allows you to change the order of a category, forum or sub forum, edit it and delete it with a single click. You can also create new categories, forums, sub forums and topics via the admin area. 34 * - Settings - WPBB is jam packed with settings that you can use to customise the forum any way you want to. 20 * Compatibility - Fully compatible with 3.5, 3.4, 3.3, 3.2, 3.1 and 3.0 21 * Ease of Integration - WPBB works with any theme, you can change your theme anytime and WPBB will automatically update itself. 22 * Translatable - WPBB can easily be translated into your preferred language! 23 * Facebook registration - Allow your users to register on your Wordpress site via Facebook. This automatically creates a WP account for your Facebook users which they can then login to after authenticating. 24 * Twitter - Enter your twitter account in your settings and your users will be able to follow your website / personal account with the click of a button. 25 * Private Messaging System - Allow users to send messages to each other. 26 * Member Profiles - All your WP users are automatically apart of your forum whenever you create it and have a "forum profile" which can be viewed on the forum which shows the users avatar, username, role, posts, website and signature. Signatures are apart of WPBB and allow your users to enter a signature which can be text or images and is displayed below their profile and posts. 27 * Categories, Forums, Sub forums - Organise your forums into categories and your sub forums into forums. There is no limit to the amount of forums its parent can have, and each are ordered by its appearance in its parent. 28 * Permissions system - Currently supports the ability to allow or disallow any role (even custom roles!) any specific permission (edit, view, read, post, reply, lock, delete, sticky). WPBB grabs all known roles from your WP site which you can set permissions for manually or copy existing permissions from a previous forum. 29 * Role Permissions - New in 1.1. Allows you to choose whether a role can only edit, lock, delete and sticky their own topics or everyones. 30 * Topics - If you have the permissions to do so you can edit, lock, delete, sticky, view, read, post or reply with a topic. 31 * Posts - You can edit and delete any post and the posts topic affects the posts status. You can create posts in two ways, creating a topic reply with presents the WP editor for improved formatting or you can use the quick reply feature (if it is enabled in your settings). 32 * Pagination System - Supports a simple pagination system which organises your topics and posts - you can set the max topics/posts per page in your wpbb settings. 33 * Unread Topics - WPBB collects a list of topics which have been posted when you were offline and displays them for you. You can mark any of them as read once you've read them. 34 * Unanswered Topics - Similar to the above feature, unanswered topics are ones which haven't yet received any replies. 35 * Admin area - The WPBB settings integrate with your existing WP admin area where you can easily manage your forums with ease. The WPBB overview allows you to change the order of a category, forum or sub forum, edit it and delete it with a single click. You can also create new categories, forums, sub forums and topics via the admin area. 36 * Settings - WPBB is jam packed with settings that you can use to customise the forum any way you want to. 37 * Tools - Tools help make your life easier. Tools such as updating your roles whenever you add, change or remove them and a tool to recreate the forum page if you ever accidentally delete it. 35 38 36 And m any more...39 And much much more! 37 40 38 41 == Installation == … … 60 63 Firstly always download the plugin again as the plugin is constantly updated. It is likely the problem you're having has been fixed already. If that doesn't work, create a topic here: http://wordpress.org/support/plugin/wp-bulletin-board 61 64 65 = How to Setup Facebook Integration = 66 67 1. https://developers.facebook.com/apps (register or login) 68 2. "Create New App" 69 3. Enter App Name, can be anything you want, don't worry about app namespace or web hosting. Click continue. 70 4. Facebook should've created the app for you and you'll see at the top the name of your app and the default avatar, next to that there is your App ID and App Secret Key. Enter those into your WPBB facebook settings. 71 5. You may want to enter a contact email and change any other settings to your liking but leave sandbox mode disabled and don't use the "Hosting URL" 72 6. Click "Website with Facebook Login" under "Select how your app integrates with Facebook" then enter the URL to your wpbb forum e.g. http://mysite.com/wordpress/forum 73 7. Save changes 74 75 = When I edit and save my forum or subforum, there is an error = 76 77 It is likely that you are updating a forum with roles that no longer exist. Go to your admin dashboard -> WPBB -> Tools -> Refresh Roles. Use this tool whenever you add, change or remove roles. Roles are like the ranks or capabilities that users have, e.g. subscriber, author, administrator, etc. 78 62 79 == Screenshots == 63 80 … … 71 88 72 89 == Changelog == 90 91 = 1.1.0 = 92 * Role permissions added which allow you to set whether a role can edit, lock, delete or sticky only their own topics or posts or everyones. 93 * Now compatible with wordpress versions 3.0, 3.1, 3.2, 3.3 and 3.5 94 * Fixes error in topic post editor 95 * (un)read topics are now used per user instead of globally as it should be 96 * Removed unneccessary forum prefix setting as you can include 'forum' in your own title 97 * Fixed post count not changing when deleting topics and/or posts and when editing topics and posts. 98 * Fixes a number of bugs translators encountered when trying to translate wpbb 99 * Clicking the search box now clears the textbox, more javascript will be added in the future for those that use it 100 * Added useful descriptions next to all the settings in the wpbb settings. 101 * New tool added which allows you to recreate your forums page if it was accidentally deleted or didn't create for some reason 102 * Last post/reply will now take you to that topic or post 103 * You can no longer create empty topics, posts or messages or give them empty titles 104 * You can now go straight to your newly created topic or post when creating a topic or reply. 105 * Updated FAQ 106 * Minor bug fixes and typos fixed. 73 107 74 108 = 1.0.4 = -
wp-bulletin-board/trunk/wp-bb.php
r611368 r637712 4 4 Plugin URI: http://wordpress.org/extend/plugins/wp-bulletin-board/ 5 5 Description: An easy to use Bulletin board for Wordpress with Facebook and Twitter integration. 6 Version: 1. 0.46 Version: 1.1.0 7 7 Author: Jay Carter 8 8 Author URI: http://codebycarter.com … … 29 29 30 30 // Sets the default timezone used by all date/time functions in a script depending on server configuration option 31 if (ini_get('date.timezone.')) { 31 if (ini_get('date.timezone.')) 32 { 32 33 $timezone = ini_get('date.timezone'); 33 34 date_default_timezone_set($timezone); … … 35 36 36 37 // Define wpbb plugin directory 37 define('WPBB_DIR', plugin_dir_path(__FILE__)); 38 if (!defined('WPBB_DIR')) 39 { 40 define('WPBB_DIR', plugin_dir_path(__FILE__)); 41 } 38 42 // Contains categories, forums and subforums 39 define('CATEGORY_TABLE', $wpdb->prefix.'wpbb_categories'); 43 if (!defined('CATEGORY_TABLE')) 44 { 45 define('CATEGORY_TABLE', $wpdb->prefix.'wpbb_categories'); 46 } 40 47 // Contains all topics whether in a category, forum or subforum 41 define('TOPICS_TABLE', $wpdb->prefix.'wpbb_topics'); 48 if (!defined('TOPICS_TABLE')) 49 { 50 define('TOPICS_TABLE', $wpdb->prefix.'wpbb_topics'); 51 } 42 52 // Contains all posts inside a specific topic 43 define('POSTS_TABLE', $wpdb->prefix.'wpbb_posts'); 53 if (!defined('POSTS_TABLE')) 54 { 55 define('POSTS_TABLE', $wpdb->prefix.'wpbb_posts'); 56 } 44 57 // Contains all user messages 45 define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages'); 58 if (!defined('MESSAGE_TABLE')) 59 { 60 define('MESSAGE_TABLE', $wpdb->prefix.'wpbb_messages'); 61 } 62 // Contains all topics for each user and whether they are read or not 63 if (!defined('UNREAD_TABLE')) 64 { 65 define('UNREAD_TABLE', $wpdb->prefix.'wpbb_topics_unread'); 66 } 46 67 // Define current version 47 define('WPBB_VERSION', 'v1.0.4'); 68 if (!defined('WPBB_VERSION')) 69 { 70 define('WPBB_VERSION', 'v1.1.0'); 71 } 48 72 // Define plugin url (wp plugin page) 49 define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board'); 73 if (!defined('WPBB_PLUGIN_URL')) 74 { 75 define('WPBB_PLUGIN_URL', 'http://wordpress.org/support/plugin/wp-bulletin-board'); 76 } 50 77 51 78 /* … … 53 80 */ 54 81 55 function wpbb_load_language() {56 load_plugin_textdomain('wp-bb', false, dirname(plugin_basename(__FILE__)).'/languages/');57 }58 82 add_action('plugins_loaded', 'wpbb_load_language'); 83 84 if (!function_exists('wpbb_load_language')) 85 { 86 function wpbb_load_language() 87 { 88 load_plugin_textdomain('wp-bb', false, dirname(plugin_basename(__FILE__)).'/languages/'); 89 } 90 } 59 91 60 92 /* … … 75 107 add_action('wp_enqueue_scripts', 'wpbb_register_styles'); 76 108 109 $options = get_option('wpbb_options'); 110 if ($options['post_to_forum'] == 'yes') 111 { 112 add_action('add_meta_boxes', 'wpbb_create_metaboxes'); // Metaboxes 113 add_action('save_post', 'wpbb_post_saved'); // Wordpress post saved 114 } 115 77 116 /* 78 117 All WPBB Admin (Non Page or DB related) Functions … … 81 120 */ 82 121 83 require_once('php/admin/ wpbb-admin-functions.php');122 require_once('php/admin/admin-functions.php'); 84 123 85 124 /* … … 87 126 */ 88 127 89 function wpbb_activate() { 90 // Create all neccessary database tables 91 wpbb_create_db_table(); 92 // Create options in DB for our settings 93 wpbb_create_options(); 94 // Create the user meta for all users currently registered 95 wpbb_setup_user_meta(); 96 // Creates the Forum page 97 wpbb_create_page(); 128 if (!function_exists('wpbb_activate')) 129 { 130 function wpbb_activate() 131 { 132 // Create all neccessary database tables 133 wpbb_create_db_table(); 134 // Create options in DB for our settings 135 wpbb_create_options(); 136 // Create the user meta for all users currently registered 137 wpbb_setup_user_meta(); 138 // Creates the Forum page 139 wpbb_create_page(); 140 } 98 141 } 99 142 … … 102 145 */ 103 146 104 function wpbb_uninstall() { 105 global $wpdb; 106 // Delete main options from database 107 delete_option('wpbb_options'); 108 // Delete theme options 109 delete_option('wpbb_theme_options'); 110 // Delete facebook options 111 delete_option('wpbb_facebook_options'); 112 // Delete twitter options 113 delete_option('wpbb_twitter_options'); 114 // Delete guest options 115 delete_option('wpbb_guest_options'); 116 // Delete the user meta 117 wpbb_delete_user_meta(); 118 // Delete post meta (this function is in wpbb-functions.php as the page is created in wpbb-forum.php) 119 wpbb_delete_post_meta(); 120 // Delete database tables 121 $wpdb->query("DROP TABLE ".CATEGORY_TABLE.", ".TOPICS_TABLE.", ".POSTS_TABLE.", ".MESSAGE_TABLE.";"); 122 } 123 124 function wpbb_delete_user_meta() { 125 global $wpdb; 126 $delete_user_meta = $wpdb->query("DELETE FROM ".$wpdb->prefix."usermeta WHERE meta_key LIKE 'wpbb_%';"); 127 } 128 129 function wpbb_delete_post_meta() { 130 global $wpdb; 131 $post_meta = $wpdb->prefix.'postmeta'; 132 $key = '_wp_page_template'; 133 $value = 'wpbb-template.php'; 134 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '$key' AND meta_value = '$value';"); 135 // Delete the meta data 136 delete_post_meta($post_id, $key, $value); 137 // Delete the page 138 wp_delete_post($post_id, true); 147 if (!function_exists('wpbb_uninstall')) 148 { 149 function wpbb_uninstall() 150 { 151 global $wpdb; 152 delete_option('wpbb_options'); 153 delete_option('wpbb_theme_options'); 154 delete_option('wpbb_facebook_options'); 155 delete_option('wpbb_twitter_options'); 156 delete_option('wpbb_guest_options'); 157 wpbb_delete_user_meta(); 158 wpbb_delete_post_meta(); 159 $wpdb->query("DROP TABLE ".CATEGORY_TABLE.", ".TOPICS_TABLE.", ".POSTS_TABLE.", ".MESSAGE_TABLE.", ".UNREAD_TABLE.";"); 160 } 161 } 162 163 if (!function_exists('wpbb_delete_user_meta')) 164 { 165 function wpbb_delete_user_meta() 166 { 167 global $wpdb; 168 $delete_user_meta = $wpdb->query("DELETE FROM ".$wpdb->prefix."usermeta WHERE meta_key LIKE 'wpbb_%';"); 169 } 170 } 171 172 if (!function_exists('wpbb_delete_post_meta')) 173 { 174 function wpbb_delete_post_meta() 175 { 176 global $wpdb; 177 $post_meta = $wpdb->prefix.'postmeta'; 178 $key = '_wp_page_template'; 179 $value = 'wpbb-template.php'; 180 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '$key' AND meta_value = '$value';"); 181 // Delete the meta data 182 delete_post_meta($post_id, $key, $value); 183 // Delete the page 184 wp_delete_post($post_id, true); 185 } 139 186 } 140 187 … … 143 190 */ 144 191 145 function wpbb_create_db_table() { 146 147 global $wpdb; 148 149 $options = get_option('wpbb_options'); 150 151 // This is not being activated the first time 152 //if (isset($options['version']) && $options['version'] != WPBB_VERSION) { 153 if ($options) { 154 155 wpbb_refresh_roles(); 156 157 } else { 158 192 if (!function_exists('wpbb_create_db_table')) 193 { 194 function wpbb_create_db_table() 195 { 196 global $wpdb; 197 $options = get_option('wpbb_options'); 198 if ($options) 199 { 200 wpbb_refresh_roles(); 201 } 159 202 $roles = wpbb_admin_get_all_roles('string', true); 160 161 203 $perms = "SET($roles) NOT NULL"; 162 163 204 $create_category_query = "CREATE TABLE ".CATEGORY_TABLE." ( 164 205 `id` TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT, 165 `name` VARCHAR( 25) NOT NULL,206 `name` VARCHAR(30) NOT NULL, 166 207 `description` VARCHAR(200) NOT NULL, 167 208 `forum` TINYINT(1) NOT NULL, … … 183 224 `id` INT(1) NOT NULL AUTO_INCREMENT, 184 225 `author` SMALLINT(1) NOT NULL, 185 `name` VARCHAR( 25) NOT NULL,226 `name` VARCHAR(35) NOT NULL, 186 227 `content` TEXT NULL, 187 228 `forum` TINYINT(1) NOT NULL, … … 215 256 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; 216 257 "; 258 259 $create_topic_unread_query = "CREATE TABLE ".UNREAD_TABLE." ( 260 `id` INT(1) NOT NULL, 261 `author` INT(1) NOT NULL, 262 `read` INT(1) NOT NULL 263 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 264 "; 217 265 218 266 $create_category_table = $wpdb->query($create_category_query); … … 220 268 $create_post_table = $wpdb->query($create_post_query); 221 269 $create_message_table = $wpdb->query($create_messages_query); 270 $create_topic_unread_table = $wpdb->query($create_topic_unread_query); 222 271 223 if ($create_category_table === false) { 272 if ($create_category_table === false) 273 { 224 274 $create_category_table_err = __('There was an error creating the table wpbb_categorie', 'wp-bb'); 225 error_log($create_category_table_err);275 error_log($create_category_table_err); 226 276 } 227 if ($create_topic_table === false) { 277 if ($create_topic_table === false) 278 { 228 279 $create_topic_table_err = __('There was an error creating the table wpbb_topics', 'wp-bb'); 229 280 error_log($create_topic_table_err); 230 281 } 231 if ($create_post_table === false) { 282 if ($create_post_table === false) 283 { 232 284 $create_post_table_err = __('There was an error creating the table wpbb_posts', 'wp-bb'); 233 285 error_log($create_post_table_err); 234 286 } 235 if ($create_message_table === false) { 287 if ($create_message_table === false) 288 { 236 289 $create_message_table_err = __('There was an error creating the table wpbb_messages', 'wp-bb'); 237 290 error_log($create_message_table_err); 238 291 } 292 if ($create_topic_unread_table === false) 293 { 294 $create_topic_unread_table_err = __('There was an error creating the table wpbb_topics_unread', 'wp-bb'); 295 error_log($create_topic_unread_table_err); 296 } 239 297 } 240 298 } … … 244 302 */ 245 303 246 function wpbb_create_options() { 247 // Retrieve options from database 248 $old_options = get_option('wpbb_options'); 249 // If options do not exist 250 if (!$old_options) { 251 $maintenance_message = __('This is the message that will be displayed to users when you disable the board. Edit this in your settings.', 'wp-bb'); 252 $forum_name = __('My WPBB Forum', 'wp-bb'); 253 $options = array( 254 'maintenance_mode' => 'off', 255 'maintenance_message' => $maintenance_message, 256 'forum_name' => $forum_name, 257 'forum_prefix' => 'no', 258 'allow_guests' => 'yes', 259 'allow_subforums' => 'yes', 260 'enable_quick_reply' => 'yes', 261 'topics_per_page' => 20, 262 'posts_per_page' => 20, 263 'topic_cutoff' => 15, 264 'post_cutoff' => 15, 265 'post_to_forum' => 'yes', 266 'show_footer' => 'no', 267 'version' => WPBB_VERSION 268 ); 269 $add_wpbb_options = add_option('wpbb_options', $options); 270 } else { 271 if (!isset($old_options['version'])) { 272 // Attempting to update a key in the options value will remove all the other keys so we must 273 // set all the other keys as well 304 if (!function_exists('wpbb_create_options')) 305 { 306 function wpbb_create_options() 307 { 308 // Retrieve options from database 309 $old_options = get_option('wpbb_options'); 310 /* 311 * Add all current roles to an array with a default value of 'yes' 312 * This is for our role permissions 313 */ 314 $roles = wpbb_admin_get_all_roles(); 315 $role_array = array(); 316 if ($roles) 317 { 318 foreach ($roles as $role) 319 { 320 $role_array[$role] = 'yes'; 321 } 322 } 323 // If options do not exist 324 if (!$old_options) 325 { 326 $maintenance_message = __('This is the message that will be displayed to users when you disable the board. Edit this in your settings.', 'wp-bb'); 327 $forum_name = __('My WPBB Forum', 'wp-bb'); 274 328 $options = array( 275 'maintenance_mode' => $old_options['maintenance_mode'],276 'maintenance_message' => $ old_options['maintenance_message'],277 'forum_name' => $ old_options['forum_name'],278 ' forum_prefix' => $old_options['forum_prefix'],279 'allow_ guests' => $old_options['allow_guests'],280 ' allow_subforums' => $old_options['allow_subforums'],281 ' enable_quick_reply' => $old_options['enable_quick_reply'],282 ' topics_per_page' => $old_options['topics_per_page'],283 ' posts_per_page' => $old_options['posts_per_page'],284 ' topic_cutoff' => $old_options['topic_cutoff'],285 'post_ cutoff' => $old_options['post_cutoff'],286 ' post_to_forum' => $old_options['post_to_forum'],287 ' show_footer' => $old_options['show_footer'],329 'maintenance_mode' => 'off', 330 'maintenance_message' => $maintenance_message, 331 'forum_name' => $forum_name, 332 'allow_guests' => 'yes', 333 'allow_subforums' => 'yes', 334 'enable_quick_reply' => 'yes', 335 'topics_per_page' => 20, 336 'posts_per_page' => 20, 337 'topic_cutoff' => 15, 338 'post_cutoff' => 15, 339 'post_to_forum' => 'yes', 340 'show_footer' => 'no', 341 'role_permissions' => $role_array, 288 342 'version' => WPBB_VERSION 289 343 ); 290 update_option('wpbb_options', $options); 291 } 292 } 293 /* Theme Options */ 294 $old_theme_options = get_option('wpbb_theme_options'); 295 if (!$old_theme_options) { 296 $add_wpbb_theme_options = add_option('wpbb_theme_options', array('theme' => 'light')); 297 } 298 /* Facebook Options */ 299 $old_facebook_options = get_option('wpbb_facebook_options'); 300 if (!$old_facebook_options) { 301 $facebook_app_id = __('Enter your Facebook App ID / API Key', 'wp-bb'); 302 $facebook_app_secret_key = __('Enter your App Secret Key', 'wp-bb'); 303 $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb'); 304 $facebook_state = __('Enter a long random string', 'wp-bb'); 305 $facebook_role = __('Enter the default role for new facebook registrations'); 306 $facebook_options = array( 307 'allow_facebook' => 'no', 308 'facebook_app_id' => $facebook_app_id, 309 'facebook_app_secret_key' => $facebook_app_secret_key, 310 'facebook_redirect_uri' => $facebook_redirect_uri, 311 'facebook_state' => $facebook_state, 312 'facebook_default_role' => $facebook_role 313 ); 314 $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options); 315 } 316 /* Twitter Options */ 317 $old_twitter_options = get_option('wpbb_twitter_options'); 318 if (!$old_twitter_options) { 319 $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb'); 320 $twitter_options = array( 321 'allow_twitter' => 'no', 322 'twitter_account' => $twitter_account 323 ); 324 $add_wpbb_twitter_options = add_option('wpbb_twitter_options', $twitter_options); 325 } 326 $old_guest_options = get_option('wpbb_guest_options'); 327 if (!$old_guest_options) { 328 $guest_options = array( 329 'guest_last_post' => '0000-00-00 00:00:00' 330 ); 331 $add_wpbb_guest_options = add_option('wpbb_guest_options', $guest_options); 344 $add_wpbb_options = add_option('wpbb_options', $options); 345 } 346 else 347 { 348 if (!isset($old_options['version'])) 349 { 350 $options = array( 351 'maintenance_mode' => $old_options['maintenance_mode'], 352 'maintenance_message' => $old_options['maintenance_message'], 353 'forum_name' => $old_options['forum_name'], 354 'allow_guests' => $old_options['allow_guests'], 355 'allow_subforums' => $old_options['allow_subforums'], 356 'enable_quick_reply' => $old_options['enable_quick_reply'], 357 'topics_per_page' => $old_options['topics_per_page'], 358 'posts_per_page' => $old_options['posts_per_page'], 359 'topic_cutoff' => $old_options['topic_cutoff'], 360 'post_cutoff' => $old_options['post_cutoff'], 361 'post_to_forum' => $old_options['post_to_forum'], 362 'show_footer' => $old_options['show_footer'], 363 'role_permissions' => $role_array, 364 'version' => WPBB_VERSION 365 ); 366 update_option('wpbb_options', $options); 367 } 368 } 369 /* Theme Options */ 370 $old_theme_options = get_option('wpbb_theme_options'); 371 if (!$old_theme_options) 372 { 373 $add_wpbb_theme_options = add_option('wpbb_theme_options', array('theme' => 'light')); 374 } 375 /* Facebook Options */ 376 $old_facebook_options = get_option('wpbb_facebook_options'); 377 if (!$old_facebook_options) { 378 $facebook_app_id = __('Enter your Facebook App ID / API Key', 'wp-bb'); 379 $facebook_app_secret_key = __('Enter your App Secret Key', 'wp-bb'); 380 $facebook_redirect_uri = __('Enter your URL (Redirect URL)', 'wp-bb'); 381 $facebook_state = __('Enter a long random string', 'wp-bb'); 382 $facebook_role = __('Enter the default role for new facebook registrations'); 383 $facebook_options = array( 384 'allow_facebook' => 'no', 385 'facebook_app_id' => $facebook_app_id, 386 'facebook_app_secret_key' => $facebook_app_secret_key, 387 'facebook_redirect_uri' => $facebook_redirect_uri, 388 'facebook_state' => $facebook_state, 389 'facebook_default_role' => $facebook_role 390 ); 391 $add_wpbb_facebook_options = add_option('wpbb_facebook_options', $facebook_options); 392 } 393 /* Twitter Options */ 394 $old_twitter_options = get_option('wpbb_twitter_options'); 395 if (!$old_twitter_options) 396 { 397 $twitter_account = __('Enter your website/personal Twitter Account', 'wp-bb'); 398 $twitter_options = array( 399 'allow_twitter' => 'no', 400 'twitter_account' => $twitter_account 401 ); 402 $add_wpbb_twitter_options = add_option('wpbb_twitter_options', $twitter_options); 403 } 404 $old_guest_options = get_option('wpbb_guest_options'); 405 if (!$old_guest_options) 406 { 407 $guest_options = array( 408 'guest_last_post' => '0000-00-00 00:00:00' 409 ); 410 $add_wpbb_guest_options = add_option('wpbb_guest_options', $guest_options); 411 } 332 412 } 333 413 } … … 337 417 */ 338 418 339 function wpbb_admin_pages() { 340 341 $create_category = __('Create Category', 'wp-bb'); 342 $create_forum = __('Create Forum', 'wp-bb'); 343 $create_subforum = __('Create Subforum', 'wp-bb'); 344 $create_topic = __('Create Topic', 'wp-bb'); 345 $create_tools = __('Tools', 'wp-bb'); 346 $faq_support = __('FAQ & Support', 'wp-bb'); 347 $settings = __('WPBB Settings', 'wp-bb'); 348 349 // Main WPBB page 350 add_menu_page('WPBB Overview', 'WPBB', 'manage_options', 'wpbb_admin', 'wpbb_admin_display', '', 26); 351 352 // Create/Edit Category 353 add_submenu_page('wpbb_admin', 'WPBB Categories', $create_category, 'manage_options', 'wpbb_admin_categories', 'wpbb_admin_categories'); 354 355 // Create/Edit Forum 356 add_submenu_page('wpbb_admin', 'WPBB Forums', $create_forum, 'manage_options', 'wpbb_admin_forums', 'wpbb_admin_forums'); 357 358 // Create/Edit Subforum 359 add_submenu_page('wpbb_admin', 'WPBB Subforums', $create_subforum, 'manage_options', 'wpbb_admin_subforums', 'wpbb_admin_subforums'); 360 361 // Create/Edit Topics 362 add_submenu_page('wpbb_admin', 'WPBB Topics', $create_topic, 'manage_options', 'wpbb_admin_topics', 'wpbb_admin_topics'); 363 364 // Create Tools page 365 add_submenu_page('wpbb_admin', 'WPBB Tools', $create_tools, 'manage_options', 'wpbb_admin_tools', 'wpbb_admin_tools'); 366 367 // FAQ / First Installation Page 368 add_submenu_page('wpbb_admin', 'FAQ / Support', $faq_support, 'manage_options', 'wpbb_admin_help', 'wpbb_admin_help'); 369 370 // WPBB Settings 371 add_options_page('WPBB Settings', $settings, 'manage_options', 'wpbb_settings_page', 'wpbb_display_settings'); 372 } 373 374 function wpbb_create_template_file() { 375 // Get current theme directory 376 $template_directory = get_template_directory(); 377 // Check if required template file doesn't exist and if true create it 378 if (!file_exists($template_directory.'/wpbb-template.php')) { 379 // Check directory is writable 380 if (is_writable($template_directory)) { 381 // Copys wp-bb template file to your current theme 382 $template_file_path = WPBB_DIR.'/wpbb-template.php'; 383 $move_template_file = copy($template_file_path, $template_directory.'/wpbb-template.php'); 384 if (!$move_template_file) { 385 $move_template_file_failed = sprintf(__('Failed to move required wp-bb template file %s to theme directory %s. Please make sure both the file and directory exist or move the wp-bb template file to your current theme directory manually'), $template_file_path, $template_directory); 386 error_log($move_template_file_failed); 419 if (!function_exists('wpbb_admin_pages')) 420 { 421 function wpbb_admin_pages() 422 { 423 $create_category = __('Create Category', 'wp-bb'); 424 $create_forum = __('Create Forum', 'wp-bb'); 425 $create_subforum = __('Create Subforum', 'wp-bb'); 426 $create_topic = __('Create Topic', 'wp-bb'); 427 $role_permissions = __('Role Permissions', 'wp-bb'); 428 $create_tools = __('Tools', 'wp-bb'); 429 $faq_support = __('FAQ & Support', 'wp-bb'); 430 $settings = __('WPBB Settings', 'wp-bb'); 431 432 // Main WPBB page 433 add_menu_page('WPBB Overview', 'WPBB', 'manage_options', 'wpbb_admin', 'wpbb_admin_display', '', 27.7); 434 435 // Create/Edit Category 436 add_submenu_page('wpbb_admin', 'WPBB Categories', $create_category, 'manage_options', 'wpbb_admin_categories', 'wpbb_admin_categories'); 437 438 // Create/Edit Forum 439 add_submenu_page('wpbb_admin', 'WPBB Forums', $create_forum, 'manage_options', 'wpbb_admin_forums', 'wpbb_admin_forums'); 440 441 // Create/Edit Subforum 442 add_submenu_page('wpbb_admin', 'WPBB Subforums', $create_subforum, 'manage_options', 'wpbb_admin_subforums', 'wpbb_admin_subforums'); 443 444 // Create/Edit Topics 445 add_submenu_page('wpbb_admin', 'WPBB Topics', $create_topic, 'manage_options', 'wpbb_admin_topics', 'wpbb_admin_topics'); 446 447 // Role permissions 448 add_submenu_page('wpbb_admin', 'Role Permissions', $role_permissions, 'manage_options', 'wpbb_admin_role_permissions', 'wpbb_admin_role_permissions'); 449 450 // Create Tools page 451 add_submenu_page('wpbb_admin', 'WPBB Tools', $create_tools, 'manage_options', 'wpbb_admin_tools', 'wpbb_admin_tools'); 452 453 // FAQ / First Installation Page 454 add_submenu_page('wpbb_admin', 'FAQ / Support', $faq_support, 'manage_options', 'wpbb_admin_help', 'wpbb_admin_help'); 455 456 // Shortcut to WPBB settings - some people don't know they exist 457 add_submenu_page('wpbb_admin', 'WPBB Settings', $settings, 'manage_options', 'wpbb_settings_page', 'wpbb_display_settings'); 458 459 // WPBB Settings 460 add_options_page('WPBB Settings', $settings, 'manage_options', 'wpbb_settings_page', 'wpbb_display_settings'); 461 } 462 } 463 464 465 if (!function_exists('wpbb_create_template_file')) 466 { 467 function wpbb_create_template_file() 468 { 469 // Get current theme directory 470 $template_directory = get_template_directory(); 471 // Check if required template file doesn't exist and if true create it 472 if (!file_exists($template_directory.'/wpbb-template.php')) 473 { 474 // Check directory is writable 475 if (is_writable($template_directory)) 476 { 477 // Copys wp-bb template file to your current theme 478 $template_file_path = WPBB_DIR.'/wpbb-template.php'; 479 $move_template_file = copy($template_file_path, $template_directory.'/wpbb-template.php'); 480 if (!$move_template_file) 481 { 482 $move_template_file_failed = sprintf(__('Failed to move required wp-bb template file %s to theme directory %s. Please make sure both the file and directory exist or move the wp-bb template file to your current theme directory manually'), $template_file_path, $template_directory); 483 error_log($move_template_file_failed); 484 } 387 485 } 388 } else { // Is not writable and user should change permissions accordingly 389 $template_write_failed = sprintf(__('%s is not writable. Could not create required WPBB template file forum.php. Please change the folders permissions and visit your Wordpress site again or copy the file forum.php from your wp-bb plugin folder to your template folders directory manually.'), $template_directory); 390 error_log($template_write_failed); 391 } 392 } 393 } 394 395 function wpbb_create_page() { 396 // Check the page doesn't already exist (e.g. when reactivating) 397 global $wpdb; 398 $post_meta = $wpdb->prefix.'postmeta'; 399 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';"); 400 if ($post_id == NULL) { 401 $wpbb_page_title = __('Forums', 'wp-bb'); 402 $link = site_url().'/'.strtolower($wpbb_page_title); 403 $page = array( 404 'post_status' => 'publish', 405 'post_title' => $wpbb_page_title, 406 'comment_status' => 'closed', 407 'post_type' => 'page' 408 ); 409 global $forum_page; 410 $forum_page = wp_insert_post($page, false); 411 add_post_meta($forum_page, '_wp_page_template', 'wpbb-template.php', true); 412 } 413 // This function checks if the template file exists before doing anything 414 $template = wpbb_create_template_file(); 415 } 416 417 function wpbb_register_styles() { 418 $wpbb_theme_options = get_option('wpbb_theme_options'); 419 if ($wpbb_theme_options['theme'] == 'light') { 420 wp_register_style('wpbb-light-style', plugins_url('wp-bulletin-board/css/wpbb-light-style.css')); 421 wp_enqueue_style('wpbb-light-style'); 422 } else { 423 wp_register_style('wpbb-dark-style', plugins_url('wp-bulletin-board/css/wpbb-dark-style.css')); 424 wp_enqueue_style('wpbb-dark-style'); 486 else 487 { 488 // Is not writable and user should change permissions accordingly 489 $template_write_failed = sprintf(__('%s is not writable. Could not create required WPBB template file forum.php. Please change the folders permissions and visit your Wordpress site again or copy the file forum.php from your wp-bb plugin folder to your template folders directory manually.'), $template_directory); 490 error_log($template_write_failed); 491 } 492 } 493 } 494 } 495 496 if (!function_exists('wpbb_create_page')) 497 { 498 function wpbb_create_page() 499 { 500 // Check the page doesn't already exist (e.g. when reactivating) 501 global $wpdb; 502 $post_meta = $wpdb->prefix.'postmeta'; 503 $post_id = $wpdb->get_var("SELECT post_id FROM $post_meta WHERE meta_key = '_wp_page_template' AND meta_value = 'wpbb-template.php';"); 504 if ($post_id == NULL) 505 { 506 $wpbb_page_title = __('Forums', 'wp-bb'); 507 $link = site_url().'/'.strtolower($wpbb_page_title); 508 $page = array( 509 'post_status' => 'publish', 510 'post_title' => $wpbb_page_title, 511 'comment_status' => 'closed', 512 'post_type' => 'page' 513 ); 514 global $forum_page; 515 $forum_page = wp_insert_post($page, false); 516 add_post_meta($forum_page, '_wp_page_template', 'wpbb-template.php', true); 517 } 518 // This function checks if the template file exists before doing anything 519 $template = wpbb_create_template_file(); 520 } 521 } 522 523 /* 524 Wordpress post metaboxes 525 */ 526 527 if (!function_exists('wpbb_post_saved')) 528 { 529 function wpbb_post_saved($_post_id) 530 { 531 if (wp_is_post_revision($_post_id)) 532 { 533 return; 534 } 535 static $first = true; 536 if (!$first) return; 537 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) 538 { 539 return; 540 } 541 $post_metabox_nonce = isset($_POST['wpbb-post-metabox-nonce']); 542 if (!wp_verify_nonce($post_metabox_nonce, plugin_basename(__FILE__))) 543 { 544 return; 545 } 546 $_post_type = isset($_POST['post_type']); 547 if ('post' == $_post_type) 548 { 549 if (!current_user_can('edit_page', $_post_id)) 550 { 551 return; 552 } 553 } 554 $post_id = absint($_post_id); 555 $post_data = get_post($post_id, ARRAY_A); 556 $post_to_forum_id = NULL; 557 if (isset($_POST['wpbb-post-to-forum'])) 558 { 559 $post_to_forum_id = absint($_POST['wpbb-post-to-forum']); 560 } 561 if ($post_to_forum_id == NULL) 562 { 563 error_log(__('When copying the post to a WPBB forum, the wpbb-post-to-forum was NULL - a forum ID wasn\'t provided')); 564 } 565 $is_forum = NULL; 566 $is_subforum = NULL; 567 global $wpdb; 568 // Check to see if this forum is a forum or a subforum 569 $forum_or_subforum = $wpdb->get_results("SELECT `forum`, `subforum` FROM ".CATEGORY_TABLE." WHERE id = $post_to_forum_id;"); 570 if ($forum_or_subforum) 571 { 572 foreach ($forum_or_subforum as $forum) 573 { 574 if ($forum->forum > 0 && $forum->subforum == 0) 575 { 576 // Forum 577 $is_forum = true; 578 $is_subforum = false; 579 } 580 else if ($forum->subforum > 0 && $forum->forum == 0) 581 { 582 // Subforum 583 $is_subforum = true; 584 $is_forum = false; 585 } 586 } 587 } 588 if ($post_data) 589 { 590 $forum_id = ($is_forum) ? $post_to_forum_id : 0; 591 $subforum_id = ($is_subforum) ? $post_to_forum_id : 0; 592 $data = array( 593 'name' => $post_data['post_title'], 594 'author' => $post_data['post_author'], 595 'content' => $post_data['post_content'], 596 'forum' => $forum_id, 597 'subforum' => $subforum_id, 598 'status' => '', 599 'created' => $post_data['post_date'], 600 'last_reply' => $post_data['post_date'] 601 ); 602 $copy_post_to_forum = $wpdb->insert(TOPICS_TABLE, $data); 603 if ($copy_post_to_forum === false) 604 { 605 error_log(__('Failed to copy the wordpress post to the wpbb forum', 'wp-bb')); 606 } 607 else 608 { 609 // Update authors post count 610 wpbb_admin_update_user_meta($post_data['post_author'], 'increase'); 611 $first = false; 612 } 613 } 614 } 615 } 616 617 if (!function_exists('wpbb_display_metaboxes')) 618 { 619 function wpbb_display_metaboxes() 620 { 621 global $wpdb; 622 wp_nonce_field(plugin_basename(__FILE__), 'wpbb-post-metabox-nonce'); 623 ?> 624 <div id="minor-publishing-actions"> 625 <p class="description">Send a copy of this post to one of your WPBB forums or subforums or check "None" or disable this in your WPBB Settings</p> 626 <select name="wpbb-post-to-forum"> 627 <!-- Default --> 628 <option value="0">None</option> 629 <?php 630 // All forums and subforums 631 $forums = $wpdb->get_results("SELECT `id`, `name` FROM ".CATEGORY_TABLE." WHERE forum > 0 || subforum > 0;"); 632 if ($forums) 633 { 634 foreach ($forums as $forum) 635 { 636 ?> 637 <option value="<?php echo $forum->id; ?>"><?php echo $forum->name;?></option> 638 <?php 639 } 640 } 641 ?> 642 </select> 643 </div> 644 <?php 645 } 646 } 647 648 if (!function_exists('wpbb_create_metaboxes')) 649 { 650 function wpbb_create_metaboxes() 651 { 652 add_meta_box('wpbb-post-to-forum-meta-box', __('Post to WPBB Forum', 'wp-bb'), 'wpbb_display_metaboxes', 'post', 'side', 'high', NULL); 653 } 654 } 655 656 /* 657 Register and loads the style and javascript files depending on settings 658 */ 659 660 if (!function_exists('wpbb_register_styles')) 661 { 662 function wpbb_register_styles() 663 { 664 $wpbb_theme_options = get_option('wpbb_theme_options'); 665 if ($wpbb_theme_options['theme'] == 'light') 666 { 667 wp_register_style('wpbb-light-style', plugins_url('wp-bulletin-board/css/wpbb-light-style.css')); 668 wp_enqueue_style('wpbb-light-style'); 669 } 670 else 671 { 672 wp_register_style('wpbb-dark-style', plugins_url('wp-bulletin-board/css/wpbb-dark-style.css')); 673 wp_enqueue_style('wpbb-dark-style'); 674 } 675 wp_enqueue_script('jquery'); 676 wp_register_script('wpbb-search', plugins_url('wp-bulletin-board/js/wpbb-search.js'), 'jquery'); 677 wp_enqueue_script('wpbb-search'); 425 678 } 426 679 } … … 432 685 */ 433 686 434 function wpbb_admin_display() { 435 require_once('php/admin/wpbb-admin-main.php'); 436 } 687 if (!function_exists('wpbb_admin_display')) 688 { 689 function wpbb_admin_display() 690 { 691 require_once('php/admin/admin-main.php'); 692 } 693 } 694 437 695 438 696 … … 441 699 */ 442 700 443 function wpbb_admin_categories() { 444 require_once('php/admin/wpbb-admin-categories.php'); 701 if (!function_exists('wpbb_admin_categories')) 702 { 703 function wpbb_admin_categories() 704 { 705 require_once('php/admin/admin-categories.php'); 706 } 445 707 } 446 708 … … 449 711 */ 450 712 451 function wpbb_admin_forums() { 452 require_once('php/admin/wpbb-admin-forums.php'); 713 if (!function_exists('wpbb_admin_forums')) 714 { 715 function wpbb_admin_forums() 716 { 717 require_once('php/admin/admin-forums.php'); 718 } 453 719 } 454 720 … … 457 723 */ 458 724 459 function wpbb_admin_subforums() { 460 require_once('php/admin/wpbb-admin-subforums.php'); 725 if (!function_exists('wpbb_admin_subforums')) 726 { 727 function wpbb_admin_subforums() 728 { 729 require_once('php/admin/admin-subforums.php'); 730 } 461 731 } 462 732 … … 465 735 */ 466 736 467 function wpbb_admin_topics() { 468 require_once('php/admin/wpbb-admin-topics.php'); 737 if (!function_exists('wpbb_admin_topics')) 738 { 739 function wpbb_admin_topics() 740 { 741 require_once('php/admin/admin-topics.php'); 742 } 743 } 744 745 /* 746 Role Permissions 747 */ 748 749 if (!function_exists('wpbb_admin_role_permissions')) 750 { 751 function wpbb_admin_role_permissions() 752 { 753 require_once('php/admin/admin-role-permissions.php'); 754 } 469 755 } 470 756 … … 473 759 */ 474 760 475 function wpbb_admin_tools() { 476 require_once('php/admin/wpbb-admin-tools.php'); 761 if (!function_exists('wpbb_admin_tools')) 762 { 763 function wpbb_admin_tools() 764 { 765 require_once('php/admin/admin-tools.php'); 766 } 477 767 } 478 768 … … 481 771 */ 482 772 483 function wpbb_admin_help() { 484 require_once('php/admin/wpbb-admin-faq-support.php'); 485 } 486 773 if (!function_exists('wpbb_admin_help')) 774 { 775 function wpbb_admin_help() 776 { 777 require_once('php/admin/admin-faq-support.php'); 778 } 779 } 487 780 488 781 /* … … 490 783 */ 491 784 492 function wpbb_display_settings() { 493 require_once('php/admin/wpbb-admin-settings.php'); 785 if (!function_exists('wpbb_display_settings')) 786 { 787 function wpbb_display_settings() 788 { 789 require_once('php/admin/admin-settings.php'); 790 } 494 791 } 495 792
Note: See TracChangeset
for help on using the changeset viewer.