[ABD] Private Msg BBcode

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

[ABD] Private Msg BBcode

Post by stickerboy »

This MOD is currently abandonned, see my post further down this page


BBcode Private Msg - ver 0.1.0

Ok, I decided to start this based on this request here

Basically what this MOD will <hopefully> do, is to allow members to post messages to their friends/team mates (might be good for rpg) through actual posts on the forums.
Right now I'm using [priv] [/priv] as the tag names, but that might change :)

Only people specified will be able to read the message, i.e.
if you put [priv="bob"]text goes here[/priv] then only bob will be able to read the message.
So far I have the BBcode button created. I've modelled part of it on the phpBB 'quote' function, as will see on my demo boards.

Check the demo board for the code so far :): please bear* in mind that I have basically been throwing code together to get this to work - half of it probably isn't needed :D

Code: Select all

############################################################## 
## MOD Title: Private Message BBcode 
## MOD Author: Cherokee Red < cherokeered@blueyonder.co.uk > (Kenny Cameron) http://cherokeered.mrikasu.com/forums/ 
## 
## MOD Description: This MOD will add a new BBcode that can effectively hide a message in a post to another user using [priv] [/priv] - Any text within these tage will only be visible to the user specified. ie. by doing this [priv="username"] "text" [/priv] 
## 
## MOD Version: 0.1.0 
## 
## Installation Level: Easy 
## Installation Time: ~10 Minute 
## Files to edit:       6 
##         includes/bbcode.php 
##         posting.php 
##         privmsg.php 
##              language/lang_english/lang_main.php 
##         templates/subSilver/bbcode.tpl 
##         templates/subSilver/posting_body.tpl 
## Included Files: n/a 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
## If you have additional bbcodes installed you will need to increase the 
## addbbcodeXX (part in posting_body.tpl) accordingly and be sure that you don´t use 
## same letters and digits for two different bbcodes. 
## The colspan value in posting_body.tpl (3x after bbcodes) should be changed too 
## (it depends on how many bbcodes you have installed). 
## 
############################################################## 
## MOD History: 
## 
##   2005-01-21 - Version 0.0.1 
##              - BBcode button created - no support for usernames or hidden text yet 
## 
##         - Version 0.1.0 
##              - updated - now has support of username displaying and a message stating part of the post if a private message. No hidden value yet 
## 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
*Download*
clickify :)

*Demo Board*
clickify :)

*Progress*
  • create BBcode button [100%]
  • allow username output from button (i.e. [priv="username"] text [/priv]) [100%]
  • formatting of outputted text [50%] (I want to wait for more user input before I finalise this :) )
    hide message to specific user id [0%]

    optionals / extras
  • allow multiple usernames to be selected in the one tag - i.e [priv="user1;user2;user3"] text [/priv]
  • ACP option to allow admins/mods to view all hidden messages
Last edited by stickerboy on Mon Mar 21, 2005 3:39 pm, edited 1 time in total.
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
Rocketeer
Registered User
Posts: 108
Joined: Thu Sep 06, 2001 11:43 pm
Location: Coventry, UK
Contact:

Post by Rocketeer »

I've started on this from the exact opposite end as you... I have hidden text working per user, but no buttons or entry method.

Want to combine efforts?

