Template Modifcations

  • No, the Order was absolutly fine, you just ignored the line number for the second part.I told you to place it in line 183 and you put it to line 80 which is far away from the correct position.
    look at my template i'll postet befor:
    Template Modifcations


    What we're having is a failure to communicate. :(


    You told me to place {if 4|in_array:$__wcf->user->getGroupIDs()} before {foreach from=$objects item=user}.


    OK... Simple enough... So I search for {foreach from=$objects item=user} and added {if 4|in_array:$__wcf->user->getGroupIDs()} as instructed (before it).



    And I added the rest after {/foreach} also as instructed.


    I'm sorry if I failed to understand you. :(

  • No, you ignored the line numbers...


    Thank you @Morik This actually worked wonderfully. :)


    If I knew how to export it as an addon... I would and give credit where credit was due. lol

    • Official Post

    @Adam Howard An addon would be actually way more simple because you could add a user group permission to view this page (thus configurable per user group) and then attach an event listener to throw a \wcf\system\exception\PermissionDeniedException. Bonus points for not even required to touch the usersOnlineList template ;)

  • @Adam Howard An addon would be actually way more simple because you could add a user group permission to view this page (thus configurable per user group) and then attach an event listener to throw a \wcf\system\exception\PermissionDeniedException. Bonus points for not even required to touch the usersOnlineList template ;)


    I still do not fully know WCF's file system or where all the hooks are... In other words... I am not yet at the point where I can code for WBB. I did some review on github during the beta framework, but not enough to actually go making addons at the moment.


    Unfortunately my time at the moment is more limited than I would like it to be. I get 10 or 20 second "burst" to play with something and then I must more onto the next thing. I don't think I'll have time to learn it until maybe this summer.


    (It's why I keep seeking paid development... I don't have the knowledge or time to do it myself)



    @Adam Howard An addon would be actually way more simple because you could add a user group permission to view this page (thus configurable per user group) and then attach an event listener to throw a \wcf\system\exception\PermissionDeniedException. Bonus points for not even required to touch the usersOnlineList template ;)

    ^ OK, this double quote thing is happen to much now... I'm leaving it "as is". lol

  • I'm just talking about the conditions in the templates, not in PHP. :)


    For example:
    Show content just to logged in members and hide it from guests
    <xen:if is="{$visitor.user_id}">content</xen:if>



    Show content just to guests and hide it from logged in members
    <xen:if is="!{$visitor.user_id}">content</xen:if>


    etc...


    So it would be much easier to navigate if you've had a list ready and the necessary conditions. :) At least the most popular conditions. Not all know PHP to use it at the master level as you. :(

  • That list is literally infinite, hence constructing one is futile.


    There are a lot of variables that are used in templates - just look at the template to see them, and they can be combined in every possible way.



    As for your example, try this:


    {if $__wcf->getUser()->userID == 0}Hello, Guest!{/if}


    {if $__wcf->getUser()->userID}Hello, {$__wcf->getUser()->username}!{/if}

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

  • @Netzwerg, help for other conditions, please. :)


    • How can I show different content to guests and logged in members?
    • How can I show content to a specific user group?
    • How can I hide content from a specific user group?
    • How can I show content to more than one user group?
    • How can I hide content from more than one user group?
    • How can I show content to Administrators?
    • How can I show content to Moderators?
    • How can I show content to Administrators and Moderators?
    • How can I show content to staff members?
    • How can I show content to a specific member?
    • How can I show content to more than one member?
    • How can I show content if the visitor is the user?
    • How can I show content if the user is banned?
    • How can I show content after the first post in a thread?
    • How can I show content after the first post on every page in a thread?
    • How can I show content after post x on every page in a thread?
    • How can I show content after post x on every page in a thread, only in forums y and z?
    • How can I show content after post x on every page in a thread, except in forums y and z?
    • How can I show content after the first message in a conversation?
    • How can I show content after the first message on every page in a conversation?
    • How can I show content after message x on every page in a conversation?
    • How can I show content on a specific page?
    • How can I show content on pages with a sidebar?
    • How can I show content in a specific category?
    • How can I show content in a specific forum?
    • How can I show content in more than one forum?
    • How can I show content in all forums with a specific parent?
    • How can I show content in a specific thread?
    • How can I show content in more than one thread?
    • How can I show content in a specific post?
    • How can I show content in more than one post?
    • How can I show content to the thread author?
    • How can I show content if the post author is the thread author?
    • How can I show content to members with 0 posts?
    • How can I show content to members with more than x posts?
    • How can I show content to members with less than x posts?
    • How can I show content to members who are visible?
    • How can I show content to members who have an avatar?
    • How can I show content to members who do not have an avatar?
    • How can I show content to members who have completed a custom user field?
    • How can I show content to members who have not confirmed their email address?
    • How can I show content to visitors arriving from search engines?


    It's just very important to me. Would be grateful for the help. :)

  • You do realize that most of them are quite redundant? The first is exactly what I already answered ;) I don't have time for that in detal today, but I will help you fill in the blanks some other time.

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

  • They all can be useful, everyone in fact happens. I have many of them in use on another software. Anyway thanks, I will wait for a response :)

    • Official Post

    Hi


    filled in the ones I know from top of my head, you'll realize that they are very similar. Most the missing ones are pretty localized and sometimes depend on the exact position. You also should note that most of the conditions can easily be setup in your administrators control panel, if you are fine with a position at the top of the page. See: WBB4.1 — Notices

    @Netzwerg, help for other conditions, please. :)


    • How can I show different content to guests and logged in members? {if $__wcf->user->userID}Logged In{else}Guest{/if}
    • How can I show content to a specific user group? {if GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs()}
    • How can I hide content from a specific user group? {if !GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs()}
    • How can I show content to more than one user group? {if GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs() || GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs() || GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs()}
    • How can I hide content from more than one user group? {if !(GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs() || GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs() || GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs())}
    • How can I show content to Administrators? Depends on you definition of Administrator.
    • How can I show content to Moderators? Depends on you definition of Moderator.
    • How can I show content to Administrators and Moderators? Combine the above using ||
    • How can I show content to staff members? Depends on your definition of Staff Member.
    • How can I show content to a specific member? {if $__wcf->user->userID == USER_ID_HERE}
    • How can I show content to more than one member? {if $__wcf->user->userID == USER_ID_HERE || $__wcf->user->userID == USER_ID_HERE || $__wcf->user->userID == USER_ID_HERE || $__wcf->user->userID == USER_ID_HERE}
    • How can I show content if the visitor is the user? Sorry, I don't understand that one. Try to rephrase, please.
    • How can I show content if the user is banned? {if $__wcf->user->banned}
    • How can I show content after the first post in a thread?
    • How can I show content after the first post on every page in a thread? You can use the advertising system of Burning Board 4.1 for that one.
    • How can I show content after post x on every page in a thread? You can use the advertising system of Burning Board 4.1 for X in { 2, 3, 5, 10 } for that one.
    • How can I show content after post x on every page in a thread, only in forums y and z? You can use the advertising system of Burning Board 4.1 for X in { 2, 3, 5, 10 } for that one.
    • How can I show content after post x on every page in a thread, except in forums y and z? You can use the advertising system of Burning Board 4.1 for X in { 2, 3, 5, 10 } for that one.
    • How can I show content after the first message in a conversation?
    • How can I show content after the first message on every page in a conversation?
    • How can I show content after message x on every page in a conversation?
    • How can I show content on a specific page?
    • How can I show content on pages with a sidebar?
    • How can I show content in a specific category?
    • How can I show content in a specific forum?
    • How can I show content in more than one forum?
    • How can I show content in all forums with a specific parent?
    • How can I show content in a specific thread?
    • How can I show content in more than one thread?
    • How can I show content in a specific post?
    • How can I show content in more than one post?
    • How can I show content to the thread author?
    • How can I show content if the post author is the thread author?
    • How can I show content to members with 0 posts? {if $__wcf->user->wbbPosts == 0}
    • How can I show content to members with more than x posts? {if $__wcf->user->wbbPosts > X}
    • How can I show content to members with less than x posts? {if $__wcf->user->wbbPosts < X}
    • How can I show content to members who are visible?
    • How can I show content to members who have an avatar? {if $__wcf->user->avatarID || $__wcf->user->enableGravatar}
    • How can I show content to members who do not have an avatar? {if !($__wcf->user->avatarID || $__wcf->user->enableGravatar)}
    • How can I show content to members who have completed a custom user field? {if $__wcf->user->userOptionXXX} where XXX is the ID of the userOption
    • How can I show content to members who have not confirmed their email address? {if $__wcf->user->activationCode}
    • How can I show content to visitors arriving from search engines?


    It's just very important to me. Would be grateful for the help. :)

  • They all can be useful, everyone in fact happens.

    I don't doubt that, on the contrary. But still, they are redundant. ! is a logical negation, and from what you have posted above, XF also uses ! as logical negation.


    So, take this question:
    How can I show content to a specific user group?
    If i answer that, then you already have an answer to this question:
    How can I hide content from a specific user group? because all you need to do is to negate the condition. This has nothing to do with programming or WCF specifics, it simple boolean logic at work. You can also combine all these conditions with "and" (&&) and "or" (||)



    To answer some more of your questions:

    • How can I show content on a specific page?
    • {if $templateName == 'myPage'} {/if} As an alternative, use the notice system if that suffices.
    • How can I show content on pages with a sidebar
    • Same as above. As an alternative, if you don't want to add that to every page, create a custom sidebar box (there should be a plugin for that).


    Note that some of the things you are asking could be done with the advertisement system, and that some of the things you are asking could be hacked into the templates, but could be solved much more elegant by writing a plugin with proper EL + TPLL.



    As an example for the combination thing:


    How can I show content to a specific user group on a specific page?
    Just combine both conditions:


    {if GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs() && $templateName == 'myPage'} ... {/if}. Or, if you want to chain the ifs instead of combining the conditions, just wrap one into the other:
    {if GROUP_ID_HERE|in_array:$__wcf->user->getGroupIDs()}{if $templateName == 'myPage'} ... {/if}{/if}

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

    Edited once, last by Netzwerg ().

  • Nonono, that is the famous double iOperator!


    My head is severly scrambled right now :(

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy