oidc-wp / openid-connect-generic

WordPress plugin to provide an OpenID Connect Generic client
https://wordpress.org/plugins/daggerhart-openid-connect-generic/
261 stars 155 forks source link

Shortcodes Not Properly Configured for All Supported Attributes #534

Open eberhapa opened 7 months ago

eberhapa commented 7 months ago

Hi,

You are passing $atts to get_authentification_url() in make_login_button() but everything beside button_text is removed from $atts. So If I do the shortcode like that: [openid_connect_generic_login_button button_text="Über Learnlinked anmelden" redirect_to="test"] and check $atts in make_login_button() everything is fine. When I check $atts in get_authentification_url() only button_text is there. Could you add all attributes in make_login_button() to make it work? All the best, Patrick

eberhapa commented 7 months ago

I tried you other shortcode do_shortcode('[openid_connect_generic_auth_url redirect_to="' . home_url() . '/jobboerse"]') and found that the redirect isn't working at all. I'm always redirected to the page where the login button/link is.

timnolte commented 7 months ago

I'm not sure if WordPress Core changed the shortcode_atts function at some point, though I suspect when the shortcodes were added there was an incorrect understanding of how the function worked. Basically, the call to shortcode_atts is not supplying all the supported attributes, with default values, in the first argument. This needs to be fixed.

See: https://developer.wordpress.org/reference/functions/shortcode_atts/

timnolte commented 7 months ago

Relevant lines to be fixed:

eberhapa commented 7 months ago

No problem. Thank you :)

And whats with the do_shortcode('[openid_connect_generic_auth_url redirect_to="' . home_url() . '/jobboerse"]') issue? The attribute is correct there but the redirect isn't working.

eberhapa commented 6 months ago

Any news on that?