PDA

View Full Version : User Postbit Template Selection


WhSox21
06-29-2005, 10:00 PM
I'm just getting back into the swing of things with vBulletin 3.5. Here's my first plugin being released (Others are still in progress).

What this does:
This allows users to select which postbit they wish to use via their control panel.

Installation
Upload the plugin and create a new user profile field by following the directions below.
Once you complete the top two steps you must edit the plugin and find: field5
Then change that to your user profile field number.

Add a New User Profile Field

Profile Field Type:
Single-Selection Menu

Title: Postbit Template Selection

Description:
If you prefer the old-style postbit, using two vertical columns rather than the new horizontal layout, you can switch back to using that template with this switch.

Options:
Horizontal Postbit
Vertical Postbit (Legacy)

Set Default:
Yes, but no First Blank Option

Display Order:
This is your choice.

Field Required:
No

Field Editable by User:
Yes

Private Field:
Yes

Field Searchable on Members List
No

Show on Members List
No

Allow user to input their own value for this option
No

The rest does not matter.

Mephisteus
07-01-2005, 03:25 PM
http://www.vbulletin.com/forum/showthread.php?t=101577, still works ;)

Nice go though :)

WhSox21
07-01-2005, 03:43 PM
Didn't know that was there. :(

FD929
07-01-2005, 09:41 PM
Not working.

WhSox21
07-01-2005, 09:54 PM
What seems to be the problem? I need more information. You most likely did not change the userfield in the plugin.

Christine
07-02-2005, 12:03 AM
Wow -- you all are porting these so quickly that I won't be able to catch up in time to have to port anything I am using as everything on my list of ToDos is showing up here. LOL!

Thank you for sharing!! :D

Kirk Y
07-02-2005, 06:59 PM
Not working.

Try going into the ACP -> vBulletin Options -> Style & Language Settings -> Set "Use Legacy (Vertical) Postbit Template" to "No".

That's what I had to do, it's working great now. Thanks for the Plugin, I've always wanted the Users to be able to select this. :classic:

FD929
07-02-2005, 07:47 PM
Try going into the ACP -> vBulletin Options -> Style & Language Settings -> Set "Use Legacy (Vertical) Postbit Template" to "No".

That's what I had to do, it's working great now. Thanks for the Plugin, I've always wanted the Users to be able to select this. :classic:
Thanks acid, that was it.

Kirk Y
07-03-2005, 01:41 AM
Thanks acid, that was it.

No problem.

Christine
07-03-2005, 01:53 AM
http://www.vbulletin.com/forum/showthread.php?t=101577, still works ;)

Nice go though :) phpinclude_start is depreciated.

Chris M
07-03-2005, 08:34 AM
global_start is the equivalent hook ;)

Satan

SlaPPiE
07-08-2005, 12:09 AM
Try going into the ACP -> vBulletin Options -> Style & Language Settings -> Set "Use Legacy (Vertical) Postbit Template" to "No".

That's what I had to do, it's working great now. Thanks for the Plugin, I've always wanted the Users to be able to select this. :classic:

Is there a way to get around this? I would like the vertical postbit on by default for all existing members and guests, and enabling this would force all users to update the option in their User CP.

Kirk Y
07-08-2005, 01:51 AM
Well... you could set the Vertical Postbit default for new registrations... but I'm not sure what you could do for the existing users.

Edit: I just thought of something, I'm not sure if this would work or not... but. When you're setting up the profile field, there's an option to make a selection default... try doing that. That should effect everyone's profiles, in theory anway.

WhSox21
07-08-2005, 11:38 AM
I uploaded another version. Anyone that wants the forum default to work on either postbit option try that one. I did not test this though so let me know if it works.

prawn
07-11-2005, 07:44 AM
Your script causes this problem (http://www.vbulletin.com/forum/showthread.php?goto=newpost&t=146288). Just wanted to let you know.

Christine
07-26-2005, 12:19 AM
Heya,

This hook location conflicts with the ignore user function as well as the soft-delete noted above.

No biggie -- it is just an issue of when it is being called.

Tested with a minor change to the code and moving the hook to global_start. Add in the template cache I PM'd ya, and you are all set.

:)

