Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Can i use this code when i want Administrator as default role when register via Extended Users.
Code: Select all
<cms:db_persist_form 
   k_user_access_level = '7'
/>

Thank you.
I don't suppose that would work as the module allows only non-admin users to be added through the front-end.
KK wrote: I don't suppose that would work as the module allows only non-admin users to be added through the front-end.


Thanks for quick respond.

Ok then KK,

So what the best way to allow user to edit with "Popup Edit" in my site with role "Authenticate User". Since the Custom Tutorial is too much for me, i just want users can edit only not delete articles.

Thank you.
Could you please post the details of your use-case?
I don't think it is normal to grant admin access to users who have registered from the front-end.

Please let me know exactly what you are trying to achieve.
KK wrote: Could you please post the details of your use-case?
I don't think it is normal to grant admin access to users who have registered from the front-end.

Please let me know exactly what you are trying to achieve.


I use databound to submit chord into my site for registered users. And in my case i didn't need Advance Tutorial such as edit, create and delete function. I just need the registered users can only edit their own chord/articles using Popup Edit.

Here's the screenshot Popup Edit button for user with role Administrator, i have put k_logged_in into this page, which means is only owner that registered only can access this page.

Image Image

Now, my problem is since the Extended Users only can register as Authenticate User, my user cannot edit their own chord using Popup Edit that i explain above. If i have to change their role one by one into Administrator, there so much effort here.

Now, how to make the Authenticate User can edit their chord/articles, but they still cannot access the Couch Admin Panel.. Or is there any little tweak to make this done?

Thank you kk for your attention.
You can use plain databound forms to allow users to edit their submissions.
For example, you may use Bootstraps 'modal' form to show the DBF in a popup when the user clicks a certain button and then update the page upon successful submission of the form.

I think that shouldn't be much of a problem for you.

You'll, however, need to make sure that the user is able to edit only her own submissions (and not those of other users if she is able to see those as well). The standard way of doing this is by associating the submitted entries with the user through relations. i am not sure what tack you have taken but be careful about this point.

Hope this helps.
KK wrote: You can use plain databound forms to allow users to edit their submissions.
For example, you may use Bootstraps 'modal' form to show the DBF in a popup when the user clicks a certain button and then update the page upon successful submission of the form.

I think that shouldn't be much of a problem for you.

You'll, however, need to make sure that the user is able to edit only her own submissions (and not those of other users if she is able to see those as well). The standard way of doing this is by associating the submitted entries with the user through relations. i am not sure what tack you have taken but be careful about this point.

Hope this helps.

Thanks KK, it work for me.
here's my code:
Code: Select all
<!-- ############ EDIT START -->
<cms:pages masterpage='chords.php' limit='20' order='desc' custom_field="author==<cms:show k_user_title />" paginate='1' page_id=k_page_id>

  <div id="edit-modal<cms:show k_page_id />" class="modal fade animate">
    <div class="modal-dialog lg">
      <div class="modal-content fade-down">
        <div class="modal-header">
 
        <h5 class="modal-title">Edit</h5>
        </div>
       
        <div class="modal-body p-lg">
          
       
        <div class="page-content">
  <div class="padding bb">
    <div class="row-col">
        <div class="col-sm w w-auto-xs m-b">
          <div class="item">
         

    <cms:set submit_success="<cms:get_flash 'submit_success' />" />

<cms:form
        masterpage='chords.php'
        mode='edit'
        enctype='multipart/form-data'
        method='post'
        anchor='0'
        page_id=k_page_id
        >
       
        <cms:if submit_success >
    <div class="alert alert-success fade in">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
        <strong>Sukses </strong>chord kamu sudah kami terima.
    </div>
</cms:if>

        <cms:if k_success >
       
         <cms:send_mail html='1' from='noreply@kordb.com' to=k_user_email subject='Sukses! Artikel Anda Telah Diterima' debug='1'>
