[3.2][RC] Group Template Variables

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Mohammed AlSarsawi
Registered User
Posts: 67
Joined: Fri Mar 03, 2017 1:35 pm

Re: [RC] Group Template Variables

Post by Mohammed AlSarsawi » Tue Jun 05, 2018 10:33 am

yes now it's working thank you

User avatar
Galixte de EzCom
Registered User
Posts: 945
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.
Contact:

Re: [RC] Group Template Variables

Post by Galixte de EzCom » Sun Jun 10, 2018 10:13 pm

Is this extension inside the new version of Custom Code extension?

Could you update the first post of this topic about the Custom Code information?
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.1.x & 3.2.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.

Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.

User avatar
martti
Registered User
Posts: 660
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [RC] Group Template Variables

Post by martti » Mon Jun 11, 2018 5:27 am

Galixte de EzCom wrote:
Sun Jun 10, 2018 10:13 pm
Is this extension inside the new version of Custom Code extension?

Could you update the first post of this topic about the Custom Code information?
It's update now, thanks.

You need to install this Group Template Variables extension if you want the functionality in Custom Code.

User avatar
martti
Registered User
Posts: 660
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][RC] Group Template Variables

Post by martti » Tue Jun 19, 2018 6:37 pm

This extension is updated to version 0.2.0
The requirements are now
  • phpBB 3.2.1+
  • PHP 7+
The group ids are now available under the associative template variable marttiphpbb_grouptempvars
This makes it possible to list all group ids:

Code: Select all

<div class="panel">
  <h3>
    all group ids:
  </h3>
  <p>
    {%- for group_id, value in marttiphpbb_grouptempvars -%}
      {{- group_id -}}
    	{%- if not loop.last -%},&nbsp;{%- endif -%}
    {%- endfor -%}
  </p>
</div>
Image

The Custom Code extension is used here to put this contents in template event overall_header_content_before:

Image

To selective show content you can do this now:

Code: Select all

{%- if marttiphpbb_grouptempvars.4 -%}
    This content is only visible when the user is in group with id 4.
{%- endif -%}
In the previous version (for phpBB 3.1) of this extension the variables were available in the form of:

Code: Select all

S_GROUP_ID
Where ID was to be replaced with the id number of the group.
This format is still available but depreciated.

User avatar
Toxyy
Registered User
Posts: 537
Joined: Mon Oct 24, 2016 3:22 pm
Contact:

Re: [3.2][RC] Group Template Variables

Post by Toxyy » Wed Jun 27, 2018 8:37 pm

Martti, this is great. Just used this on a forum to only show the new topic button for administrators in specific forums. The forum uses php 5.5, and it still works. I had to edit ext.php and both of the composer files to get it to install, but the template variables do still appear. Not sure what will break because of that but I don't care much.

Thanks again!
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][RC] Show User Activity

User avatar
martti
Registered User
Posts: 660
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][RC] Group Template Variables

Post by martti » Wed Jun 27, 2018 8:49 pm

I simply don't want to care to garantee it works in PHP 5, also PHP7 has some features I use all the time now. It could be that this works because it's a simple extension, but I won't garantee it.

User avatar
Toxyy
Registered User
Posts: 537
Joined: Mon Oct 24, 2016 3:22 pm
Contact:

Re: [3.2][RC] Group Template Variables

Post by Toxyy » Wed Jun 27, 2018 8:50 pm

martti wrote:
Wed Jun 27, 2018 8:49 pm
I simply don't want to care to garantee it works in PHP 5, also PHP7 has some features I use all the time now. It could be that this works because it's a simple extension, but I won't garantee it.
That's what I was thinking, it's small enough that if something does break I can take a look, but all seems to be well. Either way, thanks for allowing me to do my job.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][RC] Show User Activity

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: Exabot [Bot], thecaretaker1, Toxyy and 19 guests