Question about parent user addons

Home Forums Legacy Support Support queries Setup issues Question about parent user addons

Viewing 15 posts - 31 through 45 (of 48 total)
  • Author
    Posts
  • #353091
    Veronica
    Moderator
    This reply has been marked as private.
    #353232
    hothaibinh
    Participant
    Hi, I updated to the lastest version of the plugin, still I don't see the batch appear in the course, Please help.
    #353384
    Anshuman Sahu
    Keymaster
    Well 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 .
    #353789
    hothaibinh
    Participant
    This reply has been marked as private.
    #353996
    Anshuman Sahu
    Keymaster
    For the batches to appear on single course page please try adding this code in your wplms-customizer.php file in wplms customizer plugin :
    add_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
    });
    while the user can see the batches in his dashboard : http://somup.com/crf32rFb94
    #354093
    hothaibinh
    Participant
    Hi 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.
    #354387
    Anshuman Sahu
    Keymaster
    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 . 2 . yes you can use this process : https://wplms.io/support/knowledge-base/wplms-buy-batch-feature/
    #355598
    hothaibinh
    Participant
    "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 ?
    #355609
    hothaibinh
    Participant
    Hi, I found the option in back end, where is it in front-end ?
    #355761
    Anshuman Sahu
    Keymaster
    add 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 simple
    #356066
    hothaibinh
    Participant
    Hi, 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 you
    #356353
    Anshuman Sahu
    Keymaster
    No css classes needed just add the menu item and goto wp-admin -> vibebp -> settings -> buddypress-> refresh buddypress navigation .
    #356430
    hothaibinh
    Participant
    Hi, 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 you
    #356670
    Anshuman Sahu
    Keymaster
    Please refer. : http://somup.com/crhj2kFGO1
    #357507
    hothaibinh
    Participant
    Hi, 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
Viewing 15 posts - 31 through 45 (of 48 total)
  • The topic ‘Question about parent user addons’ is closed to new replies.