WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • if logged in: show this and that in frontend
  • Print
Pages: [1]   Go Down

Author Topic: if logged in: show this and that in frontend  (Read 7220 times)

snark

  • Guest
if logged in: show this and that in frontend
« on: June 18, 2010, 07:36:20 PM »
is there a way to hide certain things on the fronend and only show them when a user is logged in

eason:

I want to hide the downloadcounts from the download module but make em visible to the logged in user(s)
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: if logged in: show this and that in frontend
« Reply #1 on: June 19, 2010, 12:10:07 AM »
Try this:

Code: [Select]

<?php
// check if user is logged in
  
if ($wb->is_authenticated()){
    
$groups = $wb->get_groups_name();
    
//check if user is part of _Usergroupname_
    
if(in_array(&#39;_Usergroupname_&#39;, $groups)) {
        
        
echo "I&#39;m logged in, and I am member of group _Usergroupname_";
       
    }else{
        
        echo 
""; //nothing
        
    
}
  }

should work.

Let me know.

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

snark

  • Guest
Re: if logged in: show this and that in frontend
« Reply #2 on: June 19, 2010, 09:19:10 AM »
yeah, but now I have to put it into the loop of the downloadmodule ...

I guess it has to be a droplet because I cannot put php code into the loop

Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: if logged in: show this and that in frontend
« Reply #3 on: June 19, 2010, 12:39:59 PM »
Have you considered to hide this part with CSS?

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

snark

  • Guest
Re: if logged in: show this and that in frontend
« Reply #4 on: June 21, 2010, 08:24:02 AM »
solved it ...


I made two droplets one called "downloadcountstart"   the other one called "downloadcountend"

Code: [Select]
global $database, $wb;
if ($wb->is_authenticated() ) {                   
return 'downloads: ';
}
else {
return '<!--';
}

Code: [Select]
global $database, $wb;
if ($wb->is_authenticated() ) {                   
return '|';
}
else {
return '-->';
}



after that I made a change to the loop in the downloadmodule settings-tab

I changed "downloads: [DL] |" to: "[[downloadcountstart]] [DL] [[downloadcountend]]"


this way it only is shown to a user that is logged in, for all regular visitors it is not shown

Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • if logged in: show this and that in frontend
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2