WordPress.org

Support

Support » Plugins and Hacks » Oscar update small conflict

Oscar update small conflict

  • Hey there- today just updated a few of my WP sites to Oscar.. and the same problem occurred in many plugins.

    the has_shortcode() in the functions.php conflict, so if it gets commented out to avoid the fatal error i get the site visible again but with this error:

    Warning: Missing argument 2 for has_shortcode(), called in /wp-content/plugins/wp-user-frontend-reloaded/wpuf.php on line 130 and defined in /wp-includes/shortcodes.php on line 153

    Need a lil help with this plugin to properly resolve .

    http://wordpress.org/plugins/wp-user-frontend-reloaded/

Viewing 10 replies - 1 through 10 (of 10 total)
  • with wp 3.6
    wp-content/plugins/wp-user-frontend-reloaded/wpuf.php line 130

    Change

    if ( has_shortcode( 'wpuf_addpost' ) || has_shortcode(

    into

    if ( has_shortcode( $content, 'wpuf_addpost' ) || has_shortcode( $content, 'wpuf_edit' ) ) {

    Thats all 🙂

    The existing bit looks like this before I commented it all out:

    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;
    }

    Thats is from the functions.php of wp fronted reloaded line 430, not the same as wpuf.php warning line 130

    And better to keep it safe by using

    if (!function_exists('has_shortcode')) {
            function has_shortcode( $shortcode = '', $post_id = false ) {
            //rest of original function code
            }
    }

    Oohhhhh i see now — was actually looking at wpuf-functions.php.

    Madethe edit you suggested and things are back to normal -THANK YOU : )

    THANK YOU –
    The snippet i posted was from wpuf-functions.php

    I’ve edited per your suggestion on the wpuf.php and things are running smoothly again.
    DID have to leave the has_shortcode chunk in the wpuf-funcitons.php commented out though. Otherwise the fatal error would still be unresolved.

    I’m having a similar issue and I have very little experience with WordPress. My site currently has a message that reads

    Warning: Missing argument 2 for has_shortcode(), called in /home/content/80/10865380/html/wp-content/themes/eprom_1_1_0/framework/scripts/scripts.php on line 110 and defined in /home/content/80/10865380/html/wp-includes/shortcodes.php on line 153

    Any ideas on how to fix this? Mind you I have very little understanding of how to access the front end and make changes. Any and all help is greatly appreciated.

    The author does not look at this

    The author does not provide technical support

    Vote negative in the review of pluggin

    http://wordpress.org/support/view/plugin-reviews/wp-user-frontend-reloaded?rate=1#postform

    WPyogi

    @wpyogi

    Forum Moderator

    @marcelo Mika – sorry, but this kind of posting isn’t okay here – you’re welcome to post your own review, but posting in multiple old threads “recruting” others isn’t right. Please stop.

    ok, no problem.

    April Holle

    @aprilholle

    Here are the details on proper usage of “has_shortcode”, looks like older versions didn’t need to specify where the shortcode would be, now you do.

    https://codex.wordpress.org/Function_Reference/has_shortcode

    @wkreiser I’m also using Eprom for a website, here’s the fix you’ll need.

    /themes/eprom_1_1_0/framework/scripts/scripts.php old line 118:

    /* Contact form */
    		if (has_shortcode('contact_form')) {
    			wp_localize_script('custom', 'ajax_action', array('ajaxurl' => admin_url('admin-ajax.php'), 'ajax_nonce' => wp_create_nonce('ajax-nonce')));
    		}

    Line 118 Fixed:

    /* Contact form */
    		if (has_shortcode(<strong> $content, </strong>'contact_form')) {
    			wp_localize_script('custom', 'ajax_action', array('ajaxurl' => admin_url('admin-ajax.php'), 'ajax_nonce' => wp_create_nonce('ajax-nonce')));
    		}

    Functioning fine now. 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Oscar update small conflict’ is closed to new replies.