Forum

Whether it's a plugin thats causing issues, a theme, or just needed help with styling your site...We can help! Live Person Support for all your Wordpress Needs!

Welcome Guest

Pages: 1
auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure
whyameyePostMar 01 2012, 01:14 PM

Newbie
Posts: 16
Registered:
Jan 19 2012, 06:59 AM
Hot topicauto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

I've tried all the forum plugins out there and Mingle Forum is definitely the best for me, but it was still missing some features I needed for my users. I added these features and think they might be useful to others. I'd really like the developers to consider rolling these changes into the next official release.
Specifically I added:
- an option in admin panel to change forum behavior such that users subscribed to topics in a forum would "opt out" of subscribing to the replies of those topics instead of "opt in" to subscribing to replies of topics as is currently the behavior. In other words, users subscribed to topics are also automatically subscribed to the replies of these topics.
- a dropdown roles list in admin menu such that admin can choose to allow roles under admin (editor, author, etc.) to change forum structure in the dashboard.
- an option in admin menu so that users can add any attachment of wordpress-acceptable mimetype i.e. admin can choose to allow users to upload 1) nothing 2) only images or 3) any attachment wordpress allows.

Regarding attachments I also:
- changed the naming convention of attachments: instead of attachments receiving a random prefix to their names, the attachments retain their original names. If an attachment with that name already exists, the file is renamed to <basename>-1.<ext> or if that exists then <basename-2>.<ext> etc.
- moved away from a hard-coded string search of extensions to determine their type, instead using the built-in wordpress filetype/mimetype checks.
- added an error message when a user tries to upload an attachment whose mimetype is not allowed.

If the need for the changes are not immediately apparent, I would be glad to explain further. I believe these are fairly generic changes that others would profit from.

Below is a cut-paste of the diff file. You should be able to patch the 1.0.33 release with the below to try out the changes. If you need, I can attach the diff file somewhere:

diff -rup mingle-forum.1.0.33/fs-admin/fs-admin.php forum-with-patches/fs-admin/fs-admin.php
--- mingle-forum.1.0.33/fs-admin/fs-admin.php   2012-01-20 17:27:15.000000000 -0600
+++ forum-with-patches/fs-admin/fs-admin.php    2012-03-01 12:35:17.693879439 -0600
@@ -184,6 +184,7 @@ $image = WPFURL."images/user.png";
                                                                        'forum_posts_per_page'                  => $op['forum_posts_per_page'],
                                                                        'forum_threads_per_page'                => $op['forum_threads_per_page'],
                                                                        'forum_require_registration'    => $op['forum_require_registration'],
+                                                                       'forum_auto_subscribe'  => $op['forum_auto_subscribe'],
                                                                        'forum_show_login_form'                 => $op['forum_show_login_form'],
                                                                        'forum_date_format'                     => $op['forum_date_format'],
                                                                        'forum_use_gravatar'                    => $op['forum_use_gravatar'],
@@ -191,7 +192,7 @@ $image = WPFURL."images/user.png";
                                                                        'forum_skin'                                    => $_GET['skin'],
                                                                        'forum_use_rss'                                 => $op['forum_use_rss'],
                                                                        'forum_use_seo_friendly_urls'   => $op['forum_use_seo_friendly_urls'],
-                                                                       'forum_allow_image_uploads'             => $op['forum_allow_image_uploads'],
+                                                                       'forum_allow_uploads'           => $op['forum_allow_uploads'],
                                                                        'notify_admin_on_new_posts'             => $op['notify_admin_on_new_posts'],
                                                                        'set_sort'                                              => $op['set_sort'],
                                                                        'forum_use_spam'                                => $op['forum_use_spam'],
@@ -200,7 +201,8 @@ $image = WPFURL."images/user.png";
                                                                        'hot_topic'                                             => $op['hot_topic'],
                                                                        'veryhot_topic'                                 => $op['veryhot_topic'],
                                                                        'forum_display_name'                    => $op['forum_display_name'],
-                                                                       'level_one'                                     => $op['level_one'],
+                                                                       'forum_admin_role'                      => $op['forum_admin_role'],
+                                                                       'level_one'                                     => $op['level_one'],
                                                                        'level_two'                                             => $op['level_two'],
                                                                        'level_three'                                   => $op['level_three'],
                                                                        'level_newb_name'                               => $op['level_newb_name'],
@@ -447,6 +449,20 @@ $image = WPFURL."images/user.png";
                        echo "</select> ($defStr = user_login)
                        </td>
                </tr>
+                <tr class='alternate'>
+                       <td>".__("Minimum user role required to edit forum structure:", "mingleforum")."</td>
+                       <td>
+                               <select name='forum_admin_role'>";
+                               if (!isset($wp_roles))
+                                 $wp_roles = new WP_Roles();
+                               $min_user_roles = $wp_roles->role_names;
+                               foreach($min_user_roles as $name)
+                                 if ($name == $op['forum_admin_role'])
+                                   echo "<option value='".$name."' selected='selected'>".$name."          </option>";
+                                 else
+                                   echo "<option value='".$name."'>".$name."          </option>";
+                       echo "</select> ($defStr = Administrator)
+                       </td>
                <tr class='alternate'>
                        <td>".__("New User's Title:", "mingleforum")."</td>
                        <td><input type='text' name='level_newb_name' value='".$op['level_newb_name']."' /> ($defStr = ".__('Newbie', 'mingleforum').")</td>
@@ -499,11 +515,21 @@ $image = WPFURL."images/user.png";
                </tr>

                <tr class='alternate'>
-                       <td>".__("Allow Images to be uploaded:", "mingleforum")."</td>
-                       <td><input type='checkbox' name='forum_allow_image_uploads' value='true'";
-                if($op['forum_allow_image_uploads'] == 'true')
+                       <td>".__("Allow uploads:", "mingleforum")."</td>
+                       <td><input type='radio' name='forum_allow_uploads' value='no'";
+               if($op['forum_allow_uploads'] == 'no')
                        echo "checked='checked'";
-               echo "/> ($defStr = ".__('Off', 'mingleforum').")</td>
+               echo "/>No  
+                       <input type='radio' name='forum_allow_uploads' value='image'";
+                if($op['forum_allow_uploads'] == 'image')
+                       echo "checked='checked'";
+               echo "/>Only images  
+                       <input type='radio' name='forum_allow_uploads' value='all'";
+                if($op['forum_allow_uploads'] == 'all')
+                       echo "checked='checked'";
+               echo "/>All acceptable mimetypes  
+
+ ($defStr = ".__('No', 'mingleforum').")</td>
                </tr>

                <tr class='alternate'>
@@ -553,6 +579,12 @@ $image = WPFURL."images/user.png";
                                echo "checked='checked'";
                        echo "/> (".__("Requires ", "mingleforum")."<a href='http://www.libgd.org/Main_Page'>GD</a> library - ".__("If you have 'Registration required to post' above enabled, leave this off", "mingleforum").") $lib</td>
                        </tr>";
+                       echo "<tr class='alternate'>
+                               <td>".__("Forum subscribers are automatically subscribed to replies:", "mingleforum")."</td>
+                               <td><input type='checkbox' name='forum_auto_subscribe' value='true'";
+                        if($op['forum_auto_subscribe'] == 'true')
+                               echo "checked='checked'";
+                       echo "/> ($defStr = ".__('On', 'mingleforum').")</td></tr>";

                        echo "<tr class='alternate'>
                                <td valign='top'>".__("Date format:", "mingleforum")."</td><td><input type='text' name='forum_date_format' value='".$op['forum_date_format']."' /> <p>".__("Default date:", "mingleforum")." \"F j, Y, H:i\". <br />".__("Check ", "mingleforum")."<a href='http://www.php.net'>http://www.php.net</a> ".__("for date formatting.", "mingleforum")."</p></td>
@@ -580,6 +612,7 @@ $image = WPFURL."images/user.png";
                                                                'forum_posts_per_page'                  => $wpdb->escape($_POST['forum_posts_per_page']),
                                                                'forum_threads_per_page'                => $wpdb->escape($_POST['forum_threads_per_page']),
                                                                'forum_require_registration'    => $_POST['forum_require_registration'],
+                                                               'forum_auto_subscribe'          => $_POST['forum_auto_subscribe'],
                                                                'forum_show_login_form'                 => $_POST['forum_show_login_form'],
                                                                'forum_date_format'                     => $wpdb->escape($_POST['forum_date_format']),
                                                                'forum_use_gravatar'                    => $_POST['forum_use_gravatar'],
@@ -587,7 +620,7 @@ $image = WPFURL."images/user.png";
                                                                'forum_skin'                                    => $op['forum_skin'],
                                                                'forum_use_rss'                                 => $_POST['forum_use_rss'],
                                                                'forum_use_seo_friendly_urls'   => $_POST['forum_use_seo_friendly_urls'],
