PRSPY Widget for webpage: clan members currently playing

General discussion of the Project Reality: BF2 modification.
Post Reply
wenzul
Posts: 24
Joined: 2013-08-13 12:33

PRSPY Widget for webpage: clan members currently playing

Post by wenzul »

PRSpy website widget

Displays clan members currently playing on PR:BF2 Project Reality servers

May you have recognized this sweet PRSpy widget on some PR clan websites like 3dAC and KSK.
blip2 has already started a thread about this in the restricted PR:BF2 SA Private Forums.
I just wanna reshare this project for those who are webadmins but do not hold the role PR serveradmin.
Have fun!


Example

Image
This widget is optimized for Chromium. Please report any incompatibilities with other browsers or just do a pull request.

Standalone Version
  • Copy standalone/prspy/ into the root directory of your site.
  • Configure the widget settings in standalone/index.php.

    Code: Select all

    // refresh interval of widget in ms
    var interval = 30000;
    // you can list more than one, e.g. ["[3dAC]", "[KSK]"];
    var clantags = ["[KSK]"];
    // show clantag in popup before name (values: true, false)
    var showtag = false;
    // prspy data url
    var prspydata = '/prspy/serverdata.php';
  • Copy the distinguished sections of standalone/index.php into your corresponding template page.

Joomla Module
  1. Run make.bat to import web files from standalone version. This is necessary to avoid duplicate files in version control which have to be adjusted twice during changes.
  2. Copy joomla_module/mod_prspy/ into the modules folder of your Joomla! installation.
  3. Acitvate and configure the settings in the administration backend.
    Image
Tested with Joomla!-Version 2.5.24.


Wordpress Plugin
  • Run make.bat to import web files from standalone version.
  • Copy wordpress_plugin/prspy-widget into the wp-content/plugins/ folder of your Wordpress installation.
  • Acitvate and configure the settings in the administration backend.
Tested with Wordpress Version 4.0.


Settings
  • Clantags ([KSK],[3dAC],...) defines the clantag(s) which will be filtered.
  • Show clantags (true, false) defines wether clantags are shown before names or not.
  • Interval (ms) defines the refresh interval of the PRSpy widget in milliseconds.
    PRSpy data url (prspy/serverdata.php) defines a relative or absolute URL to PRSpy JSON data.
The file serverdata.php retrieves https://www.realitymod.com/prspy/json/s ... on?$time() and deliver it from the same domain. It avoids blocking messages like unsafe script by different browsers.


Libraries (included)

Links

Contributors
  • Original Concept: [3dAC] blip2
  • Improvements, Joomla Module and Flags/Scores: [KSK] wenzul
You do not have the required permissions to view the files attached to this post.
Last edited by wenzul on 2014-09-06 01:08, edited 4 times in total.
MaSSive
Posts: 4502
Joined: 2011-02-19 15:02

Re: PRSPY Widget for webpage: clan members currently playing

Post by MaSSive »

Would this work for SMF forum and WP site? I assume it cant be that hard to make it work under WP widgets, but I dont know about SMF.
Image
CATA4TW!

"People never lie so much as before an election, during a war, or after a hunt."
"God has a special providence for fools, drunks, and the United States of America."
― Otto von Bismarck
wenzul
Posts: 24
Joined: 2013-08-13 12:33

Re: PRSPY Widget for webpage: clan members currently playing

Post by wenzul »

MaSSive wrote:Would this work for SMF forum and WP site? I assume it cant be that hard to make it work under WP widgets, but I dont know about SMF.
I don't know SMF forum and never used WP. For the standalone version you just have to add some CSS/JS imports in your header, the settings in a script block or move it into a JS file and add a div-structure in the page body. Should be easy to insert in your template.
MaSSive
Posts: 4502
Joined: 2011-02-19 15:02

Re: PRSPY Widget for webpage: clan members currently playing

Post by MaSSive »

Ok Ill test this and if ( when ) I make it work, Ill postback result. It does search based on user tags ( prefix ) on PR servers right? Has nothing to do with registered users and databases, from the quick look Ive done?
Image
CATA4TW!

"People never lie so much as before an election, during a war, or after a hunt."
"God has a special providence for fools, drunks, and the United States of America."
― Otto von Bismarck
wenzul
Posts: 24
Joined: 2013-08-13 12:33

Re: PRSPY Widget for webpage: clan members currently playing

Post by wenzul »