Neutral Singh
07-26-2005, 06:47 AM
Exactly what i was looking for thanks...

trancetopia
08-01-2005, 11:56 AM
Works a treat. Thanks.

CMX_CMGSCCC
08-04-2005, 04:09 AM
Can you attach the minor change you did to the code to fix the problem?

-CMX

Christine
08-06-2005, 06:51 PM
Given that this isn't my hack, I would prefer for the hack author to fix and re-release it. No stepping on any toes that way.

:)

WhSox21
08-06-2005, 06:53 PM
Given that this isn't my hack, I would prefer for the hack author to fix and re-release it. No stepping on any toes that way.

:)

Christine,

If you have the time would/could you PM me the working code? I'll re-release it along with giving you credit for your work.

I'm very busy right now getting the Help Desk plugin converted to 3.5.

Christine
08-06-2005, 08:26 PM
Done. :)

InfiniteWebby
08-11-2005, 04:33 AM
Has anyone figured out how to make this work if you have postbit_legacy selected in the vboptions. Because I have racked my brain trying to get it to work to no avail. And I would like to make postbit_legacy default for members AND guests.

InfiniteWebby
08-12-2005, 02:55 AM
Ok the problem lies in functions.php

if ($vbulletin->options['legacypostbit'] AND in_array('postbit', $templates))
{
$templateassoc['postbit'] = $templateassoc['postbit_legacy'];
}

And

if ($vbulletin->options['legacypostbit'] AND $templatename == 'postbit')
{
$templatename = 'postbit_legacy';
}

vBulletin replaces the templatename of postbit with postbit_legacy if you have the setting selected in the cp, no matter what you do before hand. So short of hacking files this sort of hack will never work with postbit_legacy selected in the cp.

CMX_CMGSCCC
08-12-2005, 04:06 AM
Aha, I have figured it out.

I have my forums enabled for "Legacy Postbit" by default.

Add the plugin to the hook 'cache_templates'

Use this code:


global $vbulletin;
if ($vbulletin->userinfo['field9'] == "Vertical Postbit (Legacy)")
{
$vbulletin->options['legacypostbit'] = 1;
}
else if ($vbulletin->userinfo['field9'] == "Horizontal Postbit")
{
$vbulletin->options['legacypostbit'] = 0;
}


CHANGE the field9 to your userfield fieldname.

This way when it caches the template, it will disable the legacypostbit option and not force it to use postbit_legacy.

-CMX

InfiniteWebby
08-12-2005, 06:50 AM
Aha, I have figured it out.

I have my forums enabled for "Legacy Postbit" by default.

Add the plugin to the hook 'cache_templates'

Use this code:


global $vbulletin;
if ($vbulletin->userinfo['field9'] == "Vertical Postbit (Legacy)")
{
$vbulletin->options['legacypostbit'] = 1;
}
else if ($vbulletin->userinfo['field9'] == "Horizontal Postbit")
{
$vbulletin->options['legacypostbit'] = 0;
}


CHANGE the field9 to your userfield fieldname.

This way when it caches the template, it will disable the legacypostbit option and not force it to use postbit_legacy.

-CMX

Thnx for the help man, sometimes the solution is right in front of you. You just need to get some alternate thinking =)

RoryF
08-17-2005, 04:37 PM
Thanks CMX_CMGSCCC, works like a charm :)

ged
09-27-2005, 05:09 PM
Is there any way to do it with plugin?

Loony BoB
10-02-2005, 11:17 PM
I've tried to implement this and failed miserably.

I tried using the default version and had that same problem with the deleted posts. Then I tried using the above version instead, and I got the following message whenever I tried to edit my user options...

Could not find phrase '::$values for profile fields is not an array::'.

Any ideas on whether we can get a working version of this available for download instead of downloading the file just to find it doesn't work? :(

Martz
10-03-2005, 11:04 AM
Thanks for this fix :)

The Wise One
10-04-2005, 12:09 AM
works good on 3.5.0

nice and easy and especially nice with the add on.

installed.

Andreas
10-05-2005, 12:32 AM
Everybody considering to use this should use this Code: https://vborg.vbsupport.ru/showpost.php?p=754751&postcount=25

