WordPress.org

Ready to get started?Download WordPress

Forums

WP User Frontend - Reloaded
Oscar update small conflict (11 posts)

  1. bitofgrace
    Member
    Posted 1 year ago #

    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/

  2. mgrmn
    Member
    Posted 1 year ago #

    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 :)

  3. bitofgrace
    Member
    Posted 1 year ago #

    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;
    }
  4. mgrmn
    Member
    Posted 1 year ago #

    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
            }
    }
  5. bitofgrace
    Member
    Posted 1 year ago #

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

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

  6. bitofgrace
    Member
    Posted 1 year ago #

    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.

  7. wkreiser
    Member
    Posted 1 year ago #

    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.

  8. Marcelo Mika
    Member
    Posted 1 year ago #

    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

  9. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    @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.

  10. Marcelo Mika
    Member
    Posted 1 year ago #

    ok, no problem.

  11. April Holle
    Member
    Posted 11 months ago #

    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. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic