MyBB Community Forums

Full Version: Profile fields regular expression help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I would like to give my users the opportunity to add a image as background on their postbits.
So I figured I would use the profile fields. I want all of my users to use imgur.com as their image uploading site.

https://i.imgur.com/(random numbers & letters here).extension

So I figured I would put this into the field:
https://i.imgur.com/(^[A-Za-z0-9_.]+$)

However, it does not seem to work. Could anyone help me fix this?

Kind regards.
You could use this


    background: url(https://i.imgur.com/{$userfields['fidX']}) center center no-repeat #292929;

XTounguerofile Field Fid number


Example
If users want to add this image for background
https://i.imgur.com/llPZGk5.png

they have to add only this in text field
llPZGk5.png
(2020-05-11, 05:38 PM)Mastersly Wrote: [ -> ]You could use this


    background: url(https://i.imgur.com/{$userfields['fidX']}) center center no-repeat #292929;

XTounguerofile Field Fid number


Example
If users want to add this image for background
https://i.imgur.com/llPZGk5.png

they have to add only this in text field
llPZGk5.png

It's currently how I am running it, is it the best solution?
I am using this method for profile background
https://inlobos.com/User-lobos

and for forums header
https://inlobos.com/Forum-Announcements-Updates


Check this tutorial
https://community.mybb.com/thread-227718.html
You only have to make some changes in this code and use it for postibt background
(2020-05-11, 06:02 PM)Mastersly Wrote: [ -> ]I am using this method for profile background
https://inlobos.com/User-lobos

and for forums header
https://inlobos.com/Forum-Announcements-Updates


Check this tutorial
https://community.mybb.com/thread-227718.html
You only have to make some changes in this code and use it for postibt background

Nice tutorial, perhaps I will implant that in the future!
The hardest is to get the proper ReGex. Not using a proper ReGex could open your board to unwanted results.

Try the following:
(https:)\/\/i\.imgur\.com\/\w+\.(png|jpe?g|gif)
https://regexr.com/54dn3
(2020-05-12, 08:33 AM)Omar G. Wrote: [ -> ]The hardest is to get the proper ReGex. Not using a proper ReGex could open your board to unwanted results.

Try the following:
(https:)\/\/i\.imgur\.com\/\w+\.(png|jpe?g|gif)
https://regexr.com/54dn3

Cheers, it works. 
I'm not a regex champ and that website will definitely help me!