Jump to content

Recommended Posts

Posted (edited)

This addon is an modified version of what's running on this site. I'm releasing it here because GTB seems to think that I manually update the list of banned users on the home page of BASH.zone. And frankly, even if I did, who cares?why does that matter?

 

This addon can be used to display the "member status" of anybody from a WBB installation. It's quite the niche addon, but maybe somebody can find some use for it.

 

If you find any problems or bugs with it, post them here, or send me a PM.

 

Requirements:

XenForo 1.5

WidgetFramework 2.5.9

PHP 5.3

 

After installation, visit the options and set which members you'd like to display statuses of. There is also the ability to map those userid's from the WBB installation to your own XenForo site's member userid's. You can also choose how long to cache the results.

 

After setting the options, import the widget_framework_GTB_Member_Status.xml from the Widget Framework XML directory, and a new widget renderer will be available to add to your forum_home, or whatever page you want to place the widget.

 

EDIT: Uploaded version 01.00.04 to fix a bug displaying admins correctly, and display a member's rank when hovering over the member icon.

 

[ATTACH=full]276._xfImport[/ATTACH]

Edited by SneakyDave
"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Just so Gary/GTB can rest his mind - and since I'm not joining YAS (yet another site) just to post the code segments

Pretty sure this is the code segment that retrieves the user listing from a WBB site (BTW, there are indicators that the data IS cached)

