Support » Plugin: Theme My Login » Solving WP Media Upload in the frontend and TML

  • alfonsosiloniz

    (@alfonsosiloniz)


    Hi all

    I have written Jeff regarding this. But for all of you to know a solution to a problem with WP 3.6 and TML

    I am using the standard WP Media uploader in the frontend of a web service. The problem occurs when you try to use it and you have themed-profiles module active and restricting access to dashboard to users. The main reason for this to fail is that media uploader use async-upload.php that is located under wp-admin. So it is automatically redirected by themed-profiles module

    To solve it, you need to modify the themed-profiles.php file under modules/

    Line 124:

    if ( $this->get_option( array( $user_role, 'restrict_admin' ) ) ) {
    					if ( ! defined( 'DOING_AJAX' ) ) {
    						wp_redirect( $redirect_to );
    						exit;
    					}
    				}

    Change this to

    if ( $this->get_option( array( $user_role, 'restrict_admin' ) ) ) {
    				        	// Several pages must be took in account
            	// to permit ajax and media uploads
    
            	$valid_pages = array('admin-ajax.php', 'async-upload.php', 'media-upload.php');
            if (!in_array( $pagenow, $valid_pages ) ) {
    
    					if ( ! defined( 'DOING_AJAX' ) ) {
    						wp_redirect( $redirect_to );
    						exit;
    					}
            }
    
    				}

    Best Regards

    http://wordpress.org/plugins/theme-my-login/

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Solving WP Media Upload in the frontend and TML’ is closed to new replies.