• Resolved Conspried Minds

    (@conspriedminds)


    Hello,
    The plugin works great in the admin panel but when it’s pulled to the front end the “Edit Image” button does nothing.

    In the admin screen the button pulls down the Media Library which allows users to edit/upload images without issue.

    I’m using WP User Frontend — Which has a user profile edit page.
    The edit link does nothing when clicked.

    Please help!

    https://www.ads-software.com/plugins/wp-user-avatar/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter Conspried Minds

    (@conspriedminds)

    SOLVED.

    If anyone else is experiencing this issue this is how i solved it:

    WP User Frontend calls for some specific styles and and scripts whenever shortcodes are used.

    I disabled the entire script and the plugin works fine now.

    I’ve attached the code block below that causes the issue. It can be found within the wpuf.php file (/wp-content/plugins/wp-user-frontend/wpuf.php).

    /**
         * Enqueues Styles and Scripts when the shortcodes are used only
         *
         * @uses has_shortcode()
         * @since 0.2
         */
        function enqueue_scripts() {
            $path = plugins_url('', __FILE__ );
    
            //for multisite upload limit filter
            if ( is_multisite() ) {
                require_once ABSPATH . '/wp-admin/includes/ms.php';
            }
    
            require_once ABSPATH . '/wp-admin/includes/template.php';
    
            wp_enqueue_style( 'wpuf', $path . '/css/wpuf.css' );
    
            if ( wpuf_has_shortcode( 'wpuf_addpost' ) || wpuf_has_shortcode( 'wpuf_edit' ) ) {
                wp_enqueue_script( 'plupload-handlers' );
            }
    
            wp_enqueue_script( 'wpuf', $path . '/js/wpuf.js', array('jquery') );
    
            $posting_msg = wpuf_get_option( 'updating_label', 'wpuf_labels' );
            $feat_img_enabled = ( wpuf_get_option( 'enable_featured_image', 'wpuf_frontend_posting' ) == 'yes') ? true : false;
            wp_localize_script( 'wpuf', 'wpuf', array(
                'ajaxurl' => admin_url( 'admin-ajax.php' ),
                'postingMsg' => $posting_msg,
                'confirmMsg' => __( 'Are you sure?', 'wpuf' ),
                'nonce' => wp_create_nonce( 'wpuf_nonce' ),
                'featEnabled' => $feat_img_enabled,
                'plupload' => array(
                    'runtimes' => 'html5,silverlight,flash,html4',
                    'browse_button' => 'wpuf-ft-upload-pickfiles',
                    'container' => 'wpuf-ft-upload-container',
                    'file_data_name' => 'wpuf_featured_img',
                    'max_file_size' => wp_max_upload_size() . 'b',
                    'url' => admin_url( 'admin-ajax.php' ) . '?action=wpuf_featured_img&nonce=' . wp_create_nonce( 'wpuf_featured_img' ),
                    'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
                    'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
                    'filters' => array(array('title' => __( 'Allowed Files' ), 'extensions' => '*')),
                    'multipart' => true,
                    'urlstream_upload' => true,
                )
            ) );
        }

    The downside to this is that i have to now style the page content for the pages that use WPUF shortcodes.

    Perhaps this was an isolated issue that occured when using WPUF with my current theme (remal, by tie labs).

    Nevertheless i hope this helps others that might face a similar issue.

    Hi,

    I have the same exact issue using WP User Avatar with WP User Frontend as well.

    May I ask how do I disable the entire script above? Just delete it from the file? Sorry, I’m non technical.

    Thanks in advance.

    Thread Starter Conspried Minds

    (@conspriedminds)

    @susansalleh deleting it from the file will work but it’d be best to leave it there just in case you need to revert back to the original in the future.

    You can disable it by “commenting it out”

    /* ANY CODE BETWEEN THESE TWO SLASHES WILL BE REGISTERED AS A COMMENT, NOT A CODE */

    So simply place /* Before the code and */ after the code.

    In this case before “function” and after the final bracket.

    You can just copy and paste the code below in place of what’s currently there.

    *NOTE: It removes the styles from the pages that use shortcodes. You’ll have to edit your theme css to style the elements how you want them.

    /**
         * Enqueues Styles and Scripts when the shortcodes are used only
         *
         * @uses has_shortcode()
         * @since 0.2
         */
       /*  function enqueue_scripts() {
            $path = plugins_url('', __FILE__ );
    
            //for multisite upload limit filter
            if ( is_multisite() ) {
                require_once ABSPATH . '/wp-admin/includes/ms.php';
            }
    
            require_once ABSPATH . '/wp-admin/includes/template.php';
    
            wp_enqueue_style( 'wpuf', $path . '/css/wpuf.css' );
    
            if ( wpuf_has_shortcode( 'wpuf_addpost' ) || wpuf_has_shortcode( 'wpuf_edit' ) ) {
                wp_enqueue_script( 'plupload-handlers' );
            }
    
            wp_enqueue_script( 'wpuf', $path . '/js/wpuf.js', array('jquery') );
    
            $posting_msg = wpuf_get_option( 'updating_label', 'wpuf_labels' );
            $feat_img_enabled = ( wpuf_get_option( 'enable_featured_image', 'wpuf_frontend_posting' ) == 'yes') ? true : false;
            wp_localize_script( 'wpuf', 'wpuf', array(
                'ajaxurl' => admin_url( 'admin-ajax.php' ),
                'postingMsg' => $posting_msg,
                'confirmMsg' => __( 'Are you sure?', 'wpuf' ),
                'nonce' => wp_create_nonce( 'wpuf_nonce' ),
                'featEnabled' => $feat_img_enabled,
                'plupload' => array(
                    'runtimes' => 'html5,silverlight,flash,html4',
                    'browse_button' => 'wpuf-ft-upload-pickfiles',
                    'container' => 'wpuf-ft-upload-container',
                    'file_data_name' => 'wpuf_featured_img',
                    'max_file_size' => wp_max_upload_size() . 'b',
                    'url' => admin_url( 'admin-ajax.php' ) . '?action=wpuf_featured_img&nonce=' . wp_create_nonce( 'wpuf_featured_img' ),
                    'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
                    'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
                    'filters' => array(array('title' => __( 'Allowed Files' ), 'extensions' => '*')),
                    'multipart' => true,
                    'urlstream_upload' => true,
                )
            ) );
        } */

    Hope this helps,
    Best,
    Chris

    Hi Chris,

    Thanks for the reply.

    Unfortunately this didn’t work for me. I still have the same problem with the Edit Image button not working.

    I will have to post a new thread on this.

    Thanks again.
    Susan

    Thread Starter Conspried Minds

    (@conspriedminds)

    This was not a solution // since deleting this bit of coding also disabled the “upload featured image” from the WPUF.

    Still looking for a solution.

    @conspriedminds – I believe you sent me a private message and I responded, but didn’t hear back from you again. I’m not an advocate of editing other plugins as you’ve done. Let me know more details of your site: what it is, what other plugins you have active, what theme you’re using, etc. and I’ll try my best to help you.

    Thread Starter Conspried Minds

    (@conspriedminds)

    Hey, thanks for getting back to me.
    Your help is greatly appreciated.

    The website: clutchpop.com
    Theme: Remal Theme
    Active Plugins:
    WP User Avatar (Disabled now since it’s not working well with the theme)
    WP User Frontend
    Stop Spammer Registrations Plugin
    Instagrate to WordPress

    Thanks again for your help, please let me know if you need anything else.

    I registered on your site as “wpuseravatar” (you can remove this account later if you wish) and came across this JavaScript error:

    Uncaught TypeError: Cannot read property 'currentStyle' of null

    for this file:

    https://clutchpop.com/wp-includes/js/plupload/plupload.js?ver=1.5.7

    I have come across this problem before, but did not look into fixing the problem because it’s an issue with WP User Frontend, not my plugin. However, I did more testing and found if you have “Allow attachments” enabled in your WP User Frontend settings, that causes the error. Do you have that setting enabled?

    After further investigation, I found this on line 862 in wpuf-functions.php that is currently:

    if ( stripos( $post_to_check->post_content, '[' . $shortcode ) !== false ) {

    And I believe it should be changed to:

    if ( stripos( $post_to_check->post_content, '[' . $shortcode . ']' ) !== false ) {

    That made the error go away for me. I have sent an e-mail to the developer of WP User Frontend.

    Thread Starter Conspried Minds

    (@conspriedminds)

    Thanks again for your help. It’s truly appreciated.

    Attachments were disabled since i first started using the plugin.

    I also tried the fix stated above on line 862 and still no luck — the problem still remains.

    I wrote a detailed description of the issue on the WPUF support forum. — Maybe the info there can help out a bit.

    *wpuseravatar has been granted admin rights.

    Am i the only one experiencing this issue?
    Are there instances where WPUF and WPUA work seamlessly?
    Maybe it’s just not playing well with the Remal theme?

    Thread Starter Conspried Minds

    (@conspriedminds)

    Still trying to narrow down the source of the issue.

    wpuf.js line 14 — When this is removed your plugin works fine. (but again the featured image uploader on the add post page is broken)

    That calls for the function on line 88 ” featImgUploader”

    I’m still pretty clueless but this might be the function that is causing the conflict.

    Again, thanks for your help on this.

    Do you have “Featured Image upload” enabled? If you do, does disabling that work?

    After looking at the JavaScript for WP User Frontend, the problem seems to be is that it is trying to initialize the featImgUploader function on an element that doesn’t exist on the page, because it should only be on the post editing pages. I made a couple of other changes.

    wpuf.php line 136:

    From:

    $feat_img_enabled = ( wpuf_get_option( 'enable_featured_image', 'wpuf_frontend_posting' ) == 'yes') ? true : false;

    To:

    $feat_img_enabled = ( wpuf_get_option( 'enable_featured_image', 'wpuf_frontend_posting' ) == 'yes') && (wpuf_has_shortcode( 'wpuf_addpost' ) || wpuf_has_shortcode( 'wpuf_edit' )) ? true : false;

    attachment.php line 44:

    From:

    'attachment_enabled' => ($attachment_enabled == 'yes') ? true : false,

    To:

    'attachment_enabled' => ($attachment_enabled == 'yes') && ( wpuf_has_shortcode( 'wpuf_addpost' ) || wpuf_has_shortcode( 'wpuf_edit' ) ) ? true : false,

    I can’t say for sure if this is a good idea to alter all of these lines, since I don’t know what domino effect it will have. But, changing these lines and also line 862 of wpuf-functions.php seems to work.

    Thread Starter Conspried Minds

    (@conspriedminds)

    Modifying line 136 in wpuf.php and 862 of wpuf-functions.php got the job done!

    And you’re right — We cant know what other effects these changes might have but i’ll be sure to post an update for anyone else that might be experiencing this issue.

    Thank you so much Bangbay

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Front-End Avatar Management’ is closed to new replies.