2014-03-30, 07:02 PM
Guys Is there a code that can count how many times user got error message on the same page?
Count errors PHP
|
2014-03-30, 07:02 PM
Guys Is there a code that can count how many times user got error message on the same page?
2014-04-01, 11:48 AM
Please anyone how can I count how many times error message showed!
Maybe update something every time error shows like:
What type of error are you looking at counting?
PHP errors, I'm not sure about, you could always use a service like New Relic to monitor them. If you're wanting to monitor calls to the error() function, there is a plugin hook there that you can use to do something like logging the user+message or something:
Thanks buddy I am trying to create a plugin that will block users for X hours if they get 5 errors during creating of new thread! Something similar to login attempt redirect!
The plugin I have basically checks for URLs in posts and if it finds one it returns inline error you know the error shows on the same page!
2014-04-01, 03:39 PM
This user has been denied support.
There is a Hook in the function error.$plugins->add_hook('error', 'logger'); However, i don't think this is what you need. What kind of errors you wish to log? ALL ERRORS or only those which redirect you to a new page that is handled by mybb's error function? If you to log those errors that cause redirection, then the above hook will work for you. just create a function:
Then you can place a global hook to check if the cookie's value is > 5. I hope i helped
2014-04-02, 01:05 AM
(2014-04-01, 03:04 PM)marcus123 Wrote: Thanks buddy I am trying to create a plugin that will block users for X hours if they get 5 errors during creating of new thread! Something similar to login attempt redirect! Checking if error() was called during thread creating seems like a bit of a roundabout way of doing it, why not make the code part of the actual URL-checking plugin instead of trying to monitor its output?
2014-04-02, 05:25 AM
This user has been denied support.
I read your post again, looks like you are talking about inline errors. So just hook into some Newthread hook and use the code i gave above.Also, please add $count++. I forgot to add it, to increment your errors
2014-04-02, 11:48 AM
Thanks you so much yeah I am talking about inline errors! Please where do I add this "$count++" and how to make this code block people after they get 5 inline errors?
2014-04-03, 02:07 PM
This user has been denied support.
Damn Marcus! You need to learn baby!Here:
Now, this function will log your error count in the cookie "myplugin_errors". Therefore you can check anywhere this conditon: if($mybb->cookies['myplugin_errors'] > 5) { /* Go to hell, User */ }
Thanks very much man I am sorry for being so dumb with PHP but I am learning it on my own. Your help is very appreciated
How do I implement your code into mine?
|
« Next Oldest | Next Newest »
|