Special templates code for Members \ Non-Members?

Hello all!

Is it possible to use special code in template files to share different content for Members and Non-Members?

For example (???):

<REGISTERED>You are God</REGISTERED>

<NEWCOMER>You are Nobody</NEWCOMER>

Quote · 4 Jan 2015

in the admin => builder => page builder you can use the guest or member option per block.

Quote · 4 Jan 2015

 

in the admin => builder => page builder you can use the guest or member option per block.

Per block - yes.

But I wan't to use special code for members\non-members in html-template's files. 

Quote · 4 Jan 2015

if you use a php block for that and then you can add the member loggedin check in a if else statement.

example:

if member() {
return You are God;
}else{
return You are Nobody;
}

Quote · 4 Jan 2015

 

But I wan't to use special code for members\non-members in html-template's files. 


The template processor does not have any coding to allow that.

https://www.deanbassett.com
Quote · 4 Jan 2015

Bad news.

It's impossible to provide different content in FOOTER and HEADER for users\non-members.

 

But I wan't to use special code for members\non-members in html-template's files. 


The template processor does not have any coding to allow that.

 

Quote · 5 Jan 2015

We did not say it was impossible.

There are no template keys to do it, but with some custom coding you can create keys. Or you could also use dolphins injection system.

https://www.deanbassett.com
Quote · 5 Jan 2015

why not just use a php block? it allows html 

so much to do....
Quote · 5 Jan 2015

 

why not just use a php block? it allows html 

 Because every website has 2 places where we can't use php or html BLOCKS. These places are footer and header. We can't use there any blocks. We can place there a code via html-templates only (_header.html, _footer.html, _sub_header.html, sub_footer.html).

Quote · 5 Jan 2015

ah i confused it with blocks

so much to do....
Quote · 5 Jan 2015

Put this in inc/classes/BxDolTemplate.php ~ line 1275 (function _parseContent)

at the start of the function put this

$bIsMember = isMember();
$aVariables = array_merge($aVariables, array(
    'bx_if:xx_is_logged_user_admin' => array('condition' => isAdmin(), 'content' => array()),
    'bx_if:xx_is_logged_user' => array('condition' => $bIsMember, 'content' => array()),
    'bx_if:xx_is_not_logged_user' => array('condition' => !$bIsMember, 'content' => array()),
));

so it will look like this

$bIsMember = isMember();
$aVariables = array_merge($aVariables, array(
    'bx_if:xx_is_logged_user_admin' => array('condition' => isAdmin(), 'content' => array()),
    'bx_if:xx_is_logged_user' => array('condition' => $bIsMember, 'content' => array()),
    'bx_if:xx_is_not_logged_user' => array('condition' => !$bIsMember, 'content' => array()),
));

$aKeys = array_keys($aVariables);
$aValues = array_values($aVariables);
....
.... 

now you can use these "anywhere" throughout your installation in .html files.

<bx_if:xx_is_logged_user>Only a logged in user can see this</bx_if:xx_is_logged_user>
<bx_if:xx_is_not_logged_user>Only a NON logged in user can see this</bx_if:xx_is_not_logged_user>
<bx_if:xx_is_logged_user_admin>Only a user can see this IF he/she/it is admin</bx_if:xx_is_logged_user_admin> 

Note: Better leave the tag names what it is (weird eh? i know), don't try to simplify these that could cause collisions with existing tags.

so much to do....
Quote · 5 Jan 2015

The following code works for me, just to share it if someone still searching for another solution:

D7.1 in inc/classes/BxDolTemplate.php


            case 'YOUR_CUSTOM_TEMPLATE_KEY':
               $iProfileId = getLoggedId();

               if ($iProfileId) {
                   $sRet = 'YOUR DESIRED CODE';
               }
            break;

Quote · 3 Apr 2015
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.