The default Code of this Hack causes additional queries due to uncached Templates.

The Wise One
10-05-2005, 01:49 AM
Everybody considering to use this should use this Code: https://vborg.vbsupport.ru/showpost.php?p=754751&postcount=25

The default Code of this Hack causes additional queries due to uncached Templates.
the code you link to works great if you have the legacy postbit set as default in options...but how can that code be reworked to work with the horizontal postbit when set as default so that the additional queries can be eliminated?

Loony BoB
10-05-2005, 03:24 PM
Aye, that is also what I'm interested in doing. My website uses non-legacy by default but has legacy as an option, and we can't upgrade until we can figure out how to do this (using our test board).

jtallen123
10-05-2005, 08:02 PM
So is there a version of this that works properly with the horizontal, non-legacy, as the default yet? I seemed to read conflicting reports in this thread. :)

The Wise One
10-05-2005, 08:17 PM
So is there a version of this that works properly with the horizontal, non-legacy, as the default yet? I seemed to read conflicting reports in this thread. :)
from what i gather...the original code functions just fine as is...except its not cached causing extra queries?

the code Kirby linked to resolves that issue but legacy postbit needs to be set in ACP as default.

hopfully a version of that code is released to work with horizontal as default and without the extra queries. i tried playing with the plugin code, reversing and switching the code around...but was unsuccessful (no surprise there though...dont know a whole lot about php yet).

Samira
10-06-2005, 04:19 AM
I did this, with the regular postbit as default:

https://vborg.vbsupport.ru/showpost.php?p=754751&postcount=25

I did away with the else portion and only used the first part. Works fine with legacy as an option but not default. :) I also made sure to set in the profile field for the 'Top' option to be the default selection, if that makes any difference.

shungo
10-06-2005, 06:48 AM
Try going into the ACP -> vBulletin Options -> Style & Language Settings -> Set "Use Legacy (Vertical) Postbit Template" to "No".


That's i did exactly. But still not working on gold version even replacing by right field profile in module :(

jtallen123
10-06-2005, 02:44 PM
hmm - I think I'll eventually use this on my forums if we ever get a confirmed version that works with 3.5.0 and horizontal as default.

Samira
10-06-2005, 11:35 PM
Works for me, jtallen. :)

Andreas
10-07-2005, 12:48 AM
hopfully a version of that code is released to work with horizontal as default and without the extra queries. i tried playing with the plugin code, reversing and switching the code around...but was unsuccessful (no surprise there though...dont know a whole lot about php yet).
Hmm, works fine for me on gold no matter if legacy is default or not?

The Wise One
10-14-2005, 10:40 PM
Everybody considering to use this should use this Code: https://vborg.vbsupport.ru/showpost.php?p=754751&postcount=25

The default Code of this Hack causes additional queries due to uncached Templates.
another question about this. the code you recommend to use in the link above. is the caching done because of the code change or is it because of the hook it belongs to?

as it is now...it works great. when i add the add on, using the option to switch postbits (in the thread display mode menu) doesnt change the postbit. rather...it does, but it requires a refresh after clicking the option. if i use the code in the post you linked to...but change the hook to postbit_display_complete the refresh is no longer required and using the thread display mode menu option changes the postbit accordingly.

i guess what im trying to figure out is...are the additional queries you refer to being caused because of the hook used or the code used...

Mika
10-16-2005, 11:39 AM
Hmm, works fine for me on gold no matter if legacy is default or not?Here as well (3.5 gold).

WhSox21
10-17-2005, 05:33 PM
If anyone with spare time wants to take over this hack's support and functioning please let me know. I'll give you full credit to this hack and if the vb mods want to they can switch the thread starter via the database.

I just don't have time to update this at the moment. Too many things going on in my life.

dieselpowered
11-22-2005, 08:22 PM
Everybody considering to use this should use this Code: https://vborg.vbsupport.ru/showpost.php?p=754751&postcount=25

The default Code of this Hack causes additional queries due to uncached Templates.

Ok Andreas...the code below is the correct code to use to not get those additional queries, is that right? I just want to be sure, cause it works just fine :)

