admin管理员组

文章数量:1122846

I hope someone can help or had the same problem, because I don't know how to get to a solution.

I am trying to customize the registration email of new users, where the password set link is. For the whole customization, I use a "template" from codewp. My problem is that i can't get the user_activation_key into the url and I don't know why. I tried several things but now I don't know what to do anymore.

When I leave it as it is in the template, I get the username but not the key. $message .= "<a $link_style href='" . network_site_url( "change-password/?wpforo=resetpassword&rp_key=". rawurlencode( $user->user_activation_key ), 'key' . " &login=" . rawurlencode( $user->user_login ), 'login' ) . "'>" . __( 'Set Your Password' ) . "</a>"; Here the URL i get from this:

Then I tried doing it the same way for the password, as they did for the login in the code: $message .= "<a $link_style href='" . network_site_url( "change-password/?wpforo=resetpassword&rp_key=rp&key=$user->user_activation_key&login=" . rawurlencode( $user->user_login ), 'login' ) . "'>" . __( 'Set Your Password' ) . "</a>";

Here, I got nothing back.

I am very new to "coding" so there's probably some easy fix but I can't find a solution.

Thank a lot in advance! Markus

The Function in wpforo:

function wpforo_lostpassword_url( $redirect_to = null ) { if( wpforo_setting( 'authorization', 'lost_password_url' ) ) { $lostpassword_url = trim( (string) get_bloginfo( 'url' ), '/' ) . '/' . ltrim( (string) wpforo_setting( 'authorization', 'lost_password_url' ), '/' ); } else { if( wpforo_setting( 'authorization', 'use_our_lostpassword_url' ) ) { $lostpassword_url = wpforo_url( wpforo_get_redirect_to_url_path( $redirect_to ), 'lostpassword' ); } else { if( is_null( $redirect_to ) ) $redirect_to = wpforo_get_redirect_to(); $lostpassword_url = wp_lostpassword_url( $redirect_to ); } } $lostpassword_url = apply_filters( 'wpforo_lostpassword_url', $lostpassword_url ); return esc_url_raw( $lostpassword_url ); }

I hope someone can help or had the same problem, because I don't know how to get to a solution.

I am trying to customize the registration email of new users, where the password set link is. For the whole customization, I use a "template" from codewp. My problem is that i can't get the user_activation_key into the url and I don't know why. I tried several things but now I don't know what to do anymore.

When I leave it as it is in the template, I get the username but not the key. $message .= "<a $link_style href='" . network_site_url( "change-password/?wpforo=resetpassword&rp_key=". rawurlencode( $user->user_activation_key ), 'key' . " &login=" . rawurlencode( $user->user_login ), 'login' ) . "'>" . __( 'Set Your Password' ) . "</a>"; Here the URL i get from this:

Then I tried doing it the same way for the password, as they did for the login in the code: $message .= "<a $link_style href='" . network_site_url( "change-password/?wpforo=resetpassword&rp_key=rp&key=$user->user_activation_key&login=" . rawurlencode( $user->user_login ), 'login' ) . "'>" . __( 'Set Your Password' ) . "</a>";

Here, I got nothing back.

I am very new to "coding" so there's probably some easy fix but I can't find a solution.

Thank a lot in advance! Markus

The Function in wpforo:

function wpforo_lostpassword_url( $redirect_to = null ) { if( wpforo_setting( 'authorization', 'lost_password_url' ) ) { $lostpassword_url = trim( (string) get_bloginfo( 'url' ), '/' ) . '/' . ltrim( (string) wpforo_setting( 'authorization', 'lost_password_url' ), '/' ); } else { if( wpforo_setting( 'authorization', 'use_our_lostpassword_url' ) ) { $lostpassword_url = wpforo_url( wpforo_get_redirect_to_url_path( $redirect_to ), 'lostpassword' ); } else { if( is_null( $redirect_to ) ) $redirect_to = wpforo_get_redirect_to(); $lostpassword_url = wp_lostpassword_url( $redirect_to ); } } $lostpassword_url = apply_filters( 'wpforo_lostpassword_url', $lostpassword_url ); return esc_url_raw( $lostpassword_url ); }

Share Improve this question edited Jun 18, 2024 at 11:48 Markus Pfister asked Jun 18, 2024 at 6:06 Markus PfisterMarkus Pfister 11 bronze badge 2
  • Can you post text please and not images? You can use code formatting (backticks) or block quotes ( > ) to make it stand out. – Rup Commented Jun 18, 2024 at 8:04
  • Sorry, didn't know how to do it properly. Should be right now. – Markus Pfister Commented Jun 18, 2024 at 10:02
Add a comment  | 

1 Answer 1

Reset to default 0

I have no idea how this plays with wpForo, but in the standard reset flow rp_key is extracted from the password reset cookie. See wp-login.php:

$rp_cookie = 'wp-resetpass-' . COOKIEHASH;
if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
    list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );

You'd have to look at the wpForo code or ask them for help / documentation if they do something different.

本文标签: wp user queryEmail CustomizationCan39t get useractivationokey