MyBB Community Forums
[For 1.8] Allow users to upload a custom cover to their profiles - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: Tutorials (https://community.mybb.com/forum-38.html)
+--- Thread: [For 1.8] Allow users to upload a custom cover to their profiles (/thread-241075.html)



Allow users to upload a custom cover to their profiles - Omar G. - 2024-05-22

I recently released OUGC File Profile Fields as a free plugin.

The following is an Example Configuration that will help you implement a custom cover for user profiles.

The reasoning to share this tutorial is for it to be an alternative to third-party plugins that are not optimized, and sometimes even have potential or actual vulnerabilities which might result in risky forum setups.

Custom Profile Cover Image
https://github.com/OUGC-Network/OUGC-File-Profile-Fields?tab=readme-ov-file#usage_examples

Custom Profile Field

    Title Profile Cover
    Short Description Upload an image to be used as your profile cover.
    Field Type File
    File Types PNG Image (png)
    Maximum File Size (Kilobytes) 2048
    Uploads Path ./uploads/covers (chmod 777)
    Custom Output Yes
    Only Image Files Yes
    Minimum Image Dimensions 600|200
    Maximum Image Dimensions 1000|400
    Display on profile? Yes
    Display on postbit? No
    Viewable By All groups
    Editable By All groups

Custom Template

A custom template should be created either in the Global Templates set for all themes or in each template set for each theme.

    Template Name ougcfileprofilefields_profile_file_10
    Contents The CLASS selector will target the profile user table in the stock MyBB theme.
<style>
	#content > div:nth-child(1) > fieldset:nth-child(5) {
		background-image: url('{$mybb->settings['bburl']}/ougc_fileprofilefields.php?aid={$aid}');
	}
</style>

Template Modifications

    Template Name member_profile
    Find {$footer}
    Add before {$GLOBALS['ougc_fileprofilefields']['fid10']} where 10 is the custom profile field identifier (fid).

Preview

[Image: attachment.php?aid=46960]

* This is configuration set in a stock MyBB installation. For custom setups (themes), modifications or adaptations are expected.


RE: Allow users to upload a custom cover to their profiles - JesterLee - 2024-05-27

EPIC! Thank you for sharing this I am highly considering implementing this.


RE: Allow users to upload a custom cover to their profiles - PARADOX987 - 2024-05-27

Amazing tutorial Omar 👏


RE: Allow users to upload a custom cover to their profiles - Omar G. - 2024-05-27

Thank you both !

If you please, share with us in this thread any additional Example Configuration you like, which I might later add to the README file and pin to the OP here.

Although the logic likely will be very similar, some people might find it useful if different examples are available.

Regards.


RE: Allow users to upload a custom cover to their profiles - Omar G. - 2024-05-27

Some Example Configurations I think should be possible would be custom post covers, custom post or profile avatars, custom forum logos, and custom global forum logo, etc.


RE: Allow users to upload a custom cover to their profiles - SELLECK87 - 2024-06-30

On the file type selection it doesn't give me the option to add .png but just says "Allow all types." How do I add .png?

Incidentally, I did not understand how to upload the image. Although I put file I get the field like this.


RE: Allow users to upload a custom cover to their profiles - DehillCMD - 2024-08-25

(2024-06-30, 11:29 PM)SELLECK87 Wrote: On the file type selection it doesn't give me the option to add .png but just says "Allow all types." How do I add .png?

Incidentally, I did not understand how to upload the image. Although I put file I get the field like this.

Same problem here.


RE: Allow users to upload a custom cover to their profiles - Omar G. - 2024-08-26

To be able to select specific attachment types instead of all types, edit your attachments types, each new type should have a new setting related to this plugin.

Make sure you apply the core edits required for this plugin to work.
https://github.com/OUGC-Network/OUGC-File-Profile-Fields?tab=readme-ov-file#-file-permissions-

Please refer to the README file and read in full for more details regarding usage.