surveyjs / surveyjs-wordpress

Example of integration SurveyJS: Survey Library and Survey Creator into WordPress
https://wordpress.org/plugins/surveyjs/
36 stars 18 forks source link

Back button returns user to potentially wrong admin URL. #25

Open plutotom opened 2 years ago

plutotom commented 2 years ago

The back button on pages, Edit, Results, and Clone returns the user to a URL that is hardcoded as <button onclick="window.location = '/wp-admin/admin.php?page=sjs-main-menu'">&lt&nbspBack</button>

Removing styling from button for readability.

I believe this would be a more dynamic way of returning the user to the admin page.

<button onclick="window.location = '<?php echo get_admin_url() ?>?page=sjs-main-menu'">&lt&nbspBack</button>

I bring this up because if a developer is working in a development environment then they may have a URL that looks like localhost/wordpress/site2/wp-admin/admin.php?page=sjs-main-menu as opposed to assuming the URL: localhost/wp-admin/admin.php?page=sjs-main-menu.

The problem is that in the current implementation of onclick="window.location = '/wp-admin/ will return the user to the URL localhost/wp-admin/ every time, even if it should return them to the URL localhost/wordpress/site2/wp-admin/.

tsv2013 commented 2 years ago

Thank you for the feedback. We'll take it in account during future plugin improvements.