How to Show “Upload” Tab to Logged in Users Only Using a Custom Template in Clip-Bucket v2

Hello,

Like I wrote in a previous article, How to Check if a User is Logged in When Uploading Videos in Clip-Bucket v2, I further saw that the Upload tab from the top navigation bar was still there, in some custom templates, even when users where not logged in, therefore I decided to write this article to show you how to add a check to see if the user is logged in, if not, don’t show the tab, otherwise, show it. Note, if you are using CB template cbv2new, you don’t need to add this modifications.

1. Open the header file of your template, usually named header.html or global_header.html. If you have both, it’d header.html is the one we need to work with. Those files are located in ./styles/{YOURTEMPLATE}/layout/* .

2. Once opened, first search for {cbMenu echo=’yes’} , if you find it, then your CB template automatically checks if the user is already logged in or not to render the tab. If you don’t find it, search for

 <a href="{$baseurl}/upload">{lang code='upload'}</a>

. In the event you don’t find neither, please post a comment below so I can personally assist you.

3. Now that you’ve found the code that creates a link to the Upload page, you need to find the closest opening <li> above the <a>. To better understand, if you have the code:

               <ul>
                    <li id="AlLMenu">

                        <a href="{$baseurl}/videos">{lang code='browse'}</a>

                    </li>
                    <li style="color: #ccc;"> | </li>
                    <li id="upMenu">

                        <a href="{$baseurl}/upload">{lang code='upload'}</a>
                    </li>
                </ul>

the code that renders our whole Upload tab is:

<li style="color: #ccc;"> | </li>
<li id="upMenu">

<a href="{$baseurl}/upload">{lang code='upload'}</a>
</li>

So we need to add the authentication check there. For that, we will use an if like this
{if $userquery->login_check(”,true)}
So our final code would look like this:

{if $userquery->login_check('',true)} <li style="color: #ccc;"> | </li>                     <li id="upMenu">

                        <a href="{$baseurl}/upload">{lang code='upload'}</a>
                     </li>
 {/if}

4. Save and Upload.

If you get stuck at any point, please do not hesitate to contact me right away so I can personally assist you. Any questions, comments, articles suggestions, etc, are welcomed!

Best Regards,

Richi

Looking for quality ClipBucket Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , , | Posted under ClipBucket | RSS 2.0

Author Spotlight

Richi González

Richi González

I started programming when I was 12. I'm a Developer and have been working with the Clip-Bucket script since it came out. I became a Liaison between Arvixe and Clip-Bucket, so I am here to assist you with anything you need regarding Clip-Bucket or any particular computer-related subject you need. Best Regards, Richi

3 Comments on How to Show “Upload” Tab to Logged in Users Only Using a Custom Template in Clip-Bucket v2

  1. Kou says:

    where do i find the header file of your template, usually named header.html or global_header.html.
    Is it in my cpanel hosting website?

    Can you give me more direction how to make the upload appear to user only.
    I new to clip-bucket and don’t know much about FTP, PHP please give more detail.

    • Hello,

      If you have the default template, then your template name is cbv2new and the file you are looking for is header.html, located in ./styles/cbv2new/layout/*. Open header.html and follow instructions from step 2. Should you have further questions, please do not hesitate to contact me.

      Best Regards,
      Richi

  2. Kou says:

    What do you mean by that?

    2. Once opened, first search for {cbMenu echo=’yes’} , if you find it, then your CB template automatically checks if the user is already logged in or not to render the tab. If you don’t find it, search for

    I did find {cbMenu echo=’yes’} but can’t find {lang code=’upload’}

    please help

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 5 = 10

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>