MaSSive wrote:Ok Ill test this and if ( when ) I make it work, Ill postback result.
Ok, so you are using WP? Maybe we can also create a WP plugin.
MaSSive wrote:It does search based on user tags ( prefix ) on PR servers right? Has nothing to do with registered users and databases, from the quick look Ive done?
Yes, it uses JSON server data and checks for the first letters of player names.
MaSSive
Posts: 4502
Joined: 2011-02-19 15:02

Re: PRSPY Widget for webpage: clan members currently playing

Post by MaSSive »

That would be great. I can setup a quick WP installation for testing, and give you admin access and FTP access to site root. You can add me on skype ( not always online ) so we can communicate over this. If you agree this (WP ) plugin is also public and added to project.

Im not sure but for this to work with WP, this should be added to themes, functions.php file, as an quick solution but for much better look and feel it can be developed as a plugin or customizable widget with different styles.
Image
CATA4TW!

"People never lie so much as before an election, during a war, or after a hunt."
"God has a special providence for fools, drunks, and the United States of America."
― Otto von Bismarck
wenzul
Posts: 24
Joined: 2013-08-13 12:33

Re: PRSPY Widget for webpage: clan members currently playing

Post by wenzul »

MaSSive wrote:Im not sure but for this to work with WP, this should be added to themes, functions.php file, as an quick solution but for much better look and feel it can be developed as a plugin or customizable widget with different styles.
I have just tried to create a wordpress plugin. I used wordpress 4.0. It is implemented as a widget. You have to add it to a site area. Maybe it will work for you right away.
MaSSive
Posts: 4502
Joined: 2011-02-19 15:02

Re: PRSPY Widget for webpage: clan members currently playing

Post by MaSSive »

Great thanks, but make.bat wont work for me on win 7U x64...

Xcopy - Copy files and folders | Windows CMD | SS64.com

I can confirm its working on WP4, and will try standalone on Simple Machines Forum, no reason it should not work. Great job and thanks a lot. When I figure out a way to make it work on SMF Ill post a procedure.

Image
Last edited by MaSSive on 2014-09-06 15:32, edited 1 time in total.
Image
CATA4TW!

"People never lie so much as before an election, during a war, or after a hunt."
"God has a special providence for fools, drunks, and the United States of America."
― Otto von Bismarck
wenzul
Posts: 24
Joined: 2013-08-13 12:33

Re: PRSPY Widget for webpage: clan members currently playing

Post by wenzul »

MaSSive wrote:Great thanks, but make.bat wont work for me on win 7U x64...
Thanks for the hint. I have just replaced xcopy with robocopy. Should work now.
Arab
PR:BF2 Developer
Posts: 2898
Joined: 2012-05-18 03:37

Re: PRSPY Widget for webpage: clan members currently playing

Post by Arab »

Is there a way for PRSpy to show what the next map is for a server technically?
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Post by UTurista »

No... All information comes from a query made to the server and the awnser that we got does not include the next map. A solution is replacing the native query service by a python one but the last one who tried it said it caused to much server instability
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
wenzul
Posts: 24
Joined: 2013-08-13 12:33

Re: PRSPY Widget for webpage: clan members currently playing

Post by wenzul »

Yes, right now there is no data about that.
The popup is based on serverdata.json.
AncientMan
Retired PR Developer
Posts: 5111
Joined: 2007-05-22 07:42

Post by AncientMan »

If the server has pr_maplist in the server text, it'll be replaced by the next maps. You can see this at the moment on a few servers in PRSPY.

i.e. "ServerText":"Welcome to a Project Reality server!||- Qwai River Co-op Inf|- Ramiel Co-op Inf|- Saaremaa Co-op Alt|- Kashan Desert Co-op Std|- Operation Archer Co-op Std"

But its pretty broken and doesn't work right, so most servers don't put it in.
Image
pr|Optic
Posts: 48
Joined: 2016-04-19 14:30

Re: PRSPY Widget for webpage: clan members currently playing

Post by pr|Optic »

How do i load this Widget on xenforo i cannot figure it out

[SSG] Multi-Gaming Clan
Darojax
Posts: 16
Joined: 2015-07-20 02:08

Re: PRSPY Widget for webpage: clan members currently playing

Post by Darojax »

Thanks for the great Widget!

Is there any way to make certain players not display on the widget? F.ex. people strealing clan tags : )
Post Reply

Return to “PR:BF2 General Discussion”