-                                                               'forum_allow_image_uploads'             => $_POST['forum_allow_image_uploads'],
+                                                               'forum_allow_uploads'           => $_POST['forum_allow_uploads'],
                                                                'notify_admin_on_new_posts'             => $_POST['notify_admin_on_new_posts'],
                                                                'set_sort'                                              => $op['set_sort'],
                                                                'forum_use_spam'                                => $_POST['forum_use_spam'],
@@ -596,6 +629,7 @@ $image = WPFURL."images/user.png";
                                                                'hot_topic'                                     => $wpdb->escape($_POST['hot_topic']),
                                                                'veryhot_topic'                                 => $wpdb->escape($_POST['veryhot_topic']),
                                                                'forum_display_name'                    => $_POST['forum_display_name'],
+                                                               'forum_admin_role'                      => $_POST['forum_admin_role'],
                                                                'level_one'                                     => $wpdb->escape($_POST['level_one']),
                                                                'level_two'                                             => $wpdb->escape($_POST['level_two']),
                                                                'level_three'                                   => $wpdb->escape($_POST['level_three']),
diff -rup mingle-forum.1.0.33/wpf.class.php forum-with-patches/wpf.class.php
--- mingle-forum.1.0.33/wpf.class.php   2012-01-20 17:27:15.000000000 -0600
+++ forum-with-patches/wpf.class.php    2012-03-01 13:22:42.699003238 -0600
@@ -135,6 +135,7 @@ class mingleforum{
                                                                'forum_posts_per_page'                  => 10,
                                                                'forum_threads_per_page'                => 20,
                                                                'forum_require_registration'    => true,
+                                                               'forum_auto_subscribe'  => true,
                                                                'forum_show_login_form'                 => true,
                                                                'forum_date_format'                     => "F j, Y, H:i",
                                                                'forum_use_gravatar'                    => true,
@@ -142,7 +143,7 @@ class mingleforum{
                                                                'forum_skin'                                    => "Default",
                                                                'forum_use_rss'                                 => true,
                                                                'forum_use_seo_friendly_urls'   => false,
-                                                               'forum_allow_image_uploads'             => false,
+                                                               'forum_allow_uploads'           => "no",
                                                                'notify_admin_on_new_posts'             => false,
                                                                'set_sort'                                              => "DESC",
                                                                'forum_use_spam'                                => false,
@@ -180,7 +181,9 @@ class mingleforum{
                add_submenu_page("mingle-forum", __("Mingle Forum - Options", "mingleforum"), __("Options", "mingleforum"), "administrator", 'mingle-forum', array(&$wpfa, "options"));
                add_submenu_page('mingle-forum', __('Ads', 'mingleforum'), __('Ads', 'mingleforum'), "administrator", 'mfads', array(&$wpfa, "ads"));
                add_submenu_page("mingle-forum", __("Skins", "mingleforum"), __("Skins", "mingleforum"), "administrator", 'mfskins', array(&$wpfa, "skins"));
-               add_submenu_page("mingle-forum", __("Forum Structure - Categories & Forums", "mingleforum"), __("Forum Structure", "mingleforum"), "administrator", 'mfstructure', array(&$wpfa, "structure"));
+               $options = get_option('mingleforum_options');
+               $forum_admin_role = strtolower($options['forum_admin_role']);
+               add_submenu_page("mingle-forum", __("Forum Structure - Categories & Forums", "mingleforum"), __("Forum Structure", "mingleforum"), $forum_admin_role, 'mfstructure', array(&$wpfa, "structure"));
                add_submenu_page("mingle-forum", __("Moderators", "mingleforum"), __("Moderators", "mingleforum"), "administrator", 'mfmods', array(&$wpfa, "moderators"));
                add_submenu_page("mingle-forum", __("User Groups", "mingleforum"), __("User Groups", "mingleforum"), "administrator", 'mfgroups', array(&$wpfa, "usergroups"));
                add_submenu_page("mingle-forum", __("About", "mingleforum"), __("About", "mingleforum"), "administrator", 'mfabout', array(&$wpfa, "about"));
@@ -724,7 +727,10 @@ class mingleforum{
                        if($this->is_forum_subscribed())
                                $this->notify_msg = __("Remove this Forum from your email notifications?", "mingleforum");
                        else
-                               $this->notify_msg = __("This will notify you of all new Topics created in this Forum. Are you sure that is what you want to do?", "mingleforum");
+                         if ($this->options['forum_auto_subscribe'])
+                           $this->notify_msg = __("This will notify you of all new Topics and Replies created in this Forum. Are you sure that is what you want to do?", "mingleforum");
+                         else
+                           $this->notify_msg = __("This will notify you of all new Topics created in this Forum. Are you sure that is what you want to do?", "mingleforum");
                        $this->header();
                        if(isset($_GET['getNewForumID'])){
                                $out .= $this->getNewForumID();
@@ -2698,6 +2704,17 @@ DISABLED THIS IN 1.0.25*/
                return $out;
        }

+       function add_thread_subscribers($thread_id, $forum_id)
+       {
+         if ($this->options['forum_auto_subscribe']) {
+            $forum_subscribers = get_option("mf_forum_subscribers_".$forum_id, array());
+            foreach ($forum_subscribers as $forum_subscriber) {
+             $thread_subscribers[] = $forum_subscriber;
+           }
+           update_option("mf_thread_subscribers_".$thread_id, $thread_subscribers);
+         }
+       }
+
        function notify_thread_subscribers($thread_id, $subject, $content, $date)
        {
                global $user_ID;
diff -rup mingle-forum.1.0.33/wpf-insert.php forum-with-patches/wpf-insert.php
--- mingle-forum.1.0.33/wpf-insert.php  2012-01-20 17:27:15.000000000 -0600
+++ forum-with-patches/wpf-insert.php   2012-03-01 11:47:07.713650031 -0600
@@ -22,28 +22,28 @@ if(is_numeric($the_forum_id))
 }
 //End Check

-       function mf_u_key()
-       {
-               $pref = "";
-               for ($i = 0; $i < 5; $i++)
-               {
-               $d = rand(0,1);
-               $pref .= $d ? chr(rand(97, 122)) : chr(rand(48, 57));
-               }
-               return $pref."-";
-       }
-
-       function MFAttachImage($temp, $name)
+       function MFAttachFile($temp, $name)
        {
                //GET USERS UPLOAD PATH
                $upload_dir = wp_upload_dir();
                $path = $upload_dir['path']."/";
                $url = $upload_dir['url']."/";
-               $u = mf_u_key();
                $name = sanitize_file_name($name);
-               if(!empty($name))
-                       move_uploaded_file($temp, $path.$u.$name);
-               return "\n[img]".$url.$u.$name."[/img]";
+               if(!empty($name)) {
+                 $basename = MFGetFilename(stripslashes($name));
+                 $ext = MFGetExt(stripslashes($name));
+                 $j = 1;
+                 while (file_exists($path.$basename.$i.".".$ext)) {
+                   $i = '-('.(string)$j.')';
+                   $j++;
+                 }
+                 move_uploaded_file($temp, $path.$basename.$i.".".$ext);
+                 $filetype = wp_check_filetype($name);
+                 if (strpos(strtolower($filetype['type']),'image') === false)
+                   return "\n[url]".$url.$basename.$i.".".$ext."[/url]";
+                 else
+                   return "\n[img]".$url.$basename.$i.".".$ext."[/img]";
+               }
        }

        function MFGetExt($str)
@@ -56,39 +56,59 @@ if(is_numeric($the_forum_id))
                return $ext;
        }

+       function MFGetFilename($str)
+       {
+               //GETS THE BASE FILENAME BELONGING TO THE UPLOADED FILE
+               $i = strrpos($str,".");
+               if (!$i) { return $str; }
+               $filename = substr($str, 0, $i);
+               return $filename;
+       }
+
        function mf_check_uploaded_images()
        {
-               $valid = array('im1' => true, 'im2' => true, 'im3' => true);
+               global $options;
+
+               $valid = array('im1' => 1, 'im2' => 1, 'im3' => 1);
                if($_FILES["mfimage1"]["error"] > 0 && !empty($_FILES["mfimage1"]["name"]))
                        $valid['im1'] = false;
                if($_FILES["mfimage2"]["error"] > 0 && !empty($_FILES["mfimage2"]["name"]))
                        $valid['im2'] = false;
                if($_FILES["mfimage3"]["error"] > 0 && !empty($_FILES["mfimage3"]["name"]))
                        $valid['im3'] = false;
-               if(!empty($_FILES["mfimage1"]["name"]))
+               $filename = $_FILES["mfimage1"]["name"];
+               if(!empty($filename))
                {
-                       $ext = strtolower(MFGetExt(stripslashes($_FILES["mfimage1"]["name"])));
-                       if($ext != "jpg" && $ext != "jpeg" && $ext != "bmp" && $ext != "png" && $ext != "gif")
-                               $valid['im1'] = false;
+                 $filetype = wp_check_filetype($filename);
+                 $filetype = strtolower($filetype['type']);
+                 if (((strpos($filetype,'image') === false) && (strpos($options['forum_allow_uploads'], 'image') !== false)) ||
+                     (!$filetype))
+                   $valid['im1'] = 2;
                }
                else
-                       $valid['im1'] = false;
-               if(!empty($_FILES["mfimage2"]["name"]))
+                 $valid['im1'] = false;
+               $filename = $_FILES["mfimage2"]["name"];
+               if(!empty($filename))
                {
-                       $ext = strtolower(MFGetExt(stripslashes($_FILES["mfimage2"]["name"])));
-                       if($ext != "jpg" && $ext != "jpeg" && $ext != "bmp" && $ext != "png" && $ext != "gif")
-                               $valid['im2'] = false;
+                 $filetype = wp_check_filetype($filename);
+                 $filetype = strtolower($filetype['type']);
+                 if (((strpos($filetype,'image') === false) && (strpos($options['forum_allow_uploads'], 'image') !== false)) ||
+                     (!$filetype))
+                   $valid['im2'] = 2;
                }
                else
-                       $valid['im2'] = false;
-               if(!empty($_FILES["mfimage3"]["name"]))
+                 $valid['im2'] = false;
+               $filename = $_FILES["mfimage3"]["name"];
+               if(!empty($filename))
                {
-                       $ext = strtolower(MFGetExt(stripslashes($_FILES["mfimage3"]["name"])));
-                       if($ext != "jpg" && $ext != "jpeg" && $ext != "bmp" && $ext != "png" && $ext != "gif")
-                               $valid['im2'] = false;
+                 $filetype = wp_check_filetype($filename);
+                 $filetype = strtolower($filetype['type']);
+                 if (((strpos($filetype,'image') === false) && (strpos($options['forum_allow_uploads'], 'image') !== false)) ||
+                     (!$filetype))
+                   $valid['im3'] = 2;
                }
                else
-                       $valid['im3'] = false;
+                 $valid['im3'] = false;
                return $valid;
        }

@@ -123,6 +143,7 @@ if(is_numeric($the_forum_id))
                $subject = str_replace($myReplaceSub, "", $mingleforum->input_filter($_POST['add_topic_subject']));
                $content = $mingleforum->input_filter($_POST['message']);
                $forum_id = $mingleforum->check_parms($_POST['add_topic_forumid']);
+               $images = mf_check_uploaded_images();

                if($subject == ""){
                        $msg .= "<h2>".__("An error occured", "mingleforum")."</h2>";
@@ -130,10 +151,31 @@ if(is_numeric($the_forum_id))
                        $error = true;
                }
                elseif($content == ""){
-                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
+                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
                        $msg .=  ("<div id='error'><p>".__("You must enter a message", "mingleforum")."</p></div>");
                        $error = true;
                }
+               elseif($images['im1'] == 2){
+                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
+                       $msg .=  ("<div id='error'><p>".__("File ", "mingleforum"));
+                       $msg .= stripslashes($_FILES["mfimage1"]["name"]);
+                       $msg .=  (__(" does not meet security guidelines", "mingleforum")."</p></div>");
+                       $error = true;
+               }
+               elseif($images['im2'] == 2){
+                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
+                       $msg .=  ("<div id='error'><p>".__("File ", "mingleforum"));
+                       $msg .= stripslashes($_FILES["mfimage2"]["name"]);
+                       $msg .=  (__(" does not meet security guidelines", "mingleforum")."</p></div>");
+                       $error = true;
+               }
+               elseif($images['im3'] == 2){
+                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
+                       $msg .=  ("<div id='error'><p>".__("File ", "mingleforum"));
+                       $msg .= stripslashes($_FILES["mfimage3"]["name"]);
+                       $msg .=  (__(" does not meet security guidelines", "mingleforum")."</p></div>");
+                       $error = true;
+               }
                else{
                        $date = $mingleforum->wpf_current_time_fixed('mysql', 0);

@@ -155,15 +197,14 @@ if(is_numeric($the_forum_id))
                        //End add to mingle board

                        //MAYBE ATTACH IMAGES
-                       $images = mf_check_uploaded_images();
                        if($images['im1'] || $images['im2'] || $images['im3'])
                        {
                                if($images['im1'])
-                                       $content .= MFAttachImage($_FILES["mfimage1"]["tmp_name"], stripslashes($_FILES["mfimage1"]["name"]));
+                                       $content .= MFAttachFile($_FILES["mfimage1"]["tmp_name"], stripslashes($_FILES["mfimage1"]["name"]));
                                if($images['im2'])
-                                       $content .= MFAttachImage($_FILES["mfimage2"]["tmp_name"], stripslashes($_FILES["mfimage2"]["name"]));
+                                       $content .= MFAttachFile($_FILES["mfimage2"]["tmp_name"], stripslashes($_FILES["mfimage2"]["name"]));
                                if($images['im3'])
-                                       $content .= MFAttachImage($_FILES["mfimage3"]["tmp_name"], stripslashes($_FILES["mfimage3"]["name"]));
+                                       $content .= MFAttachFile($_FILES["mfimage3"]["tmp_name"], stripslashes($_FILES["mfimage3"]["name"]));
                        }

                        $sql_post = "INSERT INTO $mingleforum->t_posts
@@ -180,7 +221,8 @@ if(is_numeric($the_forum_id))
                        //END UPDATE PROPER Mngl ID
                }
                if(!$error){
-                       $mingleforum->notify_forum_subscribers($id, $subject, $content, $date, $forum_id);
+                       $mingleforum->add_thread_subscribers($id, $forum_id);
+                               $mingleforum->notify_forum_subscribers($id, $subject, $content, $date, $forum_id);
                        $mingleforum->notify_admins($id, $subject, $content, $date);
                        $unused = apply_filters('wpwf_add_guest_sub', $id);     //--weaver-- Maybe add a subscription
                        header("Location: ".html_entity_decode($mingleforum->get_threadlink($id)."#postid-".$new_post_id)); exit;
@@ -195,7 +237,7 @@ if(is_numeric($the_forum_id))
                $subject = str_replace($myReplaceSub, "", $mingleforum->input_filter($_POST['add_post_subject']));
                $content = $mingleforum->input_filter($_POST['message']);
                $thread = $mingleforum->check_parms($_POST['add_post_forumid']);
-
+               $images = mf_check_uploaded_images();
                //GET PROPER Mngl ID
                $MngBID = $wpdb->get_var($wpdb->prepare("SELECT mngl_id FROM $mingleforum->t_threads WHERE id = %d", $thread));
                //END GET PROPER Mngl ID
@@ -210,6 +252,27 @@ if(is_numeric($the_forum_id))
                        $msg .=  ("<div id='error'><p>".__("You must enter a message", "mingleforum")."</p></div>");
                        $error = true;
                }
+               elseif($images['im1'] == 2){
+                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
+                       $msg .=  ("<div id='error'><p>".__("File ", "mingleforum"));
+                       $msg .= stripslashes($_FILES["mfimage1"]["name"]);
+                       $msg .=  (__(" does not meet security guidelines", "mingleforum")."</p></div>");
+                       $error = true;
+               }
+               elseif($images['im2'] == 2){
+                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
+                       $msg .=  ("<div id='error'><p>".__("File ", "mingleforum"));
+                       $msg .= stripslashes($_FILES["mfimage2"]["name"]);
+                       $msg .=  (__(" does not meet security guidelines", "mingleforum")."</p></div>");
+                       $error = true;
+               }
+               elseif($images['im3'] == 2){
+                       $msg .=  "<h2>".__("An error occured", "mingleforum")."</h2>";
+                       $msg .=  ("<div id='error'><p>".__("File ", "mingleforum"));
+                       $msg .= stripslashes($_FILES["mfimage3"]["name"]);
+                       $msg .=  (__(" does not meet security guidelines", "mingleforum")."</p></div>");
+                       $error = true;
+               }
                else{
                        $date = $mingleforum->wpf_current_time_fixed('mysql', 0);
                        //Add to mingle board
@@ -223,15 +286,14 @@ if(is_numeric($the_forum_id))
                        //End add to mingle board

                        //MAYBE ATTACH IMAGES
-                       $images = mf_check_uploaded_images();
                        if($images['im1'] || $images['im2'] || $images['im3'])
                        {
                                if($images['im1'])
-                                       $content .= MFAttachImage($_FILES["mfimage1"]["tmp_name"], stripslashes($_FILES["mfimage1"]["name"]));
+                                       $content .= MFAttachFile($_FILES["mfimage1"]["tmp_name"], stripslashes($_FILES["mfimage1"]["name"]));
                                if($images['im2'])
-                                       $content .= MFAttachImage($_FILES["mfimage2"]["tmp_name"], stripslashes($_FILES["mfimage2"]["name"]));
+                                       $content .= MFAttachFile($_FILES["mfimage2"]["tmp_name"], stripslashes($_FILES["mfimage2"]["name"]));
                                if($images['im3'])
-                                       $content .= MFAttachImage($_FILES["mfimage3"]["tmp_name"], stripslashes($_FILES["mfimage3"]["name"]));
+                                       $content .= MFAttachFile($_FILES["mfimage3"]["tmp_name"], stripslashes($_FILES["mfimage3"]["name"]));
                        }

                        $sql_post = "INSERT INTO $mingleforum->t_posts
diff -rup mingle-forum.1.0.33/wpf-post.php forum-with-patches/wpf-post.php
--- mingle-forum.1.0.33/wpf-post.php    2012-01-20 17:27:15.000000000 -0600
+++ forum-with-patches/wpf-post.php     2012-03-01 00:03:17.066677699 -0600
@@ -33,11 +33,17 @@ if(($_GET['mingleforumaction'] == "postr
                        </tr>";
                                $out .= apply_filters('wpwf_form_guestinfo',''); //--weaver--
                                $out .= $this->get_captcha();
-                               if($this->options['forum_allow_image_uploads'])
+                               if(($this->options['forum_allow_uploads']) !== 'no')
                                {
                                        $out .= "
                                        <tr>
-                                               <td valign='top'>".__("Images:", "mingleforum")."</td>
+                                               <td valign='top'>";
+                                       if(($this->options['forum_allow_uploads']) !== 'image')
+                                           $out .= __("Files:", "mingleforum");
+                                         else
+                                           $out .= __("Images:", "mingleforum");
+
+                                       $out .= "</td>
                                                <td colspan='2'>
                                                        <input type='file' name='mfimage1' id='mfimage' /><br/>
                                                        <input type='file' name='mfimage2' id='mfimage' /><br/>
diff -rup mingle-forum.1.0.33/wpf-thread.php forum-with-patches/wpf-thread.php
--- mingle-forum.1.0.33/wpf-thread.php  2012-01-20 17:27:15.000000000 -0600
+++ forum-with-patches/wpf-thread.php   2012-03-01 00:04:47.812878295 -0600
@@ -23,11 +23,16 @@
                        </tr>";
                                $out .= apply_filters('wpwf_form_guestinfo',''); //--weaver--
                                $out .= $this->get_captcha();
-                               if($this->options['forum_allow_image_uploads'])
+                               if(($this->options['forum_allow_uploads']) !== 'no')
                                {
                                        $out .= "
                                        <tr>
-                                               <td valign='top'>".__("Images:", "mingleforum")."</td>
+                                               <td valign='top'>";
+                                       if(($this->options['forum_allow_uploads']) !== 'image')
+                                           $out .= __("Files:", "mingleforum");
+                                         else
+                                           $out .= __("Images:", "mingleforum");
+                                       $out .= "</td>
                                                <td colspan='2'>
                                                        <input type='file' name='mfimage1' id='mfimage' /><br/>
                                                        <input type='file' name='mfimage2' id='mfimage' /><br/>



Shrink, Track, Share, Control ... Dominate
stschulzePostNov 25 2012, 03:51 AM

Newbie
Posts: 2
Registered:
Nov 25 2012, 10:37 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

great.

i will make these changes to my installation.

but howtodo?

whyameyePostNov 25 2012, 06:41 AM

Newbie
Posts: 16
Registered:
Jan 19 2012, 06:59 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

You can apply the patch that I cut/pasted into my post. Or you can replace your mingle forum installation with this one, which has the paste applied:
http://cratel.wichita.edu/mingle-hacks.zip

stschulzePostNov 25 2012, 06:52 AM

Newbie
Posts: 2
Registered:
Nov 25 2012, 10:37 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

can i install your mingle-hacks.zip in plugins-menu?

whyameyePostNov 25 2012, 06:58 AM

Newbie
Posts: 16
Registered:
Jan 19 2012, 06:59 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

Unzip the mingle-hacks.zip file in your /wp-content/plugins folder so it replaces your current mingle-forum folder.

RadicesPostNov 26 2012, 01:56 PM

Newbie
Posts: 7
Registered:
Oct 24 2011, 08:30 PM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

Thanks nice work ..I hope it get into the production version.

fantasyteamadvicePostNov 27 2012, 05:00 PM

Newbie
Posts: 23
Registered:
Jun 22 2012, 11:50 PM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

Hey whyameye

We talked a while back, and your zip file wasn't exactly what I was looking for. I was wondering if you might have the capability of programming two simple things into mingle forums.

1 - When a user starts a thread/ comments on a thread they are autosubscribed (This is a feature common with many forums, but they are paid versions)I get a lot of new posts every week, but many times they don't come back to read the response because they aren't subscribed to the topic.

2- An area for "my posts and comments" so that when the user returns to the site, they can look at all threads they have started or posted in (another common feature in paid forums)

If you were able to do this, I would make a donation (through paypal once we verify the features both work properly) and I think you would be surprised just how many people are looking for these features (which I'm sure you could get donations through)

whyameyePostNov 27 2012, 05:13 PM

Newbie
Posts: 16
Registered:
Jan 19 2012, 06:59 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

Those are 2 excellent ideas. I'd love to do this, but I just don't have the time right now. :-( I'm not sure what the Holiday Break will look like for me...there might be an opportunity in early January.

I'm not seeing my Mingle Forum hacks as a financially lucrative area for me, but I do want to give back to the Wordpress community...

fantasyteamadvicePostNov 27 2012, 05:35 PM

Newbie
Posts: 23
Registered:
Jun 22 2012, 11:50 PM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

Ok I was thinking about going to a website and hiring a programmer to do it, but then thought of you because you seem to have knowledge of the software and how to work within wordpress specifically.

If you could let me know, since I run a fantasy sports website January would work out perfectly because there is a big lull between football and baseball seasons, and we could have plenty of time to test and implement the features

whyameyePostNov 27 2012, 05:46 PM

Newbie
Posts: 16
Registered:
Jan 19 2012, 06:59 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

You might get some quotes on hiring a programmer. I'm actually *not* a php/mySQL programmer but (like you) I really needed some features in a free Wordpress forum and I couldn't find them, so I hacked at it myself...

I would be nervous making a commitment to get this done for you, given my time constraints, so it might be good to see if a programmer would be affordable.

fantasyteamadvicePostNov 27 2012, 05:49 PM

Newbie
Posts: 23
Registered:
Jun 22 2012, 11:50 PM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

will do thanks for the heads up

BTW I'm assuming these forums here are Mingle... and they seem to have autosubscribe on when I posted here?

whyameyePostNov 27 2012, 05:54 PM

Newbie
Posts: 16
Registered:
Jan 19 2012, 06:59 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

I don't know anything about the mingle install that is here. I assume it is the out-of-the-box latest version? I didn't notice auto-subscribe here...

fantasyteamadvicePostNov 27 2012, 05:59 PM

Newbie
Posts: 23
Registered:
Jun 22 2012, 11:50 PM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

Well I never hit subscribe, and every time you comment it is sending me an email telling me there was a response, which is really all I need for my site lol

When I look up top, it still gives me the option to subscribe...

uddmanPostDec 30 2012, 02:28 AM

Newbie
Posts: 1
Registered:
Dec 30 2012, 08:36 AM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

Hi!
The feature to allow uploads of other file types than images is very important to my client so I was glad to find this hack. I've installed it on a back-up version of my clients site but it is not working. I get this error message twice and when I try the link to the file it does not work. It seams the file is never uploaded.

Warning: in_array() expects parameter 2 to be array, string given in /home/d39822/tema6.grafprojektet.se/wp-content/plugins/mingle-forum/wpf.class.php on line 2265

You can try for yourself here: http://www.tema6.grafprojektet.se/forum/?mingleforumaction=viewforum&f=1.0

I'd be willing to pay for your support to solve this if you tell me the cost in advance.

Best regards
Jonas

cartpaujPostFeb 07 2013, 01:40 PM

Administrator
Posts: 2976
Registered:
Apr 27 2010, 05:10 PM
Hot topicRe: auto-subscribe-to-replies, forum attachment handling, allow non-administrators to edit forum structure

whyameye,
Somehow I completely missed this thread. Looks like some great stuff. I'll be emailing you in a bit.

Cartpauj...it's pronounced (cart.paw.ja) - Donate!
Mingle Forum Video Tutorials

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.436 seconds.


Shrink, Track, Share, Control ... Dominate