global $vbulletin;
if ($vbulletin->userinfo['field9'] == "Vertical Postbit (Legacy)")
{
$vbulletin->options['legacypostbit'] = 1;
}
else if ($vbulletin->userinfo['field9'] == "Horizontal Postbit")
{
$vbulletin->options['legacypostbit'] = 0;
}

Flow Fusion
11-27-2005, 02:09 PM
Thanks for the Fix also!

Quillz
12-10-2005, 08:55 PM
Thanks for the plug-in. Works well.

jdebler
12-30-2005, 01:41 PM
Kinda new to plugins, installed a few in the past but I got an error message that I never saw before when installing this one...

This file appears to be a Plugin, not a Product. Please use the Plugin Manager to add this file.

Is this right?

I went into the Plugin Manager and went to add it that way, but it asked me for information that I do not know, such as Hook Location.

Again, I am new to this so any help would be appreciated. Thanks!

YLP1
12-30-2005, 04:56 PM
Does this plugin have the fixes stated above already included?

jesus likes pie
12-30-2005, 08:17 PM
Hi.

http://www.vbulletin.com/forum/bugs35.php?do=view&bugid=2027


Any chance of a solution to this?

jesus likes pie
12-31-2005, 04:48 PM
oh whoops.....its good to read previous pages :)

fixed :)

Oblivion Knight
01-01-2006, 07:47 AM
I went into the Plugin Manager and went to add it that way, but it asked me for information that I do not know, such as Hook Location.

Again, I am new to this so any help would be appreciated. Thanks!Don't worry, we all have to start somewhere.. :)

Basically, there are 2 different plugin types. Products and Plugins.
Products contain plugins, and are generally used for larger mods. They can also install templates, phrases and settings automatically. Plugins don't do any of that, and simply add code in to vBulletin's hooks (as opposed to editing the source code)..

Since this is a plugin, we need to upload it as one.
Admin CP -> Plugin System -> Download / Upload Plugins -> Import Plugin Definitions XML File


Does this plugin have the fixes stated above already included?No, they need to be applied yourself.. Although it's a relatively easy job.

Gray Matter
02-10-2006, 12:36 AM
I don't know if anyone else has this problem, but this plugin makes my forum act strange with deleted posts. Usually, when posts are soft-deleted, they take on the appropriate template. With this, it's just a blank postbit template for soft-deleted posts. So I've had to disable this plugin, for now.

jdebler
02-10-2006, 12:15 PM
Any way to make this admin selectable for certain user groups only?



Oh, and uh...Oblivion Knight: I forgot to thank you for the basic info. Worked like a charm! :)

Hostboard
02-27-2006, 02:01 AM
Is this working on 3.5.4?

welo
02-27-2006, 02:14 AM
I have it on my 3.5.4 board and it seems to be fine.

Replicators
03-04-2006, 08:44 PM
It's not working for me at all i am not new to applying mods. Maybe it is just a setting wrong, idk. It keeps staying at horizontal no matter what i set it at.

Red Blaze
03-04-2006, 09:08 PM
Did you set your profile field number correctly? Go to your plugins, edit the plugin that belongs to the postbit selection thingie, and check the profile number. If the number doesn't match the one you have, that's your problem.

Also, if that's not the case, check the value of the radio buttons. That also must match what you have in the plugin.

Replicators
03-04-2006, 09:42 PM
It all checks out correct, i think it's a conflict with something else, only thing it can be, i will look around and see.

jdebler
03-06-2006, 12:29 PM
Is there any easy way to make this selectable only by certain user groups?

bulbasnore
03-11-2006, 02:02 AM
Well, nothings happening. My admin user's field6 is 'horizontal postbit'. Here's the code:

global $vbulletin;
if ($vbulletin->userinfo['field6'] == "Vertical Postbit (Legacy)")
{
$vbulletin->options['legacypostbit'] = 1;
}
else if ($vbulletin->userinfo['field6'] == "Horizontal Postbit")
{
$vbulletin->options['legacypostbit'] = 0;
}

Our 3.5.3(with plugin security patch) is set to legacy by default.

Nothing happens.

