Title: Improvements: fixed many bugs
Last modified: August 21, 2016

---

# Improvements: fixed many bugs

 *  [leoloso](https://wordpress.org/support/users/leoloso/)
 * (@leoloso)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/)
 * Hi, thanks for the great plugin!
 * I use version 1.1 and there were few bugs that I have fixed. I share here all
   the files with changes:
 * [https://drive.google.com/folderview?id=0By_eYMNOB66pZUtaNHhwajB3NW8&usp=sharing](https://drive.google.com/folderview?id=0By_eYMNOB66pZUtaNHhwajB3NW8&usp=sharing)
 * Before each change, there’s a comment where I explain what the bug is:
    // Hack
   GreenDrinks
 * In some cases, it is not a bug fix but rather a customization that I need for
   my website. For instance: in the Dashboard, I also show a column Category, showing
   the Category the post belongs to. So instead of hardcoding this stuff (not everyone
   needs it), there could be a hook there so that users can implement their own 
   customization.
 * I hope all these bug fixes and improvements can be implemented back in your plugin
 * Thanks,
    Leo
 * [http://wordpress.org/extend/plugins/wp-user-frontend/](http://wordpress.org/extend/plugins/wp-user-frontend/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [professor99](https://wordpress.org/support/users/professor99/)
 * (@professor99)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/#post-3766295)
 * Hi Leoloso,
 * Big thanks for your effort in posting this and adding comments that make it easy
   to see what you did.
 * I will closely examine these in the next few days and see what I can incorporate
   in the development version.
 * Have you tried the [development](http://wordpress.org/support/topic/frontend-updates-2rrr-fork/page/4?replies=135)
   version yet? It’s a big improvement on Version 1.1.
 * Cheers
    TheProfessor
 *  Thread Starter [leoloso](https://wordpress.org/support/users/leoloso/)
 * (@leoloso)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/#post-3766315)
 * Hi professor,
 * nops, unluckily I did these changes on version 1.1, so you’ll have to merge them
   back with version 1.2. However, if you have any doubt of what I did, please ask
   me, I’ll be happy to tell you what the problem was so you can fix it again
 * Cheers,
    Leo
 *  Thread Starter [leoloso](https://wordpress.org/support/users/leoloso/)
 * (@leoloso)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/#post-3766410)
 * Hi, I found another problem:
 * in function enqueue_scripts(), in wpuf.php, I changed from:
 *     ```
       if ( has_shortcode( 'wpuf_addpost' ) || has_shortcode( 'wpuf_edit' ) ) {
       	wp_enqueue_script( 'plupload-handlers' );
       }
       ```
   
 * to
 *     ```
       if (( has_shortcode( 'wpuf_addpost' ) || has_shortcode( 'wpuf_edit' )) && is_user_logged_in()) {
       	wp_enqueue_script( 'plupload-handlers' );
       }
       ```
   
 * because if the user is not logged in, in the page to create (or edit) the post,
   plupload creates a javascript error:
 *     ```
       Timestamp: 5/6/13 7:23:59 PM
       Error: TypeError: o is null
       Source File: http://localhost/wp-includes/js/plupload/plupload.js?ver=1.5.5
       Line: 2
       ```
   
 * so then if the user is not logged in, now I don’t load that library anymore, 
   no more problem
 *  [Ciprian Popescu](https://wordpress.org/support/users/butterflymedia/)
 * (@butterflymedia)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/#post-3766412)
 * I’m using WordPress 3.6-beta3 and I get this error:
 * `<strong>Fatal error:</strong> Cannot redeclare has_shortcode() (previously declared
   in \wp-includes\shortcodes.php:153) in \wp-content\plugins\wp-user-frontend\wpuf-
   functions.php on line 451`
 * I tried to wrap the has_shortcode() in a function_exist() condition, but unfortunately,
   this functions is not used like the one in WordPress, so I get more warnings 
   in the frontend.
 * I think I should either rename has_shortcode() to something else, or refactor
   it to be used just like the WordPress one.
 *  [Ciprian Popescu](https://wordpress.org/support/users/butterflymedia/)
 * (@butterflymedia)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/#post-3766413)
 * **WP User Frontend 1.2 has_shortcode() function:**
 *     ```
       /**
        * check the current post for the existence of a short code
        *
        * @link http://wp.tutsplus.com/articles/quick-tip-improving-shortcodes-with-the-has_shortcode-function/
        * @param string $shortcode
        * @return boolean
        */
       function has_shortcode( $shortcode = '', $post_id = false ) {
           global $post;
   
           if ( !$post ) {
               return false;
           }
   
           $post_to_check = ( $post_id == false ) ? get_post( get_the_ID() ) : get_post( $post_id );
   
           if ( !$post_to_check ) {
               return false;
           }
   
           // false because we have to search through the post content first
           $found = false;
   
           // if no short code was provided, return false
           if ( !$shortcode ) {
               return $found;
           }
   
           // check the post content for the short code
           if ( stripos( $post_to_check->post_content, '[' . $shortcode ) !== false ) {
               // we have found the short code
               $found = true;
           }
   
           return $found;
       }
       ```
   
 * **WordPress 3.6-beta has_shortcode() function:**
 *     ```
       /**
        * Whether the passed content contains the specified shortcode
        *
        * <strong>@since 3.6.0</strong>
        *
        * @global array $shortcode_tags
        * @param string $tag
        * @return boolean
        */
       function has_shortcode( $content, $tag ) {
       	if ( shortcode_exists( $tag ) ) {
       		preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
       		if ( empty( $matches ) )
       			return false;
   
       		foreach ( $matches as $shortcode ) {
       			if ( $tag === $shortcode[2] )
       				return true;
       		}
       	}
       	return false;
       }
       ```
   
 * Notice the **[@since](https://wordpress.org/support/users/since/) 3.6.0** bit,
   so the plugin should be updated soon, as the WordPress 3.6 update will break 
   hundreds of sites.
 *  Plugin Author [Tareq Hasan](https://wordpress.org/support/users/tareq1988/)
 * (@tareq1988)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/#post-3766418)
 * I’ve removed the `has_shortcode()` function on 1.2.2 and fixed the performance
   as it was slower when the number of users increases.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Improvements: fixed many bugs’ is closed to new replies.

 * ![](https://ps.w.org/wp-user-frontend/assets/icon-256x256.gif?rev=3578622)
 * [User Frontend – Membership, User Registration, User Profile, User Directory & Content Restriction with Frontend Post Submission](https://wordpress.org/plugins/wp-user-frontend/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-user-frontend/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-user-frontend/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-user-frontend/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-user-frontend/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-user-frontend/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [Tareq Hasan](https://wordpress.org/support/users/tareq1988/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/improvements-fixed-many-bugs/#post-3766418)
 * Status: not resolved