PDA

View Full Version : Add-On Releases - Guild Mate


Trek
07-30-2009, 10:00 PM
This should work on most vBulletin versions, but tested on 3.8.x.

This is an add-on to the vBguild (https://vborg.vbsupport.ru/showthread.php?p=1859182) mod. I am not the author of that mod and this add-on is just something I did for my own forums and I thought I'd share it for those using vBGuild as well.

I will continue to support this mod as a separate offering from vBGuild. If you need vBGuild support, please see that mod/author for support for it.

This is considered BETA as well. I'm running it on my forums and it works fine though. Also understand I'm pretty new to writing these mods and I know there are things that can be done to improve performance, etc. If you have suggestions, please make them, kindly. ;)

Also, this is fully phrased so you shouldn't have any trouble using the mod for different languages.

History:

8-25-09 Version .2 released.

* Added in Option to allow all usergroups to use the functionality (Thanks Deyth).
* Updated some config phrases to reflect allowing all usergroups to use the mod.
* Added in global variables to plugin as it appears some template themes don't carry these over already. (Thanks Deyth)
* Updated install instructions as I forgot a template edit prior. This will correct the dropdown with the character data not appearing.

Upcoming:

* Config option to select whether or not you want to display the header again in the popup or not.

* Whatever you guys come up with

Installation:

There is one template edit, the rest is imported through the product.

Edit your Postbit or Postbit Legacy templates

FIND:


<if condition="$post['rank']"><div class="smallfont">$post[rank]</div></if>
Add BELOW it:

<if condition="is_member_of($vbulletin->userinfo, $gm_user_groups_allowed)">
<div id="GuildMate_$post[postid]">
<a class="smallfont" href="member.php?$session[sessionurl]u=$post[userid]">$vbphrase[gm_postbit_text]</a>
<script type="text/javascript"> vbmenu_register("GuildMate_$post[postid]", true); </script>
</div>
</if>


Scroll to the bottom of your postbit template and:

Add:

<!-- START: Guild Mate $post[postid] popup menu -->
<div class="vbmenu_popup" id="GuildMate_$post[postid]_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="thead" colspan="3" align="center">$vbphrase[gm_modtitle]: $vbphrase[gm_modheader] $post[username]$vbphrase[gm_modheader2]</td>
</tr>

$gm_char_data
</table>
</div>
<!-- END: Guild Mate $post[postid] popup menu -->

Import the product

Once that is done, edit the vBulletin Options -> Guild Mate and set the user groups allowed to see the postbit changes.

Below are some screenshots from my website to help explain what this does.

Deyth
07-31-2009, 06:46 PM
This is very cool, thanks.

ssslippy
08-02-2009, 01:09 PM
Can this be done without template edits? There are hooks that can do this.

Trek
08-02-2009, 05:55 PM
Sure it can be, I've modified mine so much though that I figured people could put it where they wanted and like it more. I'll consider it if there is another release done. Since it's only 1 edit I didn't think it'd be too bothersome.

As for it not working, what doesn't work? What happens? I need something more to go on. =)

DiverTree
08-05-2009, 04:07 PM
excellent modification idea for vbguild. problem is, its not functioning for me. :(

i did the template edit to add the link under the username in the postbit, then installed the product, as per your instructions, however im having a problem with it.

when you goto the forums page, or any other page, the forums are working fine ... until you go into a thread. then i get this error ...Fatal error: Call to a member function query_read() on a non-object in /home/********/public_html/includes/class_postbit.php(265) : eval()'d code on line 35 if i disable the plugin, then the thread will display normally, and you can see the link under the username, but when you click it, nothing happens. if you right click and select open in new tab, it directs you to the users profile.

same thing happens if you enable the plugin, but disable the product.

would really like to see this working for our little community. can you help me out? thanks in advance for any help you can provide.

Trek
08-05-2009, 04:19 PM
Helping DiverTree via PM, will post any results necessary when a solution to his problem is found.

Bin7raib
08-05-2009, 06:13 PM
Cool , installed :)

DiverTree
08-06-2009, 01:32 AM
the issue im having, thats posted in post #5, isnt because of the modification ... it has something to do with the way i modified my forums.

just wanted to mention that so it doesnt deter anybody from using the modification.

ssslippy
08-09-2009, 10:18 PM
Is this vbseo compatible? The link is being rewritten and mine and nothing pops up.

Trek
08-09-2009, 11:18 PM
Is this vbseo compatible? The link is being rewritten and mine and nothing pops up.

I've never used VBSEO so I'm not sure what it takes to make it compatible. So as of right now anyway, I guess it's not compatible if you have to do something specific. I'll look into it though.

ssslippy
08-10-2009, 01:17 AM
I can disable invidual scripts in vbseo. Is there any script this is calling.

Also your templates are not cached.

