Jump to content

Search the Community

Showing results for tags 'user profile'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


WHMCS.Community

  • WHMCS Beta Program
    • WHMCS 9.0 RC Discussion
  • WHMCS.Community
    • Community Announcements
    • Introduce Yourself
    • MarketConnect Partner Product Status Updates
  • Using WHMCS
    • Pre-Sales Questions
    • Admin & Configuration Questions
    • Installation, Upgrade, and Import Support
    • Using WHMCS
    • Troubleshooting Issues
    • Vendor Discussions
  • WHMCS Showcase
    • Showcase Your Site
    • Share Your Best Practices & Tips
  • Developing & Extending WHMCS
    • Third Party Add-ons
    • Service Offers & Requests
    • Developer Corner
    • Building Modules
    • Share Ideas for WHMCS Modules
  • Community Competitions
    • News, Announcements & Blogs from WHMCS
    • Competitions
  • General Discussions
    • General Discussion
  • General Feedback & Assistance
    • Feedback
    • WHMCS.Community Tips & Tricks
  • Third Party Developers's Topics
  • Turkish International Discussions's Topics
  • Russian International Discussions's Topics
  • Spanish International Discussions's Topics
  • Portuguese International Discussions's Topics
  • French International Discussions's Topics
  • Italian International Discussions's Topics
  • German International Discussions's Topics
  • WHMCS Brasil's Topics
  • WHMCS Brasil's Tópicos
  • ModulesGarden Club's Topics
  • Hungarian International Discussions's Segítség
  • ThemeMetro's Topics
  • WHMCS Services Club's Topics
  • WHMCS Global Services Club's Topics
  • Katamaze's Free Scripts
  • Katamaze's Module Support
  • Zomex Club's Topics
  • 0100Dev Club's Topics
  • RactStudio Club's Topics

WHMCS Version

  • V8.13.x Hotfixes
  • V8.12.x Hotfixes
  • V8.11.x Hotfixes

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 1 result

  1. I want to validate the user profile input <firstname & lastname> so that I can sanitize what the user saves as their firstname and lastname in their profiles to avoid saving them with phishing links, and then use WHMCS to spam user invite emails. I have tried to use the ClientDetailsValidation hook but it is triggered when the client details are updated in the Client Area or Admin Area. The changes in the profile details are not validated using this hook. This is the sample code for ClientDetailsValidation. <?php add_hook('ClientDetailsValidation', 1, function($vars) { $input = $vars['firstname'] . ' ' . $vars['lastname'] . ' ' . $vars['companyname']; // pattern of phishing links or any other malicious content $pattern = '/(http|https):\/\/[^\s]*/i'; if (preg_match($pattern, $input)) { // If the input contains a URL, return an error message return array('The first name, last name, and company name cannot contain URLs.'); } }); The other closest available option, is to use UserEdit hook, but it triggers after the user details have been edited, which might be too late for preventing harmful data from being saved. This is the sample code for UserEdit hook. <?php add_hook('UserEdit', 1, function($vars) { $input = $vars['firstname'] . ' ' . $vars['lastname'] . ' ' . $vars['email']; $pattern = '/(http|https):\/\/[^\s]*/i'; if (preg_match($pattern, $input)) { logActivity('The first name, last name, and email cannot contain URLs.', $vars['user_id']); } }); The logActivity function can be used to log the error in activity log, which can be viewed in the Admin Area. However, it won't prevent the changes from being saved or notify the user of the error. I am reaching out to this community in the hope that someone might have encountered a similar challenge or have insights into how I can validate user profile details before they are saved. Any suggestions, advice, or shared experiences would be greatly appreciated.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated