View Full Version : Miscellaneous Hacks - Advanced [YOU] BB Code (with options) by BOP5
BirdOPrey5
11-27-2010, 10:00 PM
Brought To You by BirdOPrey5 / Qapla.com (http://www.qapla.com)
Just in time for April Fools Day!
Update - 11/28/2010 - Updated to 0.91 - Added 1 plugin for Breadcrumbs
Update - 12/7/2010 - Updated to 0.92 - Added 2 plugins to work in Polls (Questions and Options)
Update - 3/25/2012 - Updated to 0.97 - Completely re-coded, Now works virtually everywhere in a VB4 forum and suite (blogs, CMS, groups, etc...) - No longer compatible with VB 3.x.
Update - 3/26/2012 - Fixed a couple of bugs relating to blogs and thread titles.
Update - 4/28/2012 - FIxed bug for user title's in profiles
Update - 4/29/2012 - FIxed usertitle's on member's list
Live Demo: (Retired)
An all new version of my "Advanced [YOU] BBCode" mod, now completely compatible with the blogs, cms, and all other parts of the forum.
This mod creates the [YOU] BB-like-code. When someone types [YOU] in a post or thread or virtually anywhere else on the forum (if enabled) it gets changed to the username of the user currently viewing the page.
The mod allows you to specify a replacement to use for guests and users not logged in. The default is simply "you."
There are setting to allow the admin to enable and disable in the following areas:
Specific Forums (or all forums)
PMs
Visitor Messages
(Social) Groups
Picture Comments
Blogs
CMS
Widgets
Sidebar
Breadcrumbs
Signatures (when viewed in posts or PMs)
User Titles (when viewed in the postbit)
You can also specify "Immune" usergroups who will always see [you] so as not to get confused, if you wish..
If you need the older version for some reason it is still available as the VB 3.8 mod:
https://vborg.vbsupport.ru/showthread.php?t=254371
Please[B] Mark as Installed if you use this. :)
Donations Always Appreciated. :up:
Juggernaut
11-28-2010, 07:10 PM
I love it. rated 5 stars :D
TrigZu
11-28-2010, 07:26 PM
I'd like to see an option so [you] only works in X threads.
TrigZu
11-28-2010, 07:31 PM
Also, maybe an option so only X usergroups/boards have it turned on, so instead of eliminating all the other boards/groups you can just grant permissions to one board. Anyways, <3 it.
BirdOPrey5
11-28-2010, 07:48 PM
I'd like to see an option so [you] only works in X threads.
Also, maybe an option so only X usergroups/boards have it turned on, so instead of eliminating all the other boards/groups you can just grant permissions to one board. Anyways, <3 it.
I was back and forth on the issue of whether admins should specify the forums/usergroups to BLOCK or the forum/usergroups to ALLOW.
Ultimately I went with "Block" rather than "Allow" because on my own forum I have it enabled everywhere and for everyone.
It's a fairly simple edit to make in the plugins if you're so interested in changing the action from "Block" to allow...
If you go to your "Plugin Manager" in Admin CP... scroll down to the Advanced [YOU] BB Code plugins and edit EACH plugin...
At the top of each plugin is an IF statement:
if ($vbulletin->options['adyoubop5_en'] == 1 AND !in_array($post[usergroupid], explode(',', $vbulletin->options['adyoubop5_users'] )) AND !in_array($thread['forumid'], explode(',', $vbulletin->options['adyoubop5_forums'] )) )
If you remove the two exclamation points (!) (one before each "in_array") you will convert the settings from BLOCKED usergroups/forums to ALLOWED usergroups/forums.
I will investigate an option for applying this to just a single thread... Though limiting it to 1 forum like above should help.
TrigZu
11-28-2010, 07:56 PM
It has helped indeed. I'm going to go ahead and change that code now.
Perhaps rather than deciding whether or not to block or allow you could use both where blocks supersede allows. By doing so it might make the options menu slightly more confusing, but infinitely more versatile. Thanks for the reply. :D
Also:
https://vborg.vbsupport.ru/external/2010/11/5.png
Brandon Sheley
11-28-2010, 08:20 PM
this is nice, the old bbcode still works for us
I like the replacement for guest option "your mom"..lol
nice mod :) https://vborg.vbsupport.ru/external/2012/01/12.gif
BirdOPrey5
11-28-2010, 08:29 PM
It has helped indeed. I'm going to go ahead and change that code now.
Perhaps rather than deciding whether or not to block or allow you could use both where blocks supersede allows. By doing so it might make the options menu slightly more confusing, but infinitely more versatile. Thanks for the reply. :D
Also:
http://content.screencast.com/users/TrigZu/folders/Jing/media/d3821b96-b554-4172-bfbd-da23e4b1fa02/2010-11-28_1703.png
I saw the link in your post on the table code, and I must say as a guest at least reading "You" instead of "Unregistered" made it make at least some sense. Lots of LOLs to be had with this... we have some lengthy and funny [you] threads too, I didn't link because they all require registration to view.
I will definitely work on the options, maybe let the admin choose whether they are allowing OR blocking by forum/usergroup. Also wondering if user's not allowed to use it should see "[YOU]" or perhaps some sort for error message when submitting a post instead so they can't even try.
@Loco.M - Thanks!
Gemma
11-28-2010, 08:52 PM
Didn't work for me. Breadcrumbs and Thread title on Forum Display were showing [you] instead of my name, or Lurker which I had used as a [you] replacement for guests.
Disabled product for the time being
BirdOPrey5
11-28-2010, 09:03 PM
Oh wow. Forgot about the breadcrumbs... I'll get right on that.
TrigZu
11-28-2010, 09:12 PM
I think if they're not allowed to use it they should still see their username.
1
Make an option to not use the tag by user & usergroup & board & thread.
Then make an option to not see the tag by user & usergroup & board & thread.
THEN
2
use the tag by user & usergroup & board & thread.
and see the tag by user & usergroup & board & thread.
As I said before 1 supersedes 2.
sulasno
11-28-2010, 09:40 PM
tagged and thanks
what's the difference with this mod ?
https://vborg.vbsupport.ru/showthread.php?t=235832
TrigZu
11-28-2010, 09:51 PM
The advanced features make it much more powerful.
It's "Advanced" - There are settings in vBulletin options to enable, disable, block, and make users immune to this code.
BirdOPrey5
11-28-2010, 09:54 PM
tagged and thanks
what's the difference with this mod ?
https://vborg.vbsupport.ru/showthread.php?t=235832
That mod also does something funky with "/you" which this mod doesn't do anything with.
But more importantly that mod has no options or settings- everyone can use it in every forum... On mine you can limit who uses it, on what forums ir can be used, specify people immune to it, and specify a name/word to be shown to guests who aren't logged in.
Also I'm not sure if that mod works in User Titles or not, this one does.
One more difference- my mod doesn't work with the archive mostly because I don't think anyone cares about or uses the archive... if it's a big deal I can add it to the next version though.
BirdOPrey5
11-28-2010, 09:57 PM
Didn't work for me. Breadcrumbs and Thread title on Forum Display were showing [you] instead of my name, or Lurker which I had used as a [you] replacement for guests.
Disabled product for the time being
OK I got breadcrumbs working and will be uploading a new version shortly... the breadcrumbs are only an issue in showthread though. I don't understand what the issue is on forumdisplay- can you be more specific- usually you wouldn't see the thread title in the breadcrumbs while in forumdisplay... :confused:
Gemma
11-28-2010, 10:10 PM
Hey [you] how has your day been?
Doesn't show the original posters name, doesn't show gemma, doesn't show Lurker etc - it shows [you]
BirdOPrey5
11-28-2010, 10:27 PM
I don't know, it works for me and a couple of other sites I've tested on...
Screen Shot Attached... Is that some sort of mod separating your normal threads from your stickies? That could be a problem. Also your "latest threads" box on top I've never seen before either so I wouldn't expect this to work without some custom edits.
How many mods do you have installed? Would it be practical to give me a full list?
Dr.osamA
11-29-2010, 02:05 AM
working in vb 4.1.0 too
thank you
installed + 5Stars + translated to Arabic
plzz add it to orignal post
BirdOPrey5
11-29-2010, 02:16 AM
working in vb 4.1.0 too
thank you
installed + 5Stars + translated to Arabic
plzz add it to orignal post
Thank You! Added to first post. :up:
Dr.osamA
11-29-2010, 02:53 AM
thank you bro
you are very nice
BirdOPrey5
12-07-2010, 03:51 PM
Update to 0.92 - now you can use [you] in polls - both questions and as options.
COL NIL SATIS
12-07-2010, 04:22 PM
tagged
Dr.osamA
12-08-2010, 10:33 AM
thank you for update bro
plzz reupload the translated XML file agen
thank you man
BirdOPrey5
12-08-2010, 12:22 PM
thank you for update bro
plzz reupload the translated XML file agen
thank you man
Updated. :up: Thanks.
fastcom
02-03-2011, 02:42 PM
it work great, thank you. But it do not display in sidebar. I think, I muss add more plugin for mod but I do not know choose Hook Location.
please let me know how can do that.
BirdOPrey5
02-03-2011, 03:09 PM
it work great, thank you. But it do not display in sidebar. I think, I muss add more plugin for mod but I do not know choose Hook Location.
please let me know how can do that.
I don't have 4.x suite so I can't program any add-ons for the sidebars, articles, or any suite only features.
fastcom
02-05-2011, 02:24 AM
I don't have 4.x suite so I can't program any add-ons for the sidebars, articles, or any suite only features.
Thank for you reply. This product so great but if abuse then will bored and i want just some member can use other member can not use if do not have permission.
How can i do that?
thanks you:up:
BirdOPrey5
02-05-2011, 10:28 AM
Thank for you reply. This product so great but if abuse then will bored and i want just some member can use other member can not use if do not have permission.
How can i do that?
thanks you:up:
In the settings you can block certain usergroups from using it...
https://vborg.vbsupport.ru/attachment.php?attachmentid=123985&d=1290977671
So maybe you want to block your registered users (usergroup 2) but allow your mods and admins to use it, or f you have a "VIP" type usergroup you can let them use it too.
Alan_SP
04-01-2011, 11:41 PM
One other limitation I just found out:
If you have user who has more than one usergroup, and one usergroup is immune, but other isn't, this doesn't make user immune to you tag. Is it possible to enable immunity if user has at least one immune usergroup?
Alan_SP
04-02-2011, 12:20 AM
I looked in the code, I tried to use this two codes:
$youname = $vbulletin->userinfo['username'];
if ($yougroup == 1)
{
$youname = $vbulletin->options['adyoubop5_you'];
}
elseif (in_array($yougroup, explode(',', $vbulletin->options['adyoubop5_im'])))
{
$youname = "[YOU]";
}
And this:
$youname = $vbulletin->userinfo['username'];
if ($yougroup == 1)
{
$youname = $vbulletin->options['adyoubop5_you'];
}
if (in_array($yougroup, explode(',', $vbulletin->options['adyoubop5_im'])))
{
$youname = "[YOU]";
}
But it didn't worked out. Why? Any idea?
And there's second limitation. Again with multiple usergroups. If user belongs to at least one prohibited group, he couldn't use you code. :(
BirdOPrey5
04-02-2011, 02:09 AM
One other limitation I just found out:
If you have user who has more than one usergroup, and one usergroup is immune, but other isn't, this doesn't make user immune to you tag. Is it possible to enable immunity if user has at least one immune usergroup?
That's not how it's programmed. It only recognizes the primary usergroup. Are you sure the account you are testing it with isn't in the "immune" usergroups? They'll always see the "[you]" code, not their username.
I just tested this on my test forum, an admin (usegroup 6) had a secondary usergroup (9) made active... In the mod options usergroup 9 was blocked from using the code. Posts made by the admin still showed the username as I expected they would.
Alan_SP
04-02-2011, 03:35 AM
You are right. I set myself on my forum as (primary usergroup) registered user, and secondary as admin. I wanted to look to outsiders as regular user. Now I reversed that and when my primary usergroup is admin, I can see and write you code with no problem. Thank you, just my messed up setup of myself. :)
Everything's fine. Sorry.
BirdOPrey5
04-02-2011, 01:15 PM
Not a problem. Enjoy. :up:
Boofo
04-05-2011, 06:59 AM
Also when previewing your signature in your User CP you will see the [YOU] code in the signature, however it WILL work correctly in posts with the signature attached.
This can be fixed by adding another plugin in the profile_editsignature_start hook with the following:
$previewmessage = str_ireplace("[you]", $vbulletin->userinfo[username], $previewmessage);
BirdOPrey5
04-06-2011, 02:31 PM
Thanks Boofo. :up:
hugh_
04-16-2011, 05:55 AM
Is there a way of making this work with the widgets in the CMS?
BirdOPrey5
04-16-2011, 10:01 PM
Probably with custom programming but since I don't have the 4.0 suite I can't help you.
hugh_
04-16-2011, 10:19 PM
Thanks for replying BoP. Anyone else want to have a go at making this work in the CMS?
BirdOPrey5
04-16-2011, 11:28 PM
No problem- just a reminder I marked this as "re-usable" so I would welcome anyone who wants to pick up where I left off and keep developing this mod. :)
angeljs
05-14-2011, 03:06 PM
I love little personal touches like this for my members...thank you! :)
Conehead555
08-28-2011, 07:57 PM
Awesome in 4.1.4!
WendM
10-25-2011, 02:05 PM
Is there a way of making this work with the widgets in the CMS?
I'm just wondering that, as it does make it (cms) look a bit odd just seeing [you] displayed! Hope some kind soul can address this! Thanks! :)
btw, works fine on vB4.1.7
BirdOPrey5
10-26-2011, 09:58 AM
Updating this to work with the CMS/Suite has been added to my queue of back-logged projects. ;)
sweetpotato
10-28-2011, 05:20 PM
How to make it work with VSa-Advanced Forum Statistics please?
BirdOPrey5
10-28-2011, 05:38 PM
I don'y know, I don't use that mod.
sweetpotato
10-29-2011, 01:38 PM
Your Mod work well on my site except the title on VSa-Advanced Forum Statistics
hugh_
03-04-2012, 07:39 PM
Updating this to work with the CMS/Suite has been added to my queue of back-logged projects. ;)
My users love this mod! Please consider adding forum block support too...
hugh_
03-04-2012, 07:58 PM
This has generated tens of thousands of posts on my forum...
BirdOPrey5
03-26-2012, 12:34 AM
Updated to an all new, re-coded version. 0.97.
Now works virtually everywhere on the forum including blogs, CMS, sidebar, widgets, picture comments, PMs,. Visitor Messages, Social groups, as well as forums themselves.
The "immune usergroup" feature remains but the "bloc-usergroup" feature which was never fully implemented in the old version has been removed from this version.
Enjoy. :up:
hugh_
03-26-2012, 01:24 AM
This works brilliantly, excellent work!
RisingGlow
03-26-2012, 04:04 AM
Great code. but is it possible to enable this in profiles?
I'm running 4.1.10 and it shows [YOU], not the real username.
BirdOPrey5
03-26-2012, 08:06 AM
Where exactly in the profile is it showing [YOU]? Like what part? It should most certainly be working in Visitor Messages (if you have them enabled)...
BirdOPrey5
03-26-2012, 11:21 AM
Updated to version 0.975- a couple of bugs were causing the [YOU] not to work in blogs.
Also I had accidentally deleted the code that made it work in thread titles (fixed this.)
If you downloaded 0.97 you should definitely update to this version.
RisingGlow
03-28-2012, 04:55 AM
Updated to version 0.975- a couple of bugs were causing the [YOU] not to work in blogs.
Also I had accidentally deleted the code that made it work in thread titles (fixed this.)
If you downloaded 0.97 you should definitely update to this version.
on the left where it has ur name and profile picture
BirdOPrey5
03-28-2012, 04:16 PM
I don't see where it would be...
are you talking like this page?
http://www.qapla.com/mods/member.php/196-Joe-Mod
Maybe you could give me a screenshot so I know where exactly you mean?
RisingGlow
03-29-2012, 03:09 AM
I don't see where it would be...
are you talking like this page?
http://www.qapla.com/mods/member.php/196-Joe-Mod
Maybe you could give me a screenshot so I know where exactly you mean?
yah, that page.
BirdOPrey5
03-29-2012, 10:21 AM
OK, but I don't see [YOU] on that page. :confused:
Alan_SP
03-29-2012, 05:43 PM
As I remember, your mod looks only for primary usergroup for checking if [you] BBcode could be used, or for immunity to [you] BBcode.
This is a bit of a problem for me and it also somehow clashes with this mod: https://vborg.vbsupport.ru/showthread.php?t=229146
This mod also looks only for primary usergroups (and has also some bugs).
For my reasons I want to have myself set to look outside as regular users. Could you maybe change your mod to look to all usergroups, not only primary? In that case I'll could start using this other mod (if I use your mod and this, I'll look to outside world as admin, or I couldn't use [you] BBcode, or be immune). For the moment I use only your mod.
BirdOPrey5
03-30-2012, 11:42 AM
This version doesn't do a usergroup check on who can use it, it only does a usergroup check on immune users. But yes it does look for primary group only.
However it is a 1 line fix to make it work for secondary and primary groups:
Edit the Advaned [YOU] Function Plugin:
Find this line:
elseif (in_array($yougroup, explode(',', $vbulletin->options['adyoubop5_im']))) //If an immune user
and replace it with:
elseif (is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['adyoubop5_im']))) //If an immune user
As for the mod it clashes with I would think this new version shouldn't clash with any mods but I haven't checked it as I have my own version of the "HTML Markup Everywhere" mod.
Boofo
03-30-2012, 01:17 PM
I have been curious about this and wonder which way is actually better. Is one less intensive than the other?
if (is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['adyoubop5_im'])))
OR
$test = explode(',', $vbulletin->options['adyoubop5_im']);
if (is_member_of($vbulletin->userinfo, $test))
BirdOPrey5
03-30-2012, 03:47 PM
There will be no noticeable differences between those two codes in a production environment.
Over a thousand iterations you would still see no difference.
Over a million iterations you will notice the first one (all on one line) would be slightly better since there is one less variable assignment made.
But the difference in performance on a forum is in no way justification for code you can read and maintain easier.
Boofo
03-30-2012, 04:20 PM
I have always done it the seperate explode way but I am seeing it done like you did it more now. I was just curious as to your thoughts on it is all.
Alan_SP
03-30-2012, 04:33 PM
As for the mod it clashes with I would think this new version shouldn't clash with any mods but I haven't checked it as I have my own version of the "HTML Markup Everywhere" mod.
Sorry, didn't mean in sense it caused something to malfunction, but in sense that I needed to be in protected usergroup as primary usergroup, not in secondary.
And mod that I mentioned looks also only for primary usergroups to show them to outside world (mod is basically cosmetic).
As I want to appear as regular user to all others and still have all admin privileges (i.e. be protected from [you] BBcode), I needed to set myself as admin in primary usergroup. But, in this case that other mod showed me as admin. So, I decided not to use that mod and use yours. Till now. :) Now I can use both mods. :)
dawges
04-02-2012, 12:37 AM
Hi, nice mod. Can it be made where it will display the users avatar, ip address and email as well as username?
I saw this once on a forum using you code and it was great for pranks.
BirdOPrey5
04-02-2012, 11:27 AM
No, none of those things would be possible with this mod- nor do I see reason to add them. Sorry.
DAMINK
04-19-2012, 12:35 AM
I use a shoutbox and was wondering if this mod can work inside that as well or is that entirely the shoutbox creators department?
Either way i like it thanks BOP5
drchinh
04-19-2012, 05:05 AM
It is great, thank you so much!
BirdOPrey5
04-19-2012, 10:03 AM
I use a shoutbox and was wondering if this mod can work inside that as well or is that entirely the shoutbox creators department?
Either way i like it thanks BOP5
I've played with a couple of shout boxes before and never got it to work right. It would be a fairly easy feature to implement (I would think) for Shoutbox developers. They could include an on/off option to enable [YOU] and they would just have to scan the content being output to the screen for "[YOU]" using str_ireplace() function and replace it wilth $vbulletin->userinfo['username']. The idea of the [YOU] hack has been around long before me so if you get any shoutbox developer to add it let them know no credit is needed or anything like that- but I think the first one to implement this easy option will have an edge on the others since a number of people have been asking for it.
BirdOPrey5
04-28-2012, 08:43 PM
Updated to 0.976 - Fixes [YOU] in user title's in profiles.
Edit - 0.977 now- fixed in member's list too.
hugh_
06-01-2012, 11:39 PM
This doesn't work in the activity stream...
AusPhotography
06-15-2012, 09:53 AM
This doesn't work in the activity stream...
Same here - no surprise, AS is new
AusPhotography
04-09-2013, 09:25 AM
Bump -- activity stream?
BirdOPrey5
04-09-2013, 01:29 PM
Doesn't appear to be any hooks in the Activity Stream to let this work.
AusPhotography
04-10-2013, 03:36 AM
Doesn't appear to be any hooks in the Activity Stream to let this work.
Thanks. I had a look at the AS code as well ... :(
Maybe we ask vB (Jira) for a hook for this in 4.3?
BirdOPrey5
04-13-2013, 07:15 PM
Worth a shot- please vote for the issue - http://tracker.vbulletin.com/browse/VBIV-15676
AusPhotography
04-14-2013, 09:46 PM
Voted! Thanks
Just a side note tried on 4.2.0 but displays [you] in advanced forum stats > https://vborg.vbsupport.ru/showthread.php?t=235841
Would be nice to see this developed further for vb4 :)
BirdOPrey5
06-12-2013, 04:40 PM
I do not have plans to make this work with other 3d party mods, sorry.
If you follow PHP code at all it is fairly simple to duplicate wherever needed.
hugh_
01-11-2014, 09:08 PM
Joe is there a way of adding an image for this bbcode to the editor window?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.