bp_verify_nonce_request() not working
-
bp_verify_nonce_request() function not working when a user registering first time. But its working at least one time he/she logged in. file bp_members_screens.php. line no: 100.
-
When you say it isn’t working, can you provide more details?
actually I changed that line “} elseif ( isset( $_POST[‘signup_submit’] ) && bp_verify_nonce_request( ‘bp_new_signup’ ) ) {” to this “} elseif ( isset( $_POST[‘signup_submit’] ) || bp_verify_nonce_request( ‘bp_new_signup’ ) ) {“. Now its working and my site on https. I don’t know that is the problem.
Thanks Henry
You shouldn’t change core files. Each time you upgrade BuddyPress your changes will be lost.
Yes I know that. But what is the solution. I don’t know the problem with https or not. But its working perfectly once I logged in.
Yes I know that. But what is the solution
I’m not really sure from the info you’ve provided. You’ll need to provide a more detailed outline of the problem.
We have just finished up with a WP project with a BuddyPress module to it, and the site is in https status. As it is a unique offering, the client have strictly forbidden us from sharing the url as the launch is around the corner. ( which makes it all the more frustrating from our point of view).
The issue is, a Fresh User cannot login and register to become a registered user from any device. But, the moment an EXISTING user logs into the Community module – say from the same laptop and logs out, the earlier prospective user now finds no problem in registering and creating a profile !
Pls help.
@nithin270 this shouldn’t be happening. To debug this your best bet is to deactivate all plugins, revert to TwentyFifteen and remove all custom code you have in functions.php. Then, one-by-one, activate each of your plugins, checking each time if the problem is introduced. This trial-and-error approach should hopefully allow you to find the culprit.
The same code working without any problem in my localhost and http server, problem only with https.
Anyone facing same issue??? please help!
Look at
bp_verify_nonce_request
in this file:
bp-core\bp-core-functions.phpTry writing the results of each step to a log so you get more info on the data being both received and parsed. And thereby find the failure point.
Hello All,
I am also facing the same problem with bp_verify_nonce_request() function.
It proper works on my Localhost but on my live server its not working properly
In File : bp-members-screen.php file
} elseif ( isset( $_POST[‘signup_submit’] ) && bp_verify_nonce_request( ‘bp_new_signup’ ) ) {this will not work.. but if i will replace the above code with the below code then it will work
Below code will work properly
} elseif ( isset( $_POST[‘signup_submit’] ) || bp_verify_nonce_request( ‘bp_new_signup’ ) ) {I know that if i will make changes in Buddypress core files then after update my changes will be lost.
Is any Hook are available so that i can use in my functions.php file.
Please help me someone. Its urgent and i want to complete my project as soon as possible.Thanks
@nithin270 @dineshravajani07 – Please help us debug
bp_verify_nonce_request()
:
https://buddypress.trac.wordpress.org/browser/tags/2.3.1/src/bp-core/bp-core-functions.php#L2005Judging by what you are doing, it appears that function is returning false.
Can you debug that function and find out whereabouts the function is failing for you?
Are your sites behind a reverse proxy?
Ya on my live server it returns me “False” value, but on my localhost it returns “True” and works very well.
I am worried about this issue.
Can anyone please help me regarding this issue.
@dineshravajani07 – Are you able to debug whereabouts in the function it is returning false?
Can you add this line before the
// Nonce check failed
line in thebp_verify_nonce_request()
function located in/bp-core/bp-core-functions.php
:var_dump( $result, $action, strpos( $matched_url, $home_url ) !== 0 );
Run the function and then let us know what the output is.
Hi,
When i placed var_dump( $result, $action, strpos( $matched_url, $home_url ) !== 0 );
It gives me the following output
int(1) string(13) “bp_new_signup” bool(true)
So this is how my code looks like.
// Check the nonce
$result = isset( $_REQUEST[$query_arg] ) ? wp_verify_nonce( $_REQUEST[$query_arg], $action ) : false;var_dump( $result, $action, strpos( $matched_url, $home_url ) !== 0 );
// Nonce check failed
if ( empty( $result ) || empty( $action ) || ( strpos( $matched_url, $home_url ) !== 0 ) ) {
$result = false;
}var_dump( $result, $action, strpos( $matched_url, $home_url ) !== 0 );
===============================================
I had placed var_dump() before IF condition and also after IF Condition.It returns me like that
int(1) string(13) “bp_new_signup” bool(true)
bool(false) string(13) “bp_new_signup” bool(true)
@dineshravajani07 – Thanks for the debugging so far.
Can you add this line:
var_dump( $matched_url, $home_url );
Above the
// Nonce check failed line
and post the results?When i placed your code “var_dump( $matched_url, $home_url );”
Above the // Nonce check failed line then it gives me below outputstring(59) “http://180.211.110.195:8082:8082/greenbc-new/registrierung/”
string(39) “http://180.211.110.195:8082/greenbc-new”Actually the problem which i am facing with my project is that on Registration Page, if i directly submit the form then it is not displaying any validation error, it is because the
bp_verify_nonce_request() returns me the false value.@dineshravajani07 – Thanks! We’re getting somewhere!
Under the
/** Requested URL *****
section, can you change:if ( isset( $parsed_home['port'] ) ) { $request_host = $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'];
to:
if ( isset( $parsed_home['port'] ) ) { $request_host = $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
I have a feeling that will fix things for you.
Ya it works very well.
Thank you so much.
But now 1 question arise is that right now i had changed my code manually in bp-core-functions.php file but when i will update my buddypress plugin ,i think that my changes will be erased.
so is that any hook or actions are available so that i can use that hook in my theme functions.php file.
Many Thanks so far.
I’ve created a ticket about this bug here:
https://buddypress.trac.wordpress.org/ticket/6528This should be fixed for v2.4, which is tentatively scheduled for an autumn release.
In the meantime, you could use the
'bp_verify_nonce_request_url'
filter to remove the double port number, which should temporarily fix the issue.
- The topic ‘bp_verify_nonce_request() not working’ is closed to new replies.