customisation-db icon indicating copy to clipboard operation
customisation-db copied to clipboard

Add link to user contributions from their profile

Open danieltj27 opened this issue 1 year ago • 1 comments

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?

danieltj27 avatar May 25 '24 17:05 danieltj27

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

iMattPro avatar May 25 '24 20:05 iMattPro