• Resolved batters22

    (@batters22)


    Posting an issue with a solution here s others appear to be having the same issue. For me this manifested as the Media Library not displaying at all. As others have pointed put, this is due to deprecated javascript in wp-jv-post-reading-groups.min.js.

    If you’re interested, this code uses the deprecated jQuery function .live(). This can be fixed by replacing with .on() throughout. My (now working) code below for reference. Copy this into your version of wp-jv-post-reading-groups.min.js

    // Scripts for WP JV Post Reading Groups
    // @version: 2.3
    //// updated by Simon Battersby 07/10/2020 to remove deprecated calls to .live()/
    
    jQuery(document).ready(function($){
    	/************************************************************************************************************/
    	/* Refresh WP_JV_PRG_List_Table whenever a change occur */
    	/************************************************************************************************************/
    	function wp_jv_prg_refresh_rg_list() {
    
    		data = {
    				action		: 'wp_jv_prg_refresh_rg_list',
    				url			: ajaxurl,
    				type		: 'POST'
    			};
    		$.post(ajaxurl, data, function(response){
    			// WP_JV_PRG_List_Table::ajax_response() returns json
    			var response = $.parseJSON( response );
    
    			// Add the requested rows
    			if ( response.rows.length )
    			$('#the-list').html( response.rows );
    		});
    	};
    
    	/************************************************************************************************************/
    	/* Add new RG */
    	/************************************************************************************************************/
        $('#btnAddNewRG').click(function(){
    		//Disable button and show loading icon
    		$('#btnAddNewRG').attr('disabled', true);
    		$('#spnAddRG').show();
    
    		var newrg = document.getElementById("jv-new-reading-group-text").value;
    
    		//Save new Reading Group to database
    		data = {
    				action			: 'wp_jv_prg_add_new_rg_to_db',
                    url				: ajaxurl,
                    type			: 'POST',
                    dataType		: 'text',
                    'newrg' 		: newrg,
    				wp_jv_rg_nonce	: wp_jv_prg_obj.wp_jv_rg_nonce
                };
    
    		$.post(ajaxurl, data, function(response){
    			if (response.error) {
    				alert(response.error_msg+'\n\n[Error: '+response.error_code+']');
    				//to debug uncomment the following line
    				//alert('Action: '+response.action+'\nNewRGName: '+ response.newRG);
    			}
    			else {
    				//to debug uncomment the following line
    				//alert('Action: '+response.action+'\nNewRGName: '+ response.newRG);
    
    				//If saving was successful then refresh WP_JV_PRG_List_Table
    				wp_jv_prg_refresh_rg_list();
    			}
    			//Disable loading icon and enable button
    			$('#spnAddRG').hide();
    			$('#btnAddNewRG').attr('disabled', false);
    			document.getElementById("jv-new-reading-group-text").value = '';
    		});
    	});
    
    	/************************************************************************************************************/
    	/* Edit RG */
    	/************************************************************************************************************/
    	$('.lnkEdit').on('click',function(event){
    		event.preventDefault();
    
    		//Clean up any other open Edit input - no save
    		$.ajaxSetup({async:false});
    		wp_jv_prg_refresh_rg_list();
    		$.ajaxSetup({async:true});
    
    		//Find out which RG we need to edit
    		var editRG = $(this).attr('data-RG');
    
    		//Display an edit "form"
    		$('.RenameDiv-'+editRG).html('<input type="text" id="renamed-reading-group-text" style="width:100%" value="'+$('div.ItemDiv-'+editRG).text()+'">'+
    		'<br><button class="btnCancel button-secondary">Cancel</button>'+
    		'<button style="float:right" class="btnSave button-primary" data-rename-RG="'+editRG+'">Save</button>'
    		);
    	});
    
    	//Edit RG - Cancel button pressed
    	$('.btnCancel').on('click',function(event){
    		event.preventDefault();
    		wp_jv_prg_refresh_rg_list();
    	});
    
    	//Edit RG - Save button pressed
    	$('.btnSave').on('click',function(event){
    		event.preventDefault();
    
    		//disable button
    		$('.btnSave').attr('disabled', true);
    
    		var NewRGName = document.getElementById("renamed-reading-group-text").value;
    		var RGToRename = $(this).attr('data-rename-RG');
    
    		//Save new Reading Group to database
    		data = {
                    action			: 'wp_jv_prg_save_renamed_rg_to_db',
                    url				: ajaxurl,
                    type			: 'POST',
                    dataType		: 'text',
    				'RGToRename'	: RGToRename,
                    'NewRGName' 	: NewRGName
                };
    
    		$.post(ajaxurl, data, function(response){
    			if (response.error) {
    				alert(response.error_msg+'\n\n[Error: '+response.error_code+']');
    				//to debug uncomment the following line
    				//alert('Action: '+response.action+'\nRGToRename: '+ response.RGToRename+'\nNewRGName: '+ response.NewRGName);
    			}
    			else {
    				//to debug uncomment the following line
    				//alert('Action: '+response.action+'\nRGToRename: '+ response.RGToRename+'\nNewRGName: '+ response.NewRGName);
    
    				//If saving was successful then refresh WP_JV_PRG_List_Table
    				wp_jv_prg_refresh_rg_list();
    			}
    		});
    		//enable button
    		$('.btnSave').attr('disabled', false);
    	});
    
    	/************************************************************************************************************/
    	/* Delete RG */
    	/************************************************************************************************************/
    	$('.lnkDelete').on('click',function(event){
    		event.preventDefault();
    		var delurl = jQuery(this).attr('href');
    		data = {
    				action 		: 'wp_jv_prg_delete_rg',
    				url			: ajaxurl,
    				type		: 'POST',
    				'delurl'	: delurl
    			   };
    		$.post(ajaxurl, data, function(response){
    			if ( response.error ) {
    				alert(response.error_msg+'\n\n[Error: '+response.error_code+']');
    				//to debug uncomment the following line
    				//alert('Action: '+response.action+'\nItem: '+ response.rg+'\njv_prg_nonce: '+response.jv_prg_nonce);
    			}
    			else {
    			    //to debug uncomment the following line
    				//alert('Action: '+response.action+'\nItem: '+ response.rg+'\njv_prg_nonce: '+response.jv_prg_nonce);
    
    				//If saving was successful then refresh WP_JV_PRG_List_Table
    				wp_jv_prg_refresh_rg_list();
    				}
    
    		});
    	});
    
    });
    • This topic was modified 4 years, 1 month ago by batters22.
Viewing 3 replies - 1 through 3 (of 3 total)
  • albardian

    (@albardian)

    Hello, I use version 5.5.3 of wordpress and the plugin does not work for me, I already made the change you indicate but it still does not work, specifically it does not allow me to delete a created group and it does not show me the passwords to assign a custom one. What problem can there be? I hope you can help me. Thank you.

    Thread Starter batters22

    (@batters22)

    I don’t get that problem, but I have in any case abandoned this plugin in favour of the Groups plugin which does something very similar.

    Plugin Author Janos Ver

    (@janosver)

    The new version (v2.4) of the plugin which was released today should help resolving this issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Compatibility issues’ is closed to new replies.