welo
03-11-2006, 06:27 AM
Try this:

global $vbulletin;
if ($vbulletin->userinfo['field6'] == 'Vertical Postbit (Legacy)')
$this->templatename = 'postbit_legacy';
$vbulletin->options['legacypostbit'] = 1;
else if ($vbulletin->userinfo['field6'] == 'Horizontal Postbit')
$this->templatename = 'postbit';

You might want to reconsider those radio button labels though. Who except a VB geek is going to know what they mean?

jdebler
03-28-2006, 12:22 PM
Is there any easy way to make this selectable only by certain user groups?

Anyone? :D

cmbehan
04-14-2006, 03:04 AM
Is there any easy way to make this selectable only by certain user groups?

I'm very interested in this feature also.

Konstantinos
05-01-2006, 05:11 AM
it doesnt work in 3.5.4

welo
05-01-2006, 05:53 AM
I've had this running in all 3.5.x versions. Works fine.

Konstantinos
05-06-2006, 11:20 AM
ok it works only when u have set in admin cp horizontal postbit by default, if in the admin cp post bit setting is vertical this mod doesnt change the postbig to horizontal

FinalAngel
05-08-2006, 08:38 AM
It doesn't work in my forum too, i've this Code in the Plugin System:

$fieldname = 'field8';

if ($_GET['postbit'] == 'Left') {
$db->query('UPDATE ' . TABLE_PREFIX . 'userfield SET ' . $fieldname .' = \'Vertical Postbit\' WHERE userid=' . $vbulletin->userinfo['userid']);
$vbulletin->userinfo['field8'] = 'Vertical Postbit';
}

if ($_GET['postbit'] == 'Top') {
$db->query('UPDATE ' . TABLE_PREFIX . 'userfield SET ' . $fieldname .' = \'Horizontal Postbit\' WHERE userid=' . $vbulletin->userinfo['userid']);
$vbulletin->userinfo['field8'] = 'Horizontal Postbit';
}

The other codes in this Thread doesn't work after all.

My field nr is 8, i've vb 3.5.4. I can choose between the two options but nothing happens...

Can anyone help me ?_?

VBUsers
05-12-2006, 07:12 AM
finally got it to work thanks!

vBulletin THEN DAYLIGHT
05-22-2006, 03:08 PM
finally got it to work thanks!
How. I can't get this to work at all :( Legacy is my default, I notice your forum has this as default as well.

What code are you using? I am using:


global $vbulletin;
if ($vbulletin->userinfo['field19'] == "Vertical Postbit (Legacy)")
{
$vbulletin->options['legacypostbit'] = 1;
}
else if ($vbulletin->userinfo['field19'] == "Horizontal Postbit")
{
$vbulletin->options['legacypostbit'] = 0;
}

vBulletin THEN DAYLIGHT
05-22-2006, 07:23 PM
No worries, fixed!!!!!!!!!!!!!!! WOOOOOOOOOOOOO!!!!!!

gopherhockey
08-08-2006, 02:31 AM
The posts and replies are too difficult to follow here.

Has anyone actually gotten this, or something similar, to work if you have the legacy postbit option set on in your admincp?

I want the legacy postbit to be the default for guests and all new registrations. Therefore, I have to keep this set. If not, it usese the new postbit, which I dislike but want users to select if they wish.

Basically I want the entire thing to work backwards.

I would just paste the legacy into postbit and postbit into legacy, but there are users who have selected their option and this would create a mess.

Oblivion Knight
08-08-2006, 07:01 AM
How to get this working with EITHER postbit or postbit_legacy as default.

Move the plugin to use the hook cache_templates, and replace the code with:
global $vbulletin;
if ($vbulletin->userinfo['field5'] != 'Use Forum Default')
{
if ($vbulletin->userinfo['field5'] == 'Horizontal Postbit')
{
$vbulletin->options['legacypostbit'] = 0;
}
elseif ($vbulletin->userinfo['field5'] == 'Vertical Postbit (Legacy)')
{
$vbulletin->options['legacypostbit'] = 1;
}
}Add an additional option to the custom profile field at the TOP of the list, "Use Forum Default".