<cms:pages masterpage='chords.php' limit='1' page_id=k_page_id user_var=k_page_title author=k_user_title>
<cms:embed 'email-submission.html'/>
</cms:pages>
                </cms:send_mail>

            <cms:db_persist_form
            _invalidate_cache='0'
            _auto_title='0'
            author=k_user_title
            user_var=k_user_id
        />
       
            <cms:set_flash name='submit_success' value='1' />
            <cms:redirect k_page_link />
        </cms:if>

        <cms:if k_error >
            <div class="error">
                <cms:each k_error >
                <div class="alert alert-danger fade in">
               <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                <cms:show item />
                </div>
                </cms:each>
            </div>
        </cms:if>
         
         <div style="display: none" class="form-group row">
              <div class="col-sm-6">
                <label>Nama</label>
                <cms:input name='nama' class="form-control" type="bound" class="form-control" placeholder="Nama Lengkap" required='1'/>
              </div>
           
              <div style="display: none" class="col-sm-6">
                <label>Email</label>
                <cms:input name='email' class="form-control" type="bound" class="form-control" placeholder="Alamat Email" required='1'/>
              </div>
         </div>

            <div class="form-group row">
              <div class="col-sm-12">
                <label>Judul</label>
                <cms:input name='k_page_title' class="form-control" type="bound" class="form-control" placeholder="Judul Lagu" required="1"/>
              </div>
            </div>
             
            <div class="form-group row">
              <div class="col-sm-12">
                <label>Huruf pertama judul lagu</label>
                <p>
                <cms:input name="k_page_folder_id" class="form-control" type="bound" class="form-control" placeholder="Kategori" required="1"/>
              </div>
            </div>
           
            <div class="form-group">
              <label>Konten Chord</label>
              <cms:input name="chord_content" class="form-control" type="bound" class="form-control" placeholder="Chord Konten" required="1"/>
            </div>
           
            <div class="form-group">
              <label>Konten Lirik</label>
              <cms:input name="lyric_content" class="form-control" type="bound" class="form-control" rows="10" placeholder="Lirik Konten" required='1'/>
            </div>
           
            <div class="form-group row">
              <div class="col-sm-12">
                <label>Pilih Artis</label>
            <p>
            <cms:pages masterpage='chords.php' limit='1'>
            
                <cms:input
                name='artist_chord'
            class="form-control"
            opt_values= "
            <cms:related_pages masterpage='artists.php'>
            | <cms:show k_page_title />=<cms:show k_page_id />
            </cms:related_pages>"
            type='bound'
            required='1'
                />
               
            </cms:pages>

              </div>
            </div>
           
            <div class="form-group row">
              <div class="col-sm-12">
                <label>Youtube Video ID</label>
                <cms:input name="video_url" class="form-control" type="bound" class="form-control" placeholder="eg: s9NoBV_7yVI" required='1'/>
              </div>
            </div>
           
            <div class="form-group row">
              <div class="col-sm-12">
                <label >Soundcloud Url</label>
                <cms:input name="soundcloud_url" class="form-control" type="bound" class="form-control" placeholder="e.g: https://soundcloud.com/cmhn_secret/ada-band-masih-sahabatku-kekasihku" required='1'/>
              </div>
            </div>
           
            <div class="form-group row">
            <div style="text-align: right" class="col-sm-9 pull-right">
               <cms:if "<cms:not submit_success />" >
              <button name="submit" type="submit" class="btn btn-lg btn-outline b-dark rounded m-t">Submit Chord</button>
               </cms:if>
            </div>
            </div>

</cms:form>
           
          </div>
        </div>
    </div>
  </div>   
  </div>


            
           
        </div>
       
      </div>
    </div>
  </div>
  <!-- ############ SHARE END -->
</cms:pages>

And here's the code i use to wrap the post for registered/owner only:
Code: Select all
<cms:pages masterpage='chords.php' limit='20' order='desc' custom_field="author==<cms:show k_user_title />" paginate='1' page_id=k_page_id>
<!-----my post--->
</cms:pages>

So far, the code is work and filtering the post for the owner only. Is that something else that i should worry about this method KK?
7 posts Page 1 of 1