[ABD] Group-only BBCode, with username (eg. moderator)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
BugA_
Registered User
Posts: 7
Joined: Sat Apr 24, 2010 5:49 pm
Location: Bor, Serbia
Name: Igor Djordjevic

[ABD] Group-only BBCode, with username (eg. moderator)

Post by BugA_ » Thu Feb 03, 2011 9:29 pm

Modification Name: Group-only BBCodes (with username) MOD
Author: BugA_ (thanks to _PkZ_ for helping me with php/phpBB!)

Modification Goal: Easy to install and use, light MOD that allows a user to have group-specific BBCodes on his forum (with optional automatic poster`s username insertion). One separate php file to copy, and one function to add to 3 phpBB php files... That`s all it takes :)

Modification Description: Parsing BBCodes in forum messages, private messages and signature for specific groups only (bbcode is removed if user is not in group permitted to post that bbcode, optionally leaving the text inside bbcode). Also allows automatic username insertion into BBCode, with built-in fake username check (optional). For example, useful for making BBCodes that only moderators can use, inserting moderator`s name into BBCode automatically.

Modification Version: 0.5.0
Works With: phpBB 3.0.8

Requirements: As no ACP module is available yet, in order to change MOD settings user needs to edit "includes/bbcode_group.php" file (for those that might struggle, it opens with Notepad, too ;)).

It should be pretty simple to edit settings even if you don`t have any programming knowledge, but if you just can`t make it work, either ask for help in this topic, or wait for a version with ACP module.

Features:
  • BBCodes that only specific user group(s) can use (eg. moderators). It works for forum posts, private messages and user signatures.
  • Adding poster`s username into BBCode automatically (with built-in optional fake-username check)
  • Easy to install (1 php file to copy and 1 function to add into 3 phpBB php files)
MOD Format:
Image

Modification Download: (ZIP, 36 KB) http://www.megaupload.com/?d=V80M9NAU
Last edited by BugA_ on Fri Feb 04, 2011 1:53 am, edited 3 times in total.

BugA_
Registered User
Posts: 7
Joined: Sat Apr 24, 2010 5:49 pm
Location: Bor, Serbia
Name: Igor Djordjevic

Re: [DEV] Group-only BBCodes, with username (eg. moderators)

Post by BugA_ » Thu Feb 03, 2011 9:30 pm

How it Started: Main idea was to have bbcodes that only moderators can use (when editing user posts, for example), ideally with moderator username placed into place automatically. I searched phpBB forums and Internet, and even though many users had similar request/wish, I couldn`t find anything like it :(

After a while, I found 4S-BB-Control MOD that have BBCode permissions feature, plus so many great other possibilities! (go check it, maybe you`ll like that one instead, it is a great MOD) But, installation looked a bit long and complicated for editing "by-hand", and as our forums have so many custom codes I was afraid to install it automatically - mostly because I didn`t need all the features it offered after all. I wanted something easy to install/use, with features I needed, and without any particularly advanced options.

So, as what I needed wasn`t available at the moment (or at least I couldn`t find it), I decided to try to make it myself... and I did :) I need to note here that I`m pretty new to both phpBB and PHP itself, so please forgive me if I made anything in a bit harder way :oops: As I have pretty decent coding experience (C, Pascal, Delphi, C#...), and with help from my friend _PkZ_ regarding some PHP or phpBB questions, I made it work the way I wanted... well, eventually.

Because of my, already mentioned, humble phpBB knowledge, the MOD lacks some more "user friendly" interface (as ACP module would be), but I tried to make setting it the way you want as easy as possible, editing the core MOD file - includes/bbcode_group.php. To make this editing process even easier, I`ll give some examples here.

How to Use the MOD: The easiest thing you can do is install it, either through MODX auto installation, or by editing your files manually, create custom bbcode(s) to use with this MOD, and set MOD options (inside bbcode_group.php file).

Installation: As the original idea was to have an easy to install (manually, "by-hand") MOD, there is only one file to copy to your "includes" folder, and three phpBB files to edit - adding the custom function that will check bbcodes where/when needed. Check install_mod.xml for instructions.

Once you installed the MOD, you can create custom bbcodes to use with it.

Custom BBCode(s): I`ll give an example of two working bbcodes that can be used "out of the box", with minimal MOD settings needed.

Go to Administration Control Panel > Posting > BBCodes, and click Add a new BBCode. Copy the given text into appropriate fields.

BBCode usage:

Code: Select all

[mod]{TEXT}[/mod]
HTML replacement:

Code: Select all

<div style="color:#404040; background-color: #FFE6E6; padding: 6px 6px 6px 6px; border: 1px dashed #FFCCCC; border-left: 10px solid #FFCCCC;">{TEXT}</div>
Help line:

Code: Select all

[mod]Moderator text here[/mod]
Leave "Display on posting page" blank (do not check it). It`s not a problem even if users see the BBCode, but they can`t use it anyway, so no logic to see it.

Click Submit.

There, we created one BBCode, one more to go. Click Add a new BBCode again, and copy the text to appropriate fields.

BBCode usage:

Code: Select all

[modname={SIMPLETEXT}]{TEXT}[/modname]
HTML replacement:

Code: Select all

<div style="color:#404040; background-color: #FFE6E6; padding: 6px 6px 6px 6px; border: 1px dashed #FFCCCC; border-left: 10px solid #FFCCCC;">Edited by <strong>{SIMPLETEXT}</strong>: <i>{TEXT}</i></div>
Help line:

Code: Select all

[modname]Moderator text here[/modname]
Notice the help line, where I referred to bbcode as [modname], instead of [modname=USERNAME]. It is not a mistake, don`t worry, wait and see ;)

Leave "Display on posting page" blank again (do not check it), and click Submit.

Now that we made two custom bbcodes for moderators only, we need to actually make them moderator only :P We shall accomplish that by setting the MOD inside "includes/bbcode_group.php" file.

Setting the MOD: Open includes/bbcode_group.php file. If you don`t have any PHP programming experience, know that you can open it with Notepad, that simple text editor that comes with Windows :) If you are an old PHP wolf, use whatever editor you prefer ;)

