xwp / stream

🗄️ Stream plugin for WordPress
https://wordpress.org/plugins/stream/
GNU General Public License v2.0
405 stars 119 forks source link

Dynamic callback function name cannot include hyphens #1468

Open shadi-sharaf-nuk opened 7 months ago

shadi-sharaf-nuk commented 7 months ago

Bug Report

Dynamic callback methods in custom connectors, eg: callback_ACTION_NAME cannot have hyphens in their method name, however the callback discovery routine does not convert hyphens to an underscore, hence connectors cannot target actions with hyphens like load-xxx_xxx unless they override the callback method and target the action manually.

Expected Behavior

For an action like load-something, I should be able to use callback_load_something to log that action.

Actual Behavior

I can't use a dynamic callback to target that action, only way is to override the callback method.

System Information

shadi-sharaf-nuk commented 7 months ago

Hey @schlessera @kasparsd, trying to issue a PR against this issue, but seems like external contributions might be disabled?

image
kasparsd commented 7 months ago

@shadi-sharaf-nuk Can you please link to the branch you're creating the pull request from? I'm seeing external pull request being created very recently such as #1462.

shadi-sharaf-nuk commented 7 months ago

@kasparsd That's the branch: https://github.com/xwp/stream/compare/xwp:master...shadyvb:fix/1468-dynamic-callback-format?expand=1

kasparsd commented 7 months ago

Interesting. This is what I'm seeing -- looks like it would allow me to create a pull request:

pr

Can you please share what you are seeing?

shadi-sharaf-nuk commented 7 months ago

I'm seeing the same as you, but when I submit, I see the error I attached above 🤷

Unsure if this is related to me being a previous contributor maybe?

shadyvb commented 7 months ago

My bad, I stupidly was trying to create the PR from another GitHub account who doesn't have access to my fork 🤦 Sorry for the confusion.