if(empty($gtbms_cache['members'])) {
           // Get a page with a list of user names on it.
           if(!$thepage = str_replace("\n", "", @file_get_contents(XenForo_Application::get('options')->smgtbms_memberlist_url))) {
               $thepage = null;
           }
           $gtbms_cache['selected_members'] = $option_array;

           // What to look for in the page string to determine a user's status.
           $pattern = '/(?<=title="MEMBER")(.*)(?=\Show Points of MEMBER)/';

           // Loop through the list of names we're looking for, find them, and assign a
           // status to them in the $option_array array.
           for ($x = 0; $x < count($option_array); $x++) {
               // If there is no "local" name for the member, use GTB's name
               if (empty($option_array[$x]['local'])) {
                   $option_array[$x]['local'] = $option_array[$x]['gtb'];
               }
               $member_pattern = str_replace("MEMBER", $option_array[$x]['gtb'], $pattern);
               $result = preg_match($member_pattern, $thepage, $matches);
               // Assign the member's status to the $option_array array
               if ($result) {
                   if (strstr($matches[0], 'Restricted')) {
                       $option_array[$x]['status'] = 'Restricted';
                   } elseif (strstr($matches[0], 'Banned')) {
                       $option_array[$x]['status'] = 'Banned';
                   } else {
                       $option_array[$x]['status'] = 'Member';
                   }
               } else {
                   $option_array[$x]['status'] = 'Not Found';
               }
           }
           $gtbms_cache['members'] = $option_array;
           $gtbms_cache['cache_create_tm'] = time();
           XenForo_Application::setSimpleCacheData('gtbms_cache', $gtbms_cache);

 

and this is the XML phrase segments that configures the ACP options (where you can set the members names to look for and the URL of the site

 

   <phrase title="option_group_smgtbms" version_id="1" version_string="01.00.00"><![CDATA[solidMean GTB Member Status]]></phrase>
   <phrase title="option_group_smgtbms_description" version_id="1" version_string="01.00.00"><![CDATA[Configuration options for the GTB Member Status Add-on]]></phrase>
   <phrase title="option_smgtbms_cache_time" version_id="1" version_string="01.00.00"><![CDATA[Cache Lifetime]]></phrase>
   <phrase title="option_smgtbms_cache_time_explain" version_id="1" version_string="01.00.00"><![CDATA[How long (in minutes) to cache the list of users.]]></phrase>
   <phrase title="option_smgtbms_gtb_users" version_id="1" version_string="01.00.00"><![CDATA[Member Map]]></phrase>
   <phrase title="option_smgtbms_gtb_users_explain" version_id="1" version_string="01.00.00"><![CDATA[The list of members that are requested from the WBB site, one on each line. If the members from the WBB site have an accompanying userid on "this" site, add an equation symbol to the line. For example, "tool =  バイス" would mean that the WBB userid is "tool", and his corresonding userid on this site is  バイス.]]></phrase>
   <phrase title="option_smgtbms_memberlist_url" version_id="1" version_string="01.00.00"><![CDATA[Member List URL]]></phrase>
   <phrase title="option_smgtbms_memberlist_url_explain" version_id="1" version_string="01.00.00"><![CDATA[The URL to a publicly available member list from a Woltlab Burning Board installation. Defaults to http://general-discussion.com/members-list/]]></phrase>
   <phrase title="SolidMean_gtbms_member_status" global_cache="1" version_id="1" version_string="01.00.00"><![CDATA[GTB Member Status]]></phrase>

  • Like 2
Posted (edited)

@SneakyDave - have you tried it without mapping to existing members?

I'm trying it out on one of my sites and have the cache set at 5 minutes. Names are there but the status hasn't pulled in and wondering if it is due to no mapping to existing name on the site I'm trying it on?

 

[ATTACH=full]279._xfImport[/ATTACH] [ATTACH=full]280._xfImport[/ATTACH]

 

EDIT:

 

Ooohh.. wait, I may need to open outbound port 80 on the server.

 

EDIT 2:

Nope, already done

# Allow outgoing TCP ports
TCP_OUT = "993,995,465,587,1012,1110,1194,2049,9418,20,21,22,25,53,80,110,113,443"

Edited by 13511
Posted (edited)

That should work, let me do some testing on my test site with the values you have and see if I can reproduce it. It might require an update, because the version I uploaded is a little older and a little different than the version used here.

 

EDIT: I reproduced the problem, looking at it in a few minutes.

Edited by SneakyDave
"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted

Oh, no hurry. As a disinterested 3rd party I just wanted to provide a different place to either prove or disprove that it was working.

 

:p

  • Like 1
Posted (edited)

I updated the first post so that the new version is downloaded, 01.00.01. It should work better for you Tracy, although I don't know why we're going through all of this trouble just to satisify Gary, because he's never satisfied until everybody is unhappy.

 

You can either re-install the whole thing, or just replace the UserList.php file in library\SolidMean\GTBMemberStatus\WidgetFrameWork with the new version in the zip file.

 

You shouldn't have to re-import the widget, but you may have to wait for the cache to refresh to see the results.

 

[ATTACH=full]282._xfImport[/ATTACH]

Edited by SneakyDave
"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted

And with the install/update here is what it shows

 

[ATTACH=full]281._xfImport[/ATTACH]

 

So, if Gary wants to play, he can compare it here and at The Bent Bike. I'll only be leaving it active for a day or so. It has a 5 minute refresh active on it.

  • Like 2
Posted

If fact, just so that there isn't a "well, you have the same ones he does and it does "X or Y" I used a few more existing users.

Sure looks like it's scraping the data to me.

 

[ATTACH=full]283._xfImport[/ATTACH]

  • Like 1
Posted
Howie from TAZ just sent me a postcard. He likes that addon so much he's going to pay me $20 a month just to use it on TheAdminZone.com. #fact.
"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted

lol, you're right, I'll fix that in the next release. It's hard to test restricted users because Gary doesn't have any at the moment, but once he does, I'll get it fixed up.

 

That's why people beta test.

"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted
lol, you're right, I'll fix that in the next release. It's hard to test restricted users because Gary doesn't have any at the moment, but once he does, I'll get it fixed up.

 

That's why people beta test.

That's one of the reasons I like messing with this kind of stuff when the mood hits (and for some reason, I'm in a testing mood - thinking about grabbing another server just to play with OS's and mail subsystems on if I don't do a colo on my R610 I have at the house).

Posted

For that fix, it's just a simple template f up.

 

In the "SolidMean_gtbms_widget_userlist" template, there are 2 references to "title="Restricted!"", replace the second one with "title="A member in good standing!"" or whatever you want.

 

Before

 

 

<xen:require css="wf_default.css" />

<xen:if hascontent="true">
   <ul class="WidgetFramework_WidgetRenderer_FeedReader_Entries">
       <xen:contentcheck>
           <xen:foreach loop="$members" value="$member">

               <div style="width: 100%;">
                   <div style="float: left; width: 15%;">
                       <xen:if is="{$member.status} == 'Banned'">
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_banned.png" title="Banned!">
                       <xen:elseif is="{$member.status} == 'Restricted'" />
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_restricted.png" title="Restricted!">
                       <xen:elseif is="{$member.status} == 'Not Found'" />
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_notfound.png" title="Not Found!">
                       <xen:else />
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_member.png" title="Restricted!">
                       </xen:if>
                   </div>
                   <div style="float: right; width: 85%">
                       {$member.local}
                   </div>
                   <div style="clear: both;"></div>
               </div>

           </xen:foreach>
       </xen:contentcheck>
   </ul>
</xen:if>

 

 

 

After:

 

 

<xen:require css="wf_default.css" />

<xen:if hascontent="true">
   <ul class="WidgetFramework_WidgetRenderer_FeedReader_Entries">
       <xen:contentcheck>
           <xen:foreach loop="$members" value="$member">

               <div style="width: 100%;">
                   <div style="float: left; width: 15%;">
                       <xen:if is="{$member.status} == 'Banned'">
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_banned.png" title="Banned!">
                       <xen:elseif is="{$member.status} == 'Restricted'" />
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_restricted.png" title="Restricted!">
                       <xen:elseif is="{$member.status} == 'Not Found'" />
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_notfound.png" title="Not Found!">
                       <xen:else />
                           <img src="styles/SolidMean/GTBMemberStatus/images/gtb_member.png" title="A member in good standing!">
                       </xen:if>
                   </div>
                   <div style="float: right; width: 85%">
                       {$member.local}
                   </div>
                   <div style="clear: both;"></div>
               </div>

           </xen:foreach>
       </xen:contentcheck>
   </ul>
</xen:if>

 

 

"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted
I liked creating this addon because I hadn't created a widget type of addon before, so I thought it was pretty educational. I also learned how to use XenForo's caching system, which was a lot easier than I thought it would be. I'm figuring out database access and advanced admin templates in my next one.
"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted
lol. yeah, sorry, that template is an old version, I just noticed that myself. the template must be all borked up, let me check.
"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted
Well, I'm trying something new.. instead of hitting him with one of my XenForo sites, I've got both running it. Or at least one hits his site and the other checks my Serving Linux site to make sure there is no IP blocking interference.
Posted

Well, looks like this version of the add-on may have a buglet.

[ATTACH=full]285._xfImport[/ATTACH]

 

The only one on that list that I have banned is JLPHOST.

Posted

Now, the weird thing is on the other XenForo site - it's still appears to be accurate.

 

I'll monitor for a while longer and see if it changes.

 

[ATTACH=full]286._xfImport[/ATTACH]

Posted

I noticed that on my test site too, the widget displays correctly now, but it was showing the same banned people.

 

Maybe that joking Gary is messing with us.....

"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted
I noticed that on my test site too, the widget displays correctly now, but it was showing the same banned people.

 

Maybe that joking Gary is messing with us.....

Well, that last one with the brown background is pulling from my Linux site.. so don't think he has any control over it. ;)

The weird thing is, it shows a few correctly but the majority as banned.

Posted

By the way, you can have that widget just show to you Tracy by editing it and changing the "Expression" to

 

$visitor['user_id'] == 1

 

or whatever your userid is.

"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone
Posted
Well, that last one with the brown background is pulling from my Linux site..

 

What WBB version is it? Maybe a different version requires some tweaking.

"I wonder if wife Susie knows about the vile crap he posts on his site and how it fits in with her "youth ministry"?" - Dr. Howard Rosenzweig, former owner of TheAdminZone

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...