Problem with eventsmanagerpro activation

I’ve had a look at the website and had the same problems. But no solution…sorry.

The only error I could see was in Chrome (and Opera fwiw):

Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'same-origin', 'strict-origin', 'strict-origin-when-cross-origin', or 'unsafe-url'. The referrer policy has been left unchanged.

I added

Header set Referrer-Policy "origin"

to .htaccess but this made no difference.

I did not get this error in Firefox.

I wonder if the problem could somehow be related to how the license key is hashed and stored in the database? Probably unlikely. James might be able to thrown some light on this.

@baterista would you be able to contact the developer to ask if there’s anything unusual in how it’s stored? Also, I can’t remember if you’ve already tried this but you could delete that particular key and request another one? Maybe the problem is at their end because everything certainly looks tickety-boo at the CP end.

OK, finally got to the bottom of this one. I consulted the oracle (@james) and he provided the solution.

This is a problem that has cropped up before with premium plugins as you can see at Send a User-Agent header that looks more like WordPress by nylen · Pull Request #361 · ClassicPress/ClassicPress · GitHub and is related to the User-Agent header. In this case, it appears that EMP is expecting requests to come from WordPress and throws a tantrum if it doesn’t.

The solution (as provided by James) is to add the following code either to a MU plugin or to functions.php:

function restore_wp_user_agent() {
    return 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' );
}
add_filter( 'http_headers_useragent', 'restore_wp_user_agent' );

After adding this, the license activated straight away.

James may want to clarify further.

3 Likes

It would make sense if the events people updated their key server code to look for wordpress or classicpress rather than people having to hack the useragent. Have you approached them at all?

3 Likes

Agreed. We only discovered what the issue is within the last hour so haven’t had chance to contact the dev yet but it’s certainly on the cards.

3 Likes

A big big thank you guys for resolving this issue. As I am still in contact (PM) with the head of dev Marcus I could send him this request if you want me to .
Let me know.

Thank you again :pray:

3 Likes

Yes, that would be great @baterista. Thanks very much.

2 Likes

The issue appears to be that Events Manager Pro is trying to pull the site URL out of the User-Agent header sent by the site. Since ClassicPress doesn’t send the site URL here (this is on purpose, to remove unnecessary tracking), this won’t work for ClassicPress sites.

Ideally Events Manager Pro should be sending the site URL in a separate field instead, and their server should read it from there. Otherwise people will have to use a small compatibility plugin that contains something like the above code (or potentially a more specific version that only takes effect when a request is going out to this particular server).

@baterista it may be easiest to just send their developer a link to this thread.

3 Likes

I did send an email to Marcus where I did copy the part that James wrote above into it. And also I invited him to have a look at this thread to get all infos.
Let’s see what his respons will be.
I’ll keep you informed.

6 Likes

Hi Everyone! First post in the CP community :wink:

Thanks for looking into this. I’ll check with @baterista about this because we do actually supply the site URL and use it if the User-Agent header isn’t there…

4 Likes

Also, just noticed the thread by @ozfiddler regarding being an officla ‘CP-Compatible’ plugin. That’d be interesting to consider for sure. Happy to post in a new thread, but just needed to know two basic questions:

  1. What’s the minimum WP version you require for this to work on? Generally, we don’t use the latest stuff they add (because we don’t need it) but things like Gutenberg is something we’re working on but can work alongside the classic editor too.

  2. Is there a seperate CP repo to work with here?

Any of the CP devs/heads are welcome to get in touch.

Cheers,
Marcus

4 Likes

Hi Marcus and welcome to ClassicPress :slight_smile:

As mentioned above, I took quite a long look at @baterista’s site and only managed to get it working by adding the User-Agent header. This would obviously suggest that the site URL wasn’t get through for some reason.

I wonder if the easiest thing would be for you to set up your own ClassicPress dev site, as you understand what should and should not be happening at both ends? You can download CP from here and install it in the same way as WordPress.

Alternatively, would it be possible for you to provide us with a trial license of EMP so we can do our own, more in-depth testing?

Thanks

2 Likes

Hi Tim,

Yes, that did strike me as odd that both methods failed. Is there a User-Agent getting sent at all with ClassicPress?

Elmar has mentioned he has a demo going with the issue, so that might be the fastest way to check it out, otherwise, I’m also happy to take a look myself when time permits and also see CP in action whilst I’m at it.

I am, however, happy to provide you with a trial license regardless if you’d like one, let me know if need be.

2 Likes

With the following code added to a MU plugin or functions.php:

'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' );

ClassicPress should be sending something like:

WordPress/4.9.12; https://www.example.com

and this certainly worked for Elmar’s site.

It’d be good if you could test it as you’ll be able to see what headers and/or POST data are being received but if you could let me have a trial license, then I’m happy to continue playing from this end. Let me know if you need a specific domain for the license.

1 Like

Yes, but I think we don’t need a custom snippet to make it work. We also send the site url in our POST call to the site, so it should fall back on that with no header (or a non-matching header).

The header is used first because in earlier versions we didn’t send via post, but I’m pretty sure Elmar is on a latest version. I just need to figure out what post info is being sent when on CP, maybe something’s wrong with the URL passed on, maybe it’s even a bug on our side:

$args = array(
	'action' => $action,
	'v' => static::$current_versions,
	'key' => static::get_license()->key,
	'site' => get_home_url(),
	'ms' => is_multisite(),
);
...
$request = wp_remote_post( $url, array( 'body' => $args ) );

Can you email me so I can set you up with a trial account? You can register a site via the plugin.

2 Likes

Thats right! All plugins are up2date.

2 Likes

I’ll DM you.

1 Like

Just confirming, yes there is. Here is an example value:

WordPress/4.9.12; https://www.classicpress.net/?wp_compatible=true&ver=1.1.1

That’s why it isn’t working, in ClassicPress there is a User-Agent header, but it’s always pointing to www.classicpress.net. So I think you’ll want to use the site URL that you supply instead. Or, if you want an option that is less of a change from what you’re already doing, you could use some logic like the following:

  • if User-Agent header is present and contains a www.classicpress.net URL, do not use it.
  • if User-Agent header is present and contains a URL that is not www.classicpress.net you can use it.
  • otherwise, use the URL you supplied.

Regarding being an “official CP-compatible plugin”:

ClassicPress is based on WP 4.9 so that would be the only version requirement. If your plugin works on the WP 4.9 releases then it should work on ClassicPress also, except for very rare exceptions like the User-Agent thing we discovered here.

I assume you mean a plugin repo. We’re launching a plugin directory with our in-development v2 release (not a repo, because plugins will be hosted by the authors on GitHub).

For now we would just be adding you to the list at Plugins Confirmed Working on ClassicPress v1 but it sounds like you will be well-positioned for our v2 release and beyond.

If you have any other questions we’ll be here…

3 Likes

There’s not really an “official” list, but we do maintain a wiki here: "Must Have" Plugins List

This has the current best options for the most-needed broad plugin types (including those developers who have made a firm commitment). I have added yours with a blue tick, but will change it to a green tick when we get this issue resolved. It would be great to get fully-featured events manager on board. Thanks for your interest.

3 Likes

@james, awesome, thanks for the reply!

@ozfiddler I’ll email you the details.

2 Likes

Hi Everyone, happy to announce that the issue should now be resolved!

Events Manager + Pro + ClassicPress seems to be working fine now. I’ve edited the wiki list accordingly.

4 Likes