Basically, my code takes tags of the form [privmsg="Tom","Dick","Harry"]Hidden message[/privmsg] and hides them as appropriate (trivial to change it to [priv] as you've done though). Usernames must be separated by commas, and each one in it's own quotes (since any other character may be a valid part of a username). The username is then converted into the user_id (so that if the user changes their name, it will still be to them).

Here's a test server...

Oh, and I'm working on the basis that the "Multi BBCode Mod" is already installed, since it's easier to code from there and work back than the other way around.
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Post by stickerboy »

Great, i'm at work just now but i'll definately checkout your work.
definately combine the efforts though - should make a great MOD
I'll just need to tidy up my code a bit :P

i'll maybe check it out tomorrow - but it's college day (same thursday)
i'm off work wed-sunday, so i'll have those nights free and all day fri/sat/sun

hopefully this should have something good soon
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
Rocketeer
Registered User
Posts: 108
Joined: Thu Sep 06, 2001 11:43 pm
Location: Coventry, UK
Contact:

Post by Rocketeer »

I'll turn what I have into a mod for you, either tonight or sometime tomorrow.

At the moment, there is a fairly large flaw in the code, which means that messages aren't always secret - particularly, user_id #2 will be able to read messages intended for #21-29 etc.

This is the code with the flaw:

Code: Select all

global $userdata;
// Any private message with the current username in becomes [privmsg:$uid:show],
// otherwise it becomes [privmsg:$uid:hide]
$text = preg_replace("/\[privmsg:$uid=([^\]]*?\\#${userdata['user_id']}[^\]]*?)\]/si", "[privmsg:$uid:show:\\1]", $text);
$text = preg_replace("/\[privmsg:$uid=([^\]]*?${userdata['username']}[^\]]*?)\]/si", "[privmsg:$uid:show:\\1]", $text);
$text = preg_replace("/\[privmsg:$uid=([^\]]*?)\]/si", "[privmsg:$uid:hide:\\1]", $text);
$text = preg_replace("#\[privmsg:$uid:hide:([^\]]*?)\](.*?)\[/privmsg:$uid\]#is", "/me whispers something secret to \\1", $text);
$text = preg_replace("#\[privmsg:$uid:show:([^\]]*?)\](.*?)\[/privmsg:$uid\]#is", "/me whispers \\2 to \\1", $text);
return $text;
Note that at the time this code runs, messages will look like this:

Code: Select all

[privmsg:$uid="Tom",#3,"Fred",#12]Secret message[/privmsg]
where #3 will be a verified user, and "Tom" will be a username that was not recognised when the post was written.
Rocketeer
Registered User
Posts: 108
Joined: Thu Sep 06, 2001 11:43 pm
Location: Coventry, UK
Contact:

Post by Rocketeer »

I've made some updates... the error I mentioned above is no longer an issue, so here's some code...

Code: Select all

[privmsg=<UsersList>]Something or other[/privmsg]
  • <UsersList> can contain the following items:
  • "UserName" - must be in quotes
  • "Group Name" - must be in quotes
  • #UserID - must not be in quotes
  • %GroupID - must not be in quotes
All user and group names will be replaced by the user or group ID, with the appropriate prefix, when the post is submitted.

TODO:
  • Currently, the posting user cannot see his own messages. I believe this should be changed, but it is hard to get the poster_id in bbcode.php
  • Whenever a post is quoted, all private messages will be visible. This should be changed
  • Need templating code, so we can use the language packs for formatting.
  • When posts are displayed, user and group IDs should revert to names - the same for quoting and editing.
Here is the latest code:
Private_Message_BBCode.txt
Note that changes will only be from an original file, not the last version of the code.
KI
Registered User
Posts: 32
Joined: Sat Nov 20, 2004 11:46 pm

Post by KI »

Fine :D
This mode makes real progress. Image

I think the fact that moderators are able to see all private messages by editing a post is inevitable Mr. Anderson. :wink:
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers »

KI wrote: I think the fact that moderators are able to see all private messages by editing a post is inevitable Mr. Anderson. :wink:


It's also necessary to keep your forum from being used for illegal activities without your knowledge. Looks like a great mod -- I'm anxious to try it!
Chaos1313
Registered User
Posts: 49
Joined: Thu Jul 08, 2004 6:00 am
Contact:

Post by Chaos1313 »

Very original idea, despite 2 people came up with the idea at the same time :P

Can't wait to try it out! Good luck!
"No one can read our Constitution without concluding that the people
who wrote it wanted their government severely limited; the words "no"
and "not" employed in restraint of government power occur 24 times in
the first seven articles of the Constitution and 22 more times in the
Bill of Rights." - Edmund A. Opitz
Tribal_Gecko
Registered User
Posts: 54
Joined: Wed Jan 19, 2005 10:34 pm

Post by Tribal_Gecko »

So how does this currently sit? Has anymore work been done on it recently? I am a bit skitish to add the code in right yet, as I don't want to mess my forums up to much.

Though I suppose I could just back them up...

But anyway, any updates?
User avatar
Lightfeather
Registered User
Posts: 246
Joined: Sat Jan 25, 2003 4:52 am

Post by Lightfeather »

Does this work properly? Updates?
"Experience is what you get when you don't get what you want."
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Post by stickerboy »

I'm sorry to say I have recently abandonned this MOD. I have worked on it for a while, but just can't get it to work right :(

First post will be ammended shortly.
Anyone who wishes to take take over this MOD can feel free to, but please pm/email me first :wink:
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers »

Sorry to see this one discontinued but hopefully someone else will take it over. It would be a very useful mod!
DKing
Registered User
Posts: 751
Joined: Sat Jul 03, 2004 8:38 pm

Post by DKing »

I think it would be cool if you could do [priv="guest"]Text[/priv] and Guests could see it.

I also think it would be cool if Admins and Mods could see ANY text, unless it was directed to a certain admin or mod! Sounds like fun, but frankly, I don't have the time to take this over! Oh well! It was good while it lasted!

-Dking
-DKing
Latest phpBB Version: 2.0.21
Search For a MOD: MOD Search
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers »

I'm hoping that Rocketeer is still working on this. It looked like he was making some progress.
Steel Rat
Registered User
Posts: 64
Joined: Mon Mar 24, 2003 10:40 pm
Location: Oak Harbor, WA
Contact:

Post by Steel Rat »

Rocketeer, are you still working on this at all.

oh, and for the person that mentioned two people thought of it at the same time, not so. I mentioned it originally after seeing a similar feature on another home-grown forum.
Locked

Return to “[2.0.x] MODs in Development”