phpbb / customisation-db

A Modification and Style database for phpBB.com and the International Support Teams, codename Titania
https://phpbb.com
57 stars 54 forks source link

Add link to user contributions from their profile #387

Open danieltj27 opened 4 months ago

danieltj27 commented 4 months ago

As it currently stands, there is no way to quick go from a users main profile on the forum (phpbb/community) to their list of customisations. You could copy and paste their name into the URL structure for the listing page:

https://www.phpbb.com/customise/db/author/danieltj/contributions

Taking me as an example here... however, most users probably don't have that URL to hand.

I'm simply proposing that there is a link added to the users main profile somewhere that includes the total number of validated contributions to the database. I'm not sure where it'd go, but I made a quick example from messing around in dev tools.

phpbb-user-profile-customs-stat

If I can get the database set up properly I can submit a PR, but what are your thoughts?

iMattPro commented 4 months ago

You could start with a php event core.memberlist_prepare_profile_data with a function in the listener like:

$user_contribs = $this->controller_helper->route('phpbb.titania.author', array(
    'author'  => urlencode($event['data']['user_id']),
    'page'    => 'contributions',
));

$event->update_subarray(
    'template_data,
    'U_USER_CONTRIBUTIONS,
    $this->controller_helper->get_real_url($user_contribs)
);

And then the template event memberlist_view_user_statistics_after for the HTML stuff

Of course you'll also need to get the count of their approved contributions if you want to use the number. Otherwise it could just also be generic text, like danieltj27's contributions