This should work on both 3.5.x and 3.6.x setups.. :)

MotMann
09-24-2006, 09:42 PM
@Oblivion Knight

It's not works on Vb 3.6.1 :(

I used the last code from you...

MotMann
11-13-2006, 08:57 AM
No worries, fixed!!!!!!!!!!!!!!! WOOOOOOOOOOOOO!!!!!!

And what yo do? On my side it's not working.

Konstantinos
12-17-2006, 06:46 AM
it doesnt work in 3.6.4

brvheart
01-08-2007, 01:47 PM
Could we get a port to 3.6.x for this? This is a great option to give the members :)

gothicuser
01-10-2007, 12:41 PM
Just managed to get this working perfectly under 3.6.4 using instructions from THIS post (https://vborg.vbsupport.ru/showpost.php?p=1047326&postcount=74)
Many thanks Oblivion Knight :D

brvheart
01-10-2007, 01:11 PM
how do you move the plugin? Sorry never done that....I will be kick myself it is so easy...


EDIT: Nevermind I got and it is working :) thank you

SoftWareRevue
04-24-2007, 12:15 PM
How to get this working with EITHER postbit or postbit_legacy as default....This should work on both 3.5.x and 3.6.x setups...Can someone explain this in a "step-by-step guide for the complete idiot" kind of way, please? :)

Digbijoy
06-29-2007, 06:09 AM
How to get this working with EITHER postbit or postbit_legacy as default.

Move the plugin to use the hook cache_templates, and replace the code with:
global $vbulletin;
if ($vbulletin->userinfo['field5'] != 'Use Forum Default')
{
if ($vbulletin->userinfo['field5'] == 'Horizontal Postbit')
{
$vbulletin->options['legacypostbit'] = 0;
}
elseif ($vbulletin->userinfo['field5'] == 'Vertical Postbit (Legacy)')
{
$vbulletin->options['legacypostbit'] = 1;
}
}Add an additional option to the custom profile field at the TOP of the list, "Use Forum Default".

This should work on both 3.5.x and 3.6.x setups.. :)

thank you very much. :up:
works like a charm !

thanx again.

kambiz
10-04-2007, 04:54 PM
hmm.I did what Oblivion Knight said but it doesn't work on 3.6.8! is there any solution?

WhaLberg
10-05-2007, 02:32 AM
<a href="https://vborg.vbsupport.ru/showthread.php?t=144644" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=144644</a>

kambiz
10-05-2007, 02:01 PM
https://vborg.vbsupport.ru/showthread.php?t=144644
oops.
thanks.:D

Oblivion Knight
01-14-2008, 02:13 PM
I still firmly believe that my version works best (even though it doesn't take style overrides into account), and have just tested on 3.6.8 PL2 with no problem.

jdebler
01-14-2008, 09:39 PM
I still firmly believe that my version works best (even though it doesn't take style overrides into account), and have just tested on 3.6.8 PL2 with no problem.

Where is yours? I didn't see it listed in the modification list in your profile.

lifanovsky
04-28-2008, 12:28 PM
Can someone direct me to the same plugin that works with 3.7? Thanks a lot in advance!

attroll
04-29-2008, 03:16 AM
Can someone direct me to the same plugin that works with 7.7? Thanks a lot in advance!
What is 7.7 or was that a typo?

lifanovsky
04-29-2008, 07:29 AM
I meant 3.7 indeed. 8)

lifanovsky
05-04-2008, 12:25 PM
So is there any solution? Anyone? :)

attroll
06-18-2008, 03:22 AM
I found a big flaw in this hack. I have been having problems with viewing my soft deleted posts in the forums for a long time and I could not figure out what was causing it. I finally took the time to troubleshoot this tonight. It was this hack here that was causing my deleted post from showing up properly.

This hack sets the Hook Location at "postbit_display_complete" but it should be set to "postdata_start" to work properly.

Brew
02-18-2010, 10:31 PM
Please update this for ver 4.0.x?

Thanks!

Diablotic
04-13-2010, 08:35 PM
Yeah, we need similiar mod for vB4 please

New Joe
04-27-2010, 06:52 AM
Did anyone get this to work on vB 3.8.X?