OpenRA / openrauseraccounts

Connect phpBB forum accounts to OpenRA installations

Home Page:https://forum.openra.net/ucp.php?i=232

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a badge order column to openra_user_badges and a UCP ordering panel

pchote opened this issue · comments

Player details are shown in a tooltip in-game, so we need a way to guarantee a maximum content height. This means capping the maximum number of badges that a user can display to <N> (e.g. 5).

At some point in the future we can expect active players to earn more than <N> badges (especially if we give them out relatively freely, which is good for community interaction), and it's not reasonable to expect the admins / badge moderators to have to manage this for every user.

Instead, we should support arbitrary numbers of badges on the forum side, and give players a UCP panel where they can order them. The top <N> are then shown ingame.

We could also possibly show the same top badges in the profile details (avatar/username/etc) on the forum topic view. All the badges should be visible on the user's profile page.

Instead, we should support arbitrary numbers of badges on the forum side, and give players a UCP panel where they can order them. The top are then shown ingame.

Contrary to my statement on irc today the ACP smiley interface (acp_icons.php and acp_icons.html) does not use ajaxfor ordering so my problem around using ajax in the extension does not apply here. I haven't started working on this but I'm confident the php and JS in the template file can be replicated in the UCP module for ordering badges. Your suggestion to show a visual line below the 5th badge (or a frame around the top 5 badges) would eliminate the need to actually select badges or show the selected ones in a separate table. This will be the approach I'll take when I find time for it.

We could also possibly show the same top badges in the profile details (avatar/username/etc) on the forum topic view. All the badges should be visible on the user's profile page.

This will according to my understanding need a custom theme but I agree that badges should be shown next to the other profile information.

The query in https://github.com/lawando/OpenRAUserAccounts/blob/master/core/core.php#L66 might
need to be changed but the method in https://github.com/lawando/OpenRAUserAccounts/blob/master/controller/main.php#L75 will need to be adjusted to only return a limited amount of user badges. We could make use of phpBB's sql_query_limit($sql, config['max_user_badges']) function like in https://github.com/lawando/OpenRAUserAccounts/blob/master/ucp/useraccounts_module.php#L210 when the items are ordered before.

Found out to how include js/css assets which is required for using the original JS code for reordering (not included in the UCP overall header/footer) and added the order column. Now proceeding to replicate the move-up/move-down functions in php and in the template file.

The feature for ordering badges in the UCP is as good as finished. Currently the js/ajax for changing the order when you click move up/down is still bugged (as is the fuction that locks the move up/down button for the top/bottom icon but that will be fixed hopefully soon too). Setting for 'max_user_badges' is currently hardcoded but will be an input in the ACP later.

The badge order for each user in the user badge table is critical for this and the initial order of user badges should better be inserted by an interface like planned in #19 than inserted manually.

Once the js/ajax powered ordering is fully functional (and updates the order int he db) I'll probably focus on #18 as I had this in mind when implementing this.

See pictures for preview: (First 4 are actually not relevant as they show the mode for adding badges which is not related to profile badges, added fyi.)

acp_add
acp_select_file
acp_selected
acp_badges
user_badges

Ordering items on the page and updating the db order column meanwhile works, but it turned out that the phpBB function is bugged and does not what it looks to do: when you move smileys below the spacer it looks like they would be "not displayed on the posting page" but in fact only the checkbox in the item options specifies that. Reload the page and the items you moved below the spacer will be back where they have been before.

The JS only moves the rows and the php/sql is very close connected to this. I've tried some simple methods to fix it on the frontend like skipping one row when that one has a spacer class but had no luck so far.

Fixed the issue mentioned above in a reasonable way without using any JS hacks or ugly workarounds. It just extends the existing methods to solve the problem. Should be fine.

The profile badges will now be listed in the controller output based on openra_user_badges.badge_order and limited by the value for config['max_profile_badges'] (still hardcoded to '5').

We could also possibly show the same top badges in the profile details (avatar/username/etc) on the forum topic view. All the badges should be visible on the user's profile page.

As mentioned before, this will need a custom theme and can not handled by the extension. Closing since everything within the scope of this issue is finished.