What we need to do now is to see what is Global Moderators group id number. Maybe there is another (easier?) way to see this, but I know this one and I`m showing it to you (I saw it here at phpBB forums, but forgot who posted it, sorry :oops:) - go to Administration Control Panel > Users and Groups > Manage groups.

(click to enlarge)
Image

In the given example, we see that "Global moderators" id number is 4. See what id number is at your forums, and memorize it (or write it down). Back to "bbcode_group.php" now...

Find:

Code: Select all

    $modgroups    = array(                        // settings for groups of users, permissions to use bbcodes
    
    // id#
        4     => array 
Instead of number 4, put the number of "Global moderators" group at your forum. If it is the same, you don`t have to change anything :) If you change it, don`t forget to save the edited file.

That`s all! Now only users that have "Global moderators" as their default group can use our custom bbcodes, [mod] and [modname] :)


Usage examples:

When a user with "Global moderators" group as his default group enters this into his message:

Code: Select all

[mod]This is moderator`s message, please behave.[/mod]
... he should get this:
Image

When a user with "Global moderators" group as his default group enters this into his message:

Code: Select all

[modname]This is moderator`s message, please behave.[/modname]
... he should get this:
Image
... where BugA is username of the moderator that edited/posted the message.

If moderator Mike tries to use the bbcode as:

Code: Select all

[modname=BugA]This is moderator`s message, please behave.[/modname]
... he will still get his correct username inside, not the fake one:
Image

If a regular user edits/quotes the post, or tries to use bbcodes we assigned to "Global moderators" group only, the complete bbcode (along with text inside) will be removed, can`t be posted by regular user (nor any user other from "Global moderators" group).


Final notes: And that would conclude this (short? lol) tutorial on using the MOD. I made the MOD for our forums, and wanted to share it here because I saw that many people asked for something like this, but it wasn`t available yet.

For additional options, like using other custom (or even phpBB default) bbcodes, leaving the text inside bbcodes when removing bbcodes for regular users, or turning off fake-username check, examine SETTINGS section inside includes/bbcode_group.php file.

Feel free to post here if you encounter any problems, find bugs, or you need help, and please remember that I`m still new to all this (PHP/phpBB) :oops:

Cheers, BugA ;)
Last edited by BugA_ on Fri Feb 04, 2011 12:35 am, edited 1 time in total.

User avatar
darkonia
Registered User
Posts: 1901
Joined: Tue May 13, 2008 1:10 pm
Location: Munich, Germany
Contact:

Re: [DEV] Group-only BBCodes, with username (eg. moderators)

Post by darkonia » Thu Feb 03, 2011 9:44 pm

very nice, i look forward to this mod and subscribed :ugeek:
MMOG-Heaven - Das Gaming Portal
Community bedeutet Gleichgesinnte finden - MMOG-Heaven ist Deine Community! Von Spielern für Spieler bietet Dir dieses Portal genau das, was ein Spieler braucht. Bleibe ständig informiert, finde die neuesten MMORPGs, oder suche die frischesten News aus der Welt des Online Gamings - dieses und vieles mehr erwartet Dich auf MMOG-Heaven.

BugA_
Registered User
Posts: 7
Joined: Sat Apr 24, 2010 5:49 pm
Location: Bor, Serbia
Name: Igor Djordjevic

Re: [DEV] Group-only BBCodes, with username (eg. moderators)

Post by BugA_ » Fri Feb 04, 2011 12:47 am

^^ Thanks, darkonia :)

Added download link to the first post, second post updated, info added.

edit: I wanted to ask people that might know - do pre-defined user groups always have the same group id, upon installation (Administrators / Global moderators / Registered users...)? If so, end users of this MOD could just install it and make a bbcode, without a need to edit bbcode_group.php file at all :) I could make some more "out of the box" bbcodes in "bbcode_group.php" , and everyone could use the MOD without a need to change any settings. Of course, those that need additional functionality could edit "bbcode_group.php" anyway.