Trek
08-10-2009, 01:30 AM
I can disable invidual scripts in vbseo. Is there any script this is calling.

Also your templates are not cached.


There's nothing external that I'm calling. I'll work on the caching of the templates.

ssslippy
08-10-2009, 02:06 AM
Ok I attempted this on default template

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)
Timestamp: Mon, 10 Aug 2009 03:05:53 UTC

Message: 'this.overlay.id' is null or not an object
Line: 11
Char: 10210
Code: 0
URI: http://immortal-guild.net/forums/clientscript/vbulletin_global.js?v=381

I get this after clicking on it. Also VBSEO was off during this time so its not that as I had orginaly thought.

Deyth
08-20-2009, 10:02 PM
I found the cause for DiverTree's error. Your plugin code should look like this:
global $vbulletin,$userinfo;

$user_chars = $vbulletin->db->query("select vbg.game_name as CharGame, vbs.server_name CharServer, vbc.character_name as CharName FROM " . TABLE_PREFIX . "vbguild_Game as vbg, " . TABLE_PREFIX . "vbguild_Server as vbs, " . TABLE_PREFIX . "vbguild_Character as vbc
WHERE vbc.user_id = '$post[userid]'
AND vbc.server_id = vbs.server_id
AND vbs.game_id = vbg.game_id
ORDER BY vbg.game_name, vbs.server_name, vbc.character_name

");

eval('$gm_header .= "' . fetch_template('gm_char_postbit_header') . '";');

while($CharData = $vbulletin->db->fetch_array($user_chars))
{
if ($char_game != $CharData['CharGame']) { $gm_char_data .= $gm_header; }
$char_game = $CharData['CharGame'];
$char_server = $CharData['CharServer'];
$char_name = $CharData['CharName'];
$gm_user_groups_allowed = explode(',',$vbulletin->options['gm_ugl_view_chars']);
eval('$gm_char_data .= "' . fetch_template('gm_postbit_char_bit') . '";');
}

// If there's no character data
if ($gm_char_data == "") {
eval('$gm_char_data .= "' . fetch_template('gm_postbit_char_none') . '";');
}

Everything loads but the view characters link isn't popping anything up now and I don't know what the problem there is.

Deyth
08-20-2009, 10:56 PM
I figured out the other problem. Here is what the postbit template edits should look like:

<if condition="is_member_of($vbulletin->userinfo, $gm_user_groups_allowed)">
<div id="GuildMate_$post[postid]" class="vbmenu_control">
<a class="smallfont" href="#">$vbphrase[gm_postbit_text]</a>
<script type="text/javascript">
vbmenu_register("GuildMate_$post[postid]");
</script>
</div>
<div class="vbmenu_popup" id="GuildMate_$post[postid]_menu" style="display:none">
<table>$gm_char_data</table>
</div>
</if>

DiverTree
08-20-2009, 11:08 PM
I figured out the other problem. Here is what the postbit template edits should look like:

<if condition="is_member_of($vbulletin->userinfo, $gm_user_groups_allowed)">
<div id="GuildMate_$post[postid]" class="vbmenu_control">
<a class="smallfont" href="#">$vbphrase[gm_postbit_text]</a>
<script type="text/javascript">
vbmenu_register("GuildMate_$post[postid]");
</script>
</div>
<div class="vbmenu_popup" id="GuildMate_$post[postid]_menu" style="display:none">
<table>$gm_char_data</table>
</div>
</if>thank you sir ... works like a charm now. :up:

Deyth
08-20-2009, 11:54 PM
I just now installed it on my own board and realized there was no way to simply tell it to display to all usergroups so I made that change and, while I was doing that, I saw how it looks with multiple games and didn't like having multiple headers so I changed that too. If you set the "usergroups allowed" option to 0, and it has to ONLY be 0, then it will show to all. Here are my versions of the template edits and the plugin code:

<if condition="is_member_of($vbulletin->userinfo, $gm_user_groups_allowed) || $vbulletin->gm_user_groups_allowed == 0">
<div id="GuildMate_$post[postid]" class="vbmenu_control">
<a class="smallfont" href="#">$vbphrase[gm_postbit_text]</a>
<script type="text/javascript">
vbmenu_register("GuildMate_$post[postid]");
</script>
</div>
<div class="vbmenu_popup" id="GuildMate_$post[postid]_menu" style="display:none">
<table>$gm_char_data</table>
</div>
</if>
global $vbulletin,$userinfo;

$user_chars = $vbulletin->db->query("select vbg.game_name as CharGame, vbs.server_name CharServer, vbc.character_name as CharName FROM " . TABLE_PREFIX . "vbguild_Game as vbg, " . TABLE_PREFIX . "vbguild_Server as vbs, " . TABLE_PREFIX . "vbguild_Character as vbc
WHERE vbc.user_id = '$post[userid]'
AND vbc.server_id = vbs.server_id
AND vbs.game_id = vbg.game_id
ORDER BY vbg.game_name, vbs.server_name, vbc.character_name

");

eval('$gm_header .= "' . fetch_template('gm_char_postbit_header') . '";');

$gm_char_data .= $gm_header;
while($CharData = $vbulletin->db->fetch_array($user_chars))
{
$char_game = $CharData['CharGame'];
$char_server = $CharData['CharServer'];
$char_name = $CharData['CharName'];
$gm_user_groups_allowed = explode(',',$vbulletin->options['gm_ugl_view_chars']);
eval('$gm_char_data .= "' . fetch_template('gm_postbit_char_bit') . '";');
}

// If there's no character data
if ($gm_char_data == "") {
eval('$gm_char_data .= "' . fetch_template('gm_postbit_char_none') . '";');
}



Here's an example post. (http://www.the-combine.net/vbulletin/showthread.php?p=177376#post177376) Thanks again for making this.

Deyth
08-24-2009, 01:14 PM
It's not working correctly in private messages. It's showing my own character info instead of the user I'm seeing. I'm not sure if it's my own version that's having the problem or if it's present in Trek's as well.

WiGgLr
08-24-2009, 04:10 PM
Fatal error: Call to a member function query_read() on a non-object in /mounted-storage/home84b/sub007/sc45970-PMHN/themondrated.com/includes/class_postbit.php(265) : eval()'d code on line 3

i get this error

Deyth
08-24-2009, 04:33 PM
Using my code or Trek's?

WiGgLr
08-24-2009, 04:58 PM
treks's

i edited both the postbit and postbit_legacy

i disabled it for now

do you edit both or just one?

and my postbit and postbit_legacy are already customized to display gifts and stuff, think thats why i had trouble knowing where to place the code in the template

this is all new to me and still learning

--edit:
well i just edited my postbit with your first code box in post 17, and i don't get that error when viewing threads, but the link "view characters" doesn't work

adding same code to postbit_legacy made the "view characters" look prettier, but still no function

Deyth
08-24-2009, 05:02 PM
treks's

i edited both the postbit and postbit_legacy

i disabled it for now

do you edit both or just one?

and my postbit and postbit_legacy are already customized to display gifts and stuff, think thats why i had trouble knowing where to place the code in the template

this is all new to me and still learning
Edit both templates and try my version of the template code. Then, go to the one plugin his addon creates and change the code inside to my version. Let us know if that has a different result.

WiGgLr
08-24-2009, 05:12 PM
how do i use your code for the plugin

i went to vb options --> guild mate, only has option to pick usersgrps who can use it, default at 6

ya when i re-enable the plugin i get that error again viewsing threads/posts

went to plugins & products --> manage products --> guild mate .1 --> edit

pasted this code into the new install box, and still getting error
global $vbulletin,$userinfo;

$user_chars = $vbulletin->db->query("select vbg.game_name as CharGame, vbs.server_name CharServer, vbc.character_name as CharName FROM " . TABLE_PREFIX . "vbguild_Game as vbg, " . TABLE_PREFIX . "vbguild_Server as vbs, " . TABLE_PREFIX . "vbguild_Character as vbc
WHERE vbc.user_id = '$post[userid]'
AND vbc.server_id = vbs.server_id
AND vbs.game_id = vbg.game_id
ORDER BY vbg.game_name, vbs.server_name, vbc.character_name

");

eval('$gm_header .= "' . fetch_template('gm_char_postbit_header') . '";');

$gm_char_data .= $gm_header;
while($CharData = $vbulletin->db->fetch_array($user_chars))
{
$char_game = $CharData['CharGame'];
$char_server = $CharData['CharServer'];
$char_name = $CharData['CharName'];
$gm_user_groups_allowed = explode(',',$vbulletin->options['gm_ugl_view_chars']);
eval('$gm_char_data .= "' . fetch_template('gm_postbit_char_bit') . '";');
}

// If there's no character data
if ($gm_char_data == "") {
eval('$gm_char_data .= "' . fetch_template('gm_postbit_char_none') . '";');
}

Deyth
08-24-2009, 05:40 PM
Do you have an instant messenger app of some sort? My info is in my profile; IM me.

Deyth
08-24-2009, 06:01 PM
Trek's plugin code was causing the error. My version of his code works ok...so far.

THE__DRIFTER
08-25-2009, 01:20 AM
So is Treks version updated? Or should we be using your adjusted code Deyth?

Deyth
08-25-2009, 01:41 AM
So is Treks version updated? Or should we be using your adjusted code Deyth?
I don't want to preempt the great thing Trek did by making his addon to my addon but I would say to use mine for now until he updates his. Meanwhile I'm attaching my version of the xml file to this post. I just edited it without testing so let me know if it bombs for some reason. You'll still need to do those manual template edits for now.

floggerss
08-25-2009, 04:54 PM
Its possible that only a CERTAIN usegrgroup can use it. PLSS

Deyth
08-25-2009, 05:22 PM
Its possible that only a CERTAIN usegrgroup can use it. PLSS
Yes, it's under the vbulletin options for guild mate.

Trek
08-25-2009, 05:51 PM
Sorry all, I've been in the process of moving and am just getting settled. I see that I forgot an initial template edit as well which is why the popup wasn't happening for people.

I've updated the first post to include that edit as well (it's also in the postbit template).

I'll add in the fix for adding in the global variables that fixed the issue of no database connection for some people into the next release as well.

Thanks Deyth for your help on troubleshooting and debugging while I was out. I'll look into your template modifications and see about adding them into the release as well.

Trek
08-25-2009, 06:00 PM
It's not working correctly in private messages. It's showing my own character info instead of the user I'm seeing. I'm not sure if it's my own version that's having the problem or if it's present in Trek's as well.

For verification, mine is working ok in PMs.

Deyth
08-25-2009, 06:41 PM
Why do you split up the template edits into different parts of the same template? They would work next to each other too.

Trek
08-25-2009, 07:16 PM
Why do you split up the template edits into different parts of the same template? They would work next to each other too.

Consistency. At least from the perspective of how my postbit templates are setup. From looking at the default postbit_legacy template and several other mods I have installed, popup menus are generally defined at the bottom of the template.

It makes it more clear when editing the template structure when you don't have all of the popup code right in the middle of your design. Personal preference and my following the direction of the default templates really.

Deyth
08-25-2009, 07:33 PM
Consistency. At least from the perspective of how my postbit templates are setup. From looking at the default postbit_legacy template and several other mods I have installed, popup menus are generally defined at the bottom of the template.

It makes it more clear when editing the template structure when you don't have all of the popup code right in the middle of your design. Personal preference and my following the direction of the default templates really.
Ok, because from a user standpoint it creates two spots that won't match default templates when upgrading vBulletin versions. The best move in this case would be to switch to auto-insert plugins instead of manual edits. I'd put in my vote for that in your next release.

THE__DRIFTER
09-05-2009, 06:04 PM
I have attempted to use this in the delivered fashion and using Deyth's code. Getting a DB failure when trying to access the forum now.

Nevermind, the issue is I am stupid....I didn't catch that this is an addon for a mod. I will retest this soon.

Trek
09-05-2009, 06:44 PM
I have attempted to use this in the delivered fashion and using Deyth's code. Getting a DB failure when trying to access the forum now.

Nevermind, the issue is I am stupid....I didn't catch that this is an addon for a mod. I will retest this soon.

I would also suggest that you use the full product as I have posted as it includes most of his suggestions as well as bugfixes. If you have problems with that version, let me know.

Deyth
10-11-2009, 06:14 PM
Trek, "Game" and "Server" are now phrases. (https://vborg.vbsupport.ru/showthread.php?p=1897350#post1897350) You'll want to update your addon to use those instead of the hardcoded column names. Thanks.

Deyth
10-11-2009, 06:32 PM
I tried installing your product xml and everything blew up. Comparing mine to yours I found two things that I had to change and you can see them in the attached xml file. I also added the phrases while I was in there. Now the board loads but there is no view characters dropdown and I'm trying to figure out why.

EDIT: It's something to do with your template edits. As soon as I replace your template stuff with mine it works ok. I don't have time to troubleshoot it now, though.

chiver
11-03-2009, 11:42 AM
this is truely the handy feature to have with vbguild. will you be updating this to vb4.0 and working out the remaining bugs?

Deyth
11-03-2009, 01:16 PM
If Trek says he won't update it, I will.

chiver
11-03-2009, 01:42 PM
If Trek says he won't update it, I will.
that is nice to hear deyth. and thank you for your work on vbguild as well. the members really find it helpful.

Trek
11-03-2009, 05:03 PM
Assuming that Deth upgrades his to VB4 (which sounds like it from his last post), then I'll upgrade it as well as I plan on using it still on my forums when I upgrade. I'll have it all cleaned up then too. =)

Deyth
11-03-2009, 07:19 PM
Definitely going to upgrade to vb4 but not right away. Let it be out for a little bit so they can do at least one maintenance release. I think rushing to vb4 is definitely a bad idea for people setup nicely on vb3.

redtailboa
05-18-2010, 04:59 PM
Where are we with this?

I want to try this out but want to make sure I use the right xml file and do the right edits

Trek
06-23-2010, 08:29 PM
I actually have a new version for vB4 that corrects all of the issues and makes things a bit nicer, however as there is no vbGuild officially released for vB4... there's not much point in releasing it.