Home › Forums › Legacy Support › Support queries › Setup issues › Question about parent user addons
- This topic has 47 replies, 4 voices, and was last updated 2 years, 11 months ago by Anshuman Sahu.
-
AuthorPosts
-
April 17, 2021 at 1:50 pm #353091VeronicaModeratorThis reply has been marked as private.April 19, 2021 at 5:23 am #353232hothaibinhParticipantHi, I updated to the lastest version of the plugin, still I don't see the batch appear in the course, Please help.April 19, 2021 at 1:37 pm #353384Anshuman SahuKeymasterWell I went to check but getting frequent 403 errors : https://prnt.sc/11pbmci Seems like there is some kind of security enabled on your site . MAybe that could be the reason why pwabuilder.com is not working either for your site ? Also please change the version number of your service worker setings in vibebp -> settings -> service worker . then regenerate service worker and then again check the batches issue .Service worker cache does not updates the js files and hence old issues appear even after updating the plugins .April 21, 2021 at 4:47 pm #353789hothaibinhParticipantThis reply has been marked as private.April 22, 2021 at 2:21 pm #353996Anshuman SahuKeymasterFor the batches to appear on single course page please try adding this code in your wplms-customizer.php file in wplms customizer plugin :
while the user can see the batches in his dashboard : http://somup.com/crf32rFb94add_action('wplms_after_course_description',function(){ $id = get_the_ID(); $batches = wplms_get_course_batches($id); if(empty($batches)) return; $init=Wplms_Batches_Init::init(); $init->show_enroll_button = 1; ?> <div class="wplms_batches_wrapper block"> <ul> <?php foreach($batches as $batch_id){ $init->batch_grid_style('custom',$batch_id); } ?> </ul> </div><style>.wplms_batches_wrapper ul{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));grid-gap:1rem}.wplms_batches_wrapper .batch_snapshot{display:flex;flex-direction:row;border:1px solid var(--border);padding:.5rem;position:relative;flex-wrap:wrap;align-items: flex-start}.batch_snapshot .labels{position:absolute;top:.5rem;left:.5rem;z-index:9;background:var(--primary);color:var(--primarycolor);padding:2px 5px;border-radius:2px;display:flex;flex-wrap:wrap}.batch_snapshot .labels>span{text-transform:uppercase;font-size:11px;letter-spacing:1px}.batch_snapshot .batch_image img{border-radius:3px}.batch_image{position:relative;margin:.5rem;flex:1 0 120px}.batch_admins{position:absolute;bottom:.5rem;right:.5rem}.batch_admins img{width:32px;height:32px;border-radius:50%}.batch_content{margin:.5rem;flex:3 0 120px}</style> <?php ?><script> if(typeof localforage != 'undefined'){ localforage.getItem('bp_login_token').then(function(token){ function sendEnrollBatchRequest(batch_id){ var xh = new XMLHttpRequest(); xh.open('POST', ajaxurl); xh.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xh.onload = function() { if (xh.status === 200) { let data = JSON.parse(xh.responseText); if(typeof data == 'object' && data.status){ document.querySelectorAll('.enrol_in_batch').forEach(function(el){ el.parentNode.removeChild(el); }); var span = document.createElement('span'); span.innerHTML = "<?php _e('Enrolled','wplms-batches');?>"; document.querySelector('#batch'+batch_id+' .labels').appendChild(span); } }else if (xhr.status !== 200) { console.log('Something went wrong.Request failed.' + xhr.status); } } xh.send(encodeURI('action=enrol_in_batch&batch_id='+batch_id+'&course_id=<?php echo $id; ?>+&token=' + token)); } if(token){ var xhr = new XMLHttpRequest(); xhr.open('POST', ajaxurl); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.onload = function() { if (xhr.status === 200) { let data = JSON.parse(xhr.responseText); if(typeof data == 'object' && data.status){ if(data.enrolled && data.enrolled.length){ data.enrolled.map(function(batch_id){ var span = document.createElement('span'); span.innerHTML = "<?php _e('Enrolled','wplms-batches');?>"; document.querySelector('#batch'+batch_id+' .labels').appendChild(span); }); }else{ document.querySelectorAll('.batch_content').forEach(function(el){ var btn = document.createElement('a'); btn.innerHTML = "<?php _e('Enrol Now','wplms-batches');?>"; btn.setAttribute('class','enrol_in_batch button is-primary small'); if(data.hasOwnProperty('cart_links') && Object.keys(data.cart_links).length){ if(data.cart_links.hasOwnProperty(el.getAttribute('data-id')) && data.cart_links[el.getAttribute('data-id')].length){ btn.setAttribute('href',data.cart_links[el.getAttribute('data-id')]); } }else{ btn.addEventListener('click',function(){ btn.innerHTML='...'; document.querySelectorAll('.enrol_in_batch').forEach(function(el){ if(btn != el){ el.style.display='none'; } }); sendEnrollBatchRequest(el.getAttribute('data-id')); }); } if(el.querySelector('.enroll_now_button')){ el.querySelector('.enroll_now_button').remove(); } el.appendChild(btn); }); } } } else if (xhr.status !== 200) { console.log('Something went wrong.Request failed.' + xhr.status); } }; xhr.send(encodeURI('action=get_enrolled_batches&course_id=<?php echo $id; ?>&batches='+JSON.stringify(<?php echo json_encode($batches); ?>)+'&token=' + token) ); } }); } </script><?php });
April 23, 2021 at 7:10 am #354093hothaibinhParticipantHi thank you, now I can see the batch Regarding to your previous response that "a batch admin can take look into stats of all courses in a batch but cannot edit course as he wont be instructor" How may assign a user as a batch admin ? Is that possible if I add a group of users to a batch and assign 1 of them as a batch admin ? and how to do that ? I am aware of buy batch features, but usually our group clients pay for us via different channel and my job is to add them to a batch by myself.April 24, 2021 at 1:55 pm #354387Anshuman SahuKeymaster1. Groups are the batches groups= batches , in order to assign admin to batch simply add a member and then promote him to admin by editing the group in backend or in front end . 2 . yes you can use this process : https://wplms.io/support/knowledge-base/wplms-buy-batch-feature/May 2, 2021 at 1:45 pm #355598hothaibinhParticipant"1. Groups are the batches groups= batches , in order to assign admin to batch simply add a member and then promote him to admin by editing the group in backend or in front end" My question is how to do that ? how to promote an account to a batch admin ?May 2, 2021 at 4:57 pm #355609hothaibinhParticipantHi, I found the option in back end, where is it in front-end ?May 3, 2021 at 2:48 pm #355761Anshuman SahuKeymasteradd groups menu item in profile menu first : https://wplms.io/support/knowledge-base/adding-buddypress-menu-items-to-profile-navigation-4-0/ and then: http://somup.com/crhe2HFaHF its quite simpleMay 5, 2021 at 11:41 am #356066hothaibinhParticipantHi, in order to add a menu item to the profile menu I need to add a CSS Classes right ? what is the value for that ? Thank youMay 6, 2021 at 4:08 pm #356353Anshuman SahuKeymasterNo css classes needed just add the menu item and goto wp-admin -> vibebp -> settings -> buddypress-> refresh buddypress navigation .May 7, 2021 at 7:16 am #356430hothaibinhParticipantHi, thank you, I did it successfully. I just have a minor question. I see each batch has a profile photo, how to change the batch profile photo ? Thank youMay 8, 2021 at 2:40 pm #356670Anshuman SahuKeymasterPlease refer. : http://somup.com/crhj2kFGO1May 15, 2021 at 8:42 am #357507hothaibinhParticipantHi, I added the photo however the photo was not displayed correctly, it was cropped although I didn't crop it https://vimeo.com/549582953/894e4b5314 please help -
AuthorPosts
- The topic ‘Question about parent user addons’ is closed to new replies.