User avatar
Ashley.S.
Registered User
Posts: 468
Joined: Mon Aug 04, 2008 6:01 pm
Location: Falmouth, Cornwall, UK
Name: Ashley .S.
Contact:

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by Ashley.S. » Fri Feb 04, 2011 10:49 am

looks good, this mod might be nice to combine with the Custom BBCode only for MOD as that only hides the display of the button and not the use of the actual bb code :(

I'll be keeping an eye on this :)
Regards,
-Ashley.S. [ ProphpBB Free Forum Hosting Moderator ]

tneo
Registered User
Posts: 36
Joined: Thu Jan 13, 2011 7:24 am

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by tneo » Wed Mar 02, 2011 8:54 pm

I've installed the mod using automod, but it breaks posting.php. Whenever I want to post after the install I get a internal 500 error.

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by 4_seven » Wed Mar 02, 2011 9:24 pm

BugA_ wrote:I searched phpBB forums and Internet, and even though many users had similar request/wish, I couldn`t find anything like it
shure, you searched well?
http://www.phpbb.com/community/viewtopi ... 5#p6478995
Current Mods | Mod Base | php(BB) programming | No help via PM

User avatar
Ashley.S.
Registered User
Posts: 468
Joined: Mon Aug 04, 2008 6:01 pm
Location: Falmouth, Cornwall, UK
Name: Ashley .S.
Contact:

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by Ashley.S. » Wed Mar 02, 2011 9:50 pm

4_seven wrote:
BugA_ wrote:I searched phpBB forums and Internet, and even though many users had similar request/wish, I couldn`t find anything like it
shure, you searched well?
http://www.phpbb.com/community/viewtopi ... 5#p6478995
Your mod is already mentioned in the second post mate ;)
BugA_ wrote:After a while, I found 4S-BB-Control MOD that have BBCode permissions feature, plus so many great other possibilities! (go check it, maybe you`ll like that one instead, it is a great MOD) But, installation looked a bit long and complicated for editing "by-hand", and as our forums have so many custom codes I was afraid to install it automatically - mostly because I didn`t need all the features it offered after all. I wanted something easy to install/use, with features I needed, and without any particularly advanced options.
Regards,
-Ashley.S. [ ProphpBB Free Forum Hosting Moderator ]

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by 4_seven » Wed Mar 02, 2011 10:39 pm

nevermind. looked to short ;)

all in all, it's a great idea and much more slim than 4s-bb, so i set this mod in the last time temporary
to [abd], bcs. it's a hell of work, to make this mod rebuild with my today's coding-skills, which are
better, as the time i build 4s-bb, so i rebuild it this year or i [abd] it forever and any can take.

greez..
Current Mods | Mod Base | php(BB) programming | No help via PM

mfg
Registered User
Posts: 19
Joined: Sat Jan 23, 2010 5:42 am

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by mfg » Fri Apr 08, 2011 10:10 pm

nice mod. :D

but i got a little problem:

[mod] bbcode works in preview and after submit

[modname=] bbcode works only in preview, if i submit the post it looks like:

[modname=xxx]text[/modname]
:?

anyone know where my mistake can be ?
maybe phpbb 3.0.7 ?

T.A.C.O.S.
I've Been Banned!
Posts: 34
Joined: Tue May 03, 2011 12:34 pm

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by T.A.C.O.S. » Tue May 03, 2011 3:24 pm

Great MODification!

XavierPN
Registered User
Posts: 5
Joined: Sun Jan 09, 2011 11:59 pm

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by XavierPN » Tue Jun 21, 2011 3:46 pm

Hi,

This is a nice and welcome mod :) Our moderators are in a desperate need for a BBCODE which will be 100% reserved to moderators.

I noticed a small typo in the installation XML document:
- In the section where you need to replace the line

Code: Select all

'message'				=> $message_parser->message,
with

Code: Select all

				// group-only bbcode, bbcode_group_check();
				'message'				=> bbcode_group_check($message_parser->message)
Do not forget to put a comma after "message)", such as:

Code: Select all

				// group-only bbcode, bbcode_group_check();
				'message'				=> bbcode_group_check($message_parser->message),
More, I also would like to report the same issue MFG reported although using PHPBB 3.0,8, I can very well see the result of the mod only bbcode in preview, but when I post the message, it isn't displayed properly on the forum, showing
[modname=Xavier]Moderator was there!!![/modname]
Any idea what the issue could be?

Cheers,
Xavier

mahon
Registered User
Posts: 1
Joined: Tue Sep 27, 2011 6:39 pm

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by mahon » Tue Sep 27, 2011 6:45 pm

same problem here:
- simple codes work fine
- codes involving names (complex ones) don't work except for previews.

no idea why...

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25325
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: [DEV] Group-only BBCode, with username (eg. moderator)

Post by Paul » Wed Sep 28, 2011 9:00 am

This topic has been marked as [ABD] - Abandoned as the mod author has not been active recently. If the MOD author wishes to continue development, please PM anyone on the MOD Team to request this topic be unlocked.

Thank you,
The phpBB Modifications Team
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

Locked

Return to “[3.0.x] Abandoned MODs”