Adding a View Profile Link - As a Pop-Up

80 views
Skip to first unread message

Banjo Fox

unread,
Sep 2, 2016, 2:00:29 PM9/2/16
to AJAX-chat
Hey all,

I finally cracked the problem of pulling in user profiles as a pop-up window.
Currently the chat I am dev/hacking for is a custom integration but I figure that this could be easily modified for most situations.

To get pop-ups to work add the following blocks of code to js/chat.js:

File:   js/chat.js  |  Line:  1177

   // Test function for User Profile pop-ups
     userProfilePopup: function(userID) {
             window.open("../../profiles/profile.php?user=" + userID, "user_profile", "width=200,height=100");
     },

File:   js/chat.js  |  Line:  1256

    // Single Language Version
          + '<li><a href="javascript:ajaxChat.userProfilePopup();">
          + View Profile</a></li>'
OR

    // Multi-language version
          + '<li><a href="javascript:ajaxChat.userProfilePopup();">'
          + this.lang['userMenuProfile']
          + '</a></li>'

    // For this you will also need to append: userMenuProfile: 'User Profile',
    // To somewhere in the js/lang/[lang_of_choice].js list


NOTES:

- The line numbers posted here are not hard requirements, but more like suggestions
- The URL "../../profiles/profile.php?user=" should be modified to match your installation
Yet Untested Example (phpBB):
window.open("..relative/path/to/forum/memberlist.php?mode=viewprofile&u=" + userID, "user_profile", "width=200,height=100");
- I have included both Single and Multi-language versions for the menu list item, pick one.

Banjo Fox

unread,
Sep 2, 2016, 2:15:04 PM9/2/16
to AJAX-chat
Right now this isn't a perfect solution because the userID is coming through as "undefined" but I'm sure that will be resolved soon.

Cuore di angelo

unread,
Sep 3, 2016, 5:50:48 AM9/3/16
to AJAX-chat
do not use the words "Line: 1177, Line 2222, etc." Many files are modified with additions and deletions, and lines of code do not match those of the stadard file :)

Banjo Fox

unread,
Sep 4, 2016, 10:04:29 AM9/4/16
to AJAX-chat
1. It is a force of habit

2.  It also provides a simple way to reference locations without having to say "after the final bracket of functionXYZ() but before getVariableABC()"
Since the Github prints the line numbers it -should- be easy enough to reference for anyone that has made extensive mods.
Reply all
Reply to author
Forward
0 new messages