[For 1.8] Allow users to upload a custom cover to their profiles
#1
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-Fil...e_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.


Attached Files Thumbnail(s)
   
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#2
EPIC! Thank you for sharing this I am highly considering implementing this.
Reply
#3
Amazing tutorial Omar 👏
Reply
#4
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.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#5
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.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#6
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.


Attached Files Thumbnail(s)
   
Reply
#7
(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.
Reply
#8
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-Fil...ermissions-

Please refer to the README file and read in full for more details regarding usage.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)