superjojo2001
Forum Replies Created
-
Hello again,
I’ve prepared a Virtual Machine (runs via Oracle VM VirtualBox) with a fully configured Ubuntu 24.04 system. It includes:
- Apache2 web server
- WordPress 6.8
- Moodle 5.0
- Edwiser 4.0.0 plugins installed for both WordPress and Moodle
However, even in this setup, the Edwiser Wizard is still unable to establish communication between the two applications running on the same linux machine.
This VM can be used to test the setup on any Windows PC worldwide. I can provide a download link for the VM image along with the user credentials for Ubuntu, WordPress, and Moodle.
Would it be okay if I send this information to [email protected]?
Best regards,
ArminAssuming I set up a virtual machine on a Windows system with a fresh Ubuntu 24.xx installation, and walked you through the roughly 20 Linux commands required to install WordPress and Moodle and Edwiser plugins — and assuming I could reproduce the exact same issue in that environment — my question is: would you be able to run such a VM on your end to verify it?
If not, there’s no point in me investing time in preparing this setup.
Please advise.
And I’m not sure if you’ve noticed, but Moodle 5.0 was released two days ago.
Since older versions will be reaching end-of-support, I’ll be moving forward with the installation of Moodle 5.0.Regards
ArminNevertheless to the missing code in your post, I went back to add troubleshooting code in line 177 and line 188 and click “Troubleshoot” this time. (have not recognized that I have to click it also)
Here is the result:
[12-Apr-2025 03:45:48 UTC] $internal_response:
[12-Apr-2025 03:45:48 UTC] {"headers":{},"body":"{\"namespace\":\"edwiser-bridge\",\"routes\":{\"\\/edwiser-bridge\":{\"namespace\":\"edwiser-bridge\",\"methods\":[\"GET\"],\"endpoints\":[{\"methods\":[\"GET\"],\"args\":{\"namespace\":{\"default\":\"edwiser-bridge\",\"required\":false},\"context\":{\"default\":\"view\",\"required\":false}}}],\"_links\":{\"self\":[{\"href\":\"https:\\/\\/lms.wordpress.local\\/wp-json\\/edwiser-bridge\"}]}},\"\\/edwiser-bridge\\/wisdmlabs\":{\"namespace\":\"edwiser-bridge\",\"methods\":[\"POST\",\"PUT\",\"PATCH\"],\"endpoints\":[{\"methods\":[\"POST\",\"PUT\",\"PATCH\"],\"args\":[]}],\"_links\":{\"self\":[{\"href\":\"https:\\/\\/lms.wordpress.local\\/wp-json\\/edwiser-bridge\\/wisdmlabs\"}]}}},\"_links\":{\"up\":[{\"href\":\"https:\\/\\/lms.wordpress.local\\/wp-json\\/\"}]}}","response":{"code":200,"message":"OK"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}}
[12-Apr-2025 03:45:48 UTC] $response:
[12-Apr-2025 03:45:48 UTC] {"errors":{"http_request_failed":["A valid URL was not provided."]},"error_data":[]}If I decode the body of the “$internal_response” it comes to
{
"namespace": "edwiser-bridge",
"routes": {
"/edwiser-bridge": {
"namespace": "edwiser-bridge",
"methods": [
"GET"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"namespace": {
"default": "edwiser-bridge",
"required": false
},
"context": {
"default": "view",
"required": false
}
}
}
],
"_links": {
"self": [
{
"href": "https://lms.wordpress.local/wp-json/edwiser-bridge"
}
]
}
},
"/edwiser-bridge/wisdmlabs": {
"namespace": "edwiser-bridge",
"methods": [
"POST",
"PUT",
"PATCH"
],
"endpoints": [
{
"methods": [
"POST",
"PUT",
"PATCH"
],
"args": []
}
],
"_links": {
"self": [
{
"href": "https://lms.wordpress.local/wp-json/edwiser-bridge/wisdmlabs"
}
]
}
}
},
"_links": {
"up": [
{
"href": "https://lms.wordpress.local/wp-json/"
}
]
}
}Does it help?
You are writing to test a code, but I can’t find it in your post. It might be forgotten, or?
Thanks
ArminI continued my tests and inserted one more error_log()
public function connection_test_initiater() {
error_log('connection_test_initiater() called');
// verifying generated nonce we created earlier.
if ( ! isset( $_POST['_wpnonce_field'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce_field'] ) ), 'check_sync_action' ) ) {
die( 'Busted!' );
}
// start working on request.
$url = isset( $_POST['url'] ) ? sanitize_text_field( wp_unslash( $_POST['url'] ) ) : '';
$token = isset( $_POST['token'] ) ? sanitize_text_field( wp_unslash( $_POST['token'] ) ) : '';
$connection_helper = new Eb_Connection_Helper( $this->plugin_name, $this->version );
$response = $connection_helper->connection_test_helper( $url, $token );
echo wp_json_encode( $response );
error_log(wp_json_encode( $response));
die();
}Then I watched my debug file again. It says
[10-Apr-2025 14:56:22 UTC] connection_test_initiater() called
[10-Apr-2025 14:56:22 UTC] {"success":0,"response_message":"
\n
\n Test Connection failed, To check more information about issue click here <\/span>.\n <\/div>\n\n
\n \t
\n\t
\n\t An issue is detected. <\/h4>\n\t
\n\t \t
Status : <\/b><\/div>\n\t \t
Connection Failed <\/div>\n\t <\/div>\n\t
\n\t \t
Url : <\/b><\/div>\n\t \t
https:\/\/lms.moodle.local\/webservice\/rest\/server.php?wstoken=2f73e220ba27271267ecf26a48156eef&wsfunction=auth_edwiserbridge_test_connection&moodlewsrestformat=json<\/div>\n\t <\/div>\n\t
\n\t \t
Response : <\/b><\/div>\n\t \t
A valid URL was not provided.<\/div>\n\t <\/div>\n\t\t\t\t\t\t\t\t\t
\n\t \t
Click Troubleshoot <\/strong> button to get more details.<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t <\/div>\n\n\t
\n\t\t\t\t\t\t\t\t\t<\/span> \n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t
\n <\/div>\n <\/div>"}I want to follow your idea of changing wordpress edwiser plugin code. I extended the following line in
edwiser-bridge/admin/class-eb-settings-ajax-initiater.php
public function connection_test_initiater() {
error_log('connection_test_initiater() called');
// verifying generated nonce we created earlier.
if ( ! isset( $_POST['_wpnonce_field'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce_field'] ) ), 'check_sync_action' ) ) {
die( 'Busted!' );and I also edited the following line
public function check_valid_json_response() {
error_log('check_valid_json_response() called');
// verifying generated nonce we created earlier.
if ( ! isset( $_POST['_wpnonce_field'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce_field'] ) ), 'check_sync_action' ) ) {
wp_send_json_error();
}
// start working on request.
$url = isset( $_POST['url'] ) ? sanitize_text_field( wp_unslash( $_POST['url'] ) ) : '';Then I clicked on your “Test Connection” button in Edwiser plugin afterwards and I was looking to my ./wp-content/debug.log file
It says[10-Apr-2025 14:40:36 UTC] connection_test_initiater() calledThere is no indication that
check_valid_json_response()was called at all.Thank you for your proposal.
There is one thing I need to understand and this is why I am repeating what I wrote yesterday
- I am opening my Chrome web browser (this has nothing to do with WordPress and works independently)
- I am entering the following URL line to the address bar (to simulate access to moodle service) https://lms.moodle.local/webservice/rest/server.php?wstoken=2f73e220ba27271267ecf26a48156eef&wsfunction=auth_edwiserbridge_test_connection&moodlewsrestformat=json
- This line accesses the web server in Moodle directly and should address ediser plugin in moodle and this access does not use any WordPress code since all runs in my Chrome browser
- Then I get back the following textual response in the Chrome browser
{"exception":"core\\exception\\invalid_parameter_exception","errorcode":"invalidparameter","message":"Invalid parameter value detected"}
But now you are writing that I have to change source code in WordPress in order to debug Moodle web services. Should we not rather see why the simple combination of Chrome and with Moodle does not work?
Hello,
The two specified URLs are only accessible within my local home network.
The Ubuntu server, where both applications are installed and running under Apache2, has the local IP address 192.168.30.40. On my home DNS server, I configured the hostnames lms.wordpress.local and lms.moodle.local to resolve to this IP address. Therefore, it is of course expected that these URLs are not reachable from the internet by you.
The Apache server is functioning correctly, as I can access the WordPress admin interface via lms.wordpress.local and the Moodle admin interface via lms.moodle.local without any issues.
Additionally, when accessing the local server via the following URL:
https://lms.moodle.local/webservice/rest/server.php?wstoken=2f73e220ba27271267ecf26a48156eef&wsfunction=auth_edwiserbridge_test_connection&moodlewsrestformat=json
the browser returns the following JSON-formatted response coming from Moodle web server interface:{"exception":"core\\exception\\invalid_parameter_exception","errorcode":"invalidparameter","message":"Invalid parameter value detected"}This response clearly indicates that both Apache2 and the Moodle installation are functioning correctly and the web server interface is active. If Apache2 were misconfigured or Moodle were not properly set up, the browser would not return a structured error message—instead, it would result in a timeout or connection error.
If I call the same command with an invalid token, the response is
{"exception":"core\\exception\\moodle_exception","errorcode":"invalidtoken","message":"Invalid token - token not found"}To demonstrate that my Moodle instance is functioning properly and also my token ist correct, I verified the same Moodle instance and webservice interface by accessing the following URL:
I am getting this response
{"sitename":"Test","username":"admin","firstname":"Armin","lastname":"xxxx","fullname":"Armin xxxx","lang":"en","userid":2,"siteurl":"https:\/\/lms.moodle.local","userpictureurl":"https:\/\/lms.moodle.local\/pluginfile.php\/5\/user\/icon\/degrade\/f1?rev=175","functions":[{"name":"core_user_create_users","version":"2024100703.04"},{"name":"core_user_delete_users","version":"2024100703.04"},{"name":"core_user_get_users_by_field","version":"2024100703.04"},{"name":"core_user_update_users","version":"2024100703.04"},{"name":"core_course_get_courses","version":"2024100703.04"},{"name":"core_course_get_courses_by_field","version":"2024100703.04"},{"name":"core_course_get_categories","version":"2024100703.04"},{"name":"enrol_manual_enrol_users","version":"2024100700"},{"name":"enrol_manual_unenrol_users","version":"2024100700"},{"name":"core_enrol_get_users_courses","version":"2024100703.04"},{"name":"core_cohort_add_cohort_members","version":"2024100703.04"},{"name":"core_cohort_create_cohorts","version":"2024100703.04"},{"name":"core_role_assign_roles","version":"2024100703.04"},{"name":"core_role_unassign_roles","version":"2024100703.04"},{"name":"core_cohort_delete_cohort_members","version":"2024100703.04"},{"name":"core_cohort_get_cohorts","version":"2024100703.04"},{"name":"core_webservice_get_site_info","version":"2024100703.04"},{"name":"auth_edwiserbridge_test_connection","version":"2025040200"},{"name":"auth_edwiserbridge_get_site_data","version":"2025040200"},{"name":"auth_edwiserbridge_get_course_progress","version":"2025040200"},{"name":"auth_edwiserbridge_get_edwiser_plugins_info","version":"2025040200"},{"name":"auth_edwiserbridge_get_course_enrollment_method","version":"2025040200"},{"name":"auth_edwiserbridge_update_course_enrollment_method","version":"2025040200"},{"name":"auth_edwiserbridge_get_mandatory_settings","version":"2025040200"},{"name":"auth_edwiserbridge_enable_plugin_settings","version":"2025040200"},{"name":"auth_edwiserbridge_validate_token","version":"2025040200"},{"name":"auth_edwiserbridge_verify_sso_token","version":"2025040200"},{"name":"auth_edwiserbridge_get_users","version":"2025040200"},{"name":"auth_edwiserbridge_get_courses","version":"2025040200"},{"name":"auth_edwiserbridge_manage_cohort_enrollment","version":"2025040200"},{"name":"auth_edwiserbridge_delete_cohort","version":"2025040200"},{"name":"auth_edwiserbridge_manage_user_cohort_enrollment","version":"2025040200"}],"downloadfiles":1,"uploadfiles":1,"release":"4.5.3+ (Build: 20250328)","version":"2024100703.04","mobilecssurl":"","advancedfeatures":[{"name":"usecomments","value":1},{"name":"usetags","value":1},{"name":"enablenotes","value":1},{"name":"messaging","value":1},{"name":"enableblogs","value":1},{"name":"enablecompletion","value":1},{"name":"enablebadges","value":1},{"name":"messagingallusers","value":0},{"name":"enablecustomreports","value":1},{"name":"enableglobalsearch","value":0},{"name":"mnet_dispatcher_mode","value":0},{"name":"enablecompetencies","value":1}],"usercanmanageownfiles":true,"userquota":0,"usermaxuploadfilesize":-1,"userhomepage":0,"userprivateaccesskey":"f13747c321e5e6990fb8685e2e0e7bfd","siteid":1,"sitecalendartype":"gregorian","usercalendartype":"gregorian","userissiteadmin":true,"theme":"degrade","limitconcurrentlogins":0,"policyagreed":0}As you can see, basic web service access is functioning correctly.
The only difference lies in the
wsfunctionparameter. Moreover, since thecore_webservice_get_site_infocall returns a JSON response listing all supported web service functions, this confirms that the functionauth_edwiserbridge_test_connectionshould indeed be available and supported.Is there any configuration in Moodle that I might have overlooked which could prevent receiving a valid response from the web service interface?
P.S.: I would also like to inform you that, once my private testing with Edwiser Bridge at home is successfully completed, the company I work for intends to proceed with the purchase of an official Edwiser Bridge Pro Lifetime license in Q3/2025.
Thanks
ArminHello Team Edwiser,
To avoid further trial and error, I decided to completely reset my Ubuntu system and start from scratch. I performed a clean installation of Ubuntu and WordPress and Moodle and installed the Edwiser plugin again.
Good news: everything worked perfectly this time! I was able to activate the Edwiser Bridge without any issues.
I’m really glad it’s working now—though I’m still not quite sure what caused the problem before. I truly appreciate your patience and support throughout this process. I’m marking this issue as resolved.
Thank you very much once again!
Best regards,
ArminI downgraded to php 8.1.x. The error still remains. Here is what the phpinfo page is showing to me right now
PHP Version 8.1.32
SystemLinux cirrus7-ubuntu 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64Build DateMar 13 2025 18:27:44Build SystemLinuxServer APIApache 2.0 HandlerVirtual Directory SupportdisabledConfiguration File (php.ini) Path/etc/php/8.1/apache2Loaded Configuration File/etc/php/8.1/apache2/php.iniScan this dir for additional .ini files/etc/php/8.1/apache2/conf.dAdditional .ini files parsed/etc/php/8.1/apache2/conf.d/10-mysqlnd.ini, /etc/php/8.1/apache2/conf.d/10-opcache.ini, /etc/php/8.1/apache2/conf.d/10-pdo.ini, /etc/php/8.1/apache2/conf.d/15-xml.ini, /etc/php/8.1/apache2/conf.d/20-calendar.ini, /etc/php/8.1/apache2/conf.d/20-ctype.ini, /etc/php/8.1/apache2/conf.d/20-curl.ini, /etc/php/8.1/apache2/conf.d/20-dom.ini, /etc/php/8.1/apache2/conf.d/20-exif.ini, /etc/php/8.1/apache2/conf.d/20-ffi.ini, /etc/php/8.1/apache2/conf.d/20-fileinfo.ini, /etc/php/8.1/apache2/conf.d/20-ftp.ini, /etc/php/8.1/apache2/conf.d/20-gettext.ini, /etc/php/8.1/apache2/conf.d/20-iconv.ini, /etc/php/8.1/apache2/conf.d/20-mbstring.ini, /etc/php/8.1/apache2/conf.d/20-mysqli.ini, /etc/php/8.1/apache2/conf.d/20-pdo_mysql.ini, /etc/php/8.1/apache2/conf.d/20-phar.ini, /etc/php/8.1/apache2/conf.d/20-posix.ini, /etc/php/8.1/apache2/conf.d/20-readline.ini, /etc/php/8.1/apache2/conf.d/20-shmop.ini, /etc/php/8.1/apache2/conf.d/20-simplexml.ini, /etc/php/8.1/apache2/conf.d/20-sockets.ini, /etc/php/8.1/apache2/conf.d/20-sysvmsg.ini, /etc/php/8.1/apache2/conf.d/20-sysvsem.ini, /etc/php/8.1/apache2/conf.d/20-sysvshm.ini, /etc/php/8.1/apache2/conf.d/20-tokenizer.ini, /etc/php/8.1/apache2/conf.d/20-xmlreader.ini, /etc/php/8.1/apache2/conf.d/20-xmlwriter.ini, /etc/php/8.1/apache2/conf.d/20-xsl.ini, /etc/php/8.1/apache2/conf.d/20-zip.iniPHP API20210902PHP Extension20210902Zend Extension420210902Zend Extension BuildAPI420210902,NTSPHP Extension BuildAPI20210902,NTSDebug BuildnoThread SafetydisabledZend Signal HandlingenabledZend Memory ManagerenabledZend Multibyte Supportprovided by mbstringZend Max Execution TimersdisabledIPv6 SupportenabledDTrace Supportavailable, disabledRegistered PHP Streamshttps, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zipRegistered Stream Socket Transportstcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3Registered Stream Filterszlib.*, string.rot13, string.toupper, string.tolower, convert.*, consumed, dechunk, convert.iconv.*I can’t append pictures to this chat unfortunately
I just tested your first suggestion a moment ago. After commenting out the original line and inserting your proposed replacement, the error in that specific line was resolved. However, the error has now shifted to the next line, which the code appears to execute afterward. This line contains the same combination of
printf()andesc_html().Thank you once again for your response.
As mentioned in my initial message, I’m working with a completely fresh setup: a clean installation of Ubuntu, a brand-new WordPress instance, and the first — and only — plugin I installed was the Edwiser plugin. There is no plugin history or interference from other extensions, as I haven’t installed anything else.
Given this, there’s nothing I can deactivate or troubleshoot in terms of conflicts — it’s a 100% fresh Ubuntu environment, 100% fresh WordPress installation, and a 100% clean Edwiser plugin setup.
P.S.:
- And the installation of Edwiser Plugin into moodle worked well as instructed.
- The Ubuntu was installed natively on a PC machine. It is not a Virtual machine by the way.
This is the WordPress installation I did
sudo apt update
sudo apt -y install apache2 \
ghostscript \
libapache2-mod-php \
mariadb-server \
php \
php-bcmath \
php-curl \
php-imagick \
php-intl \
php-json \
php-mbstring \
php-mysql \
php-xml \
php-zipThen I installed the actual wordpress into the apache HTML folder
sudo chown www-data: /var/www/html
curl https://ww.wp.xz.cn/latest.tar.gz | sudo -u www-data tar zx -C /var/www/htmlThen I configured the mariadb-server
sudo mysql -u root -p
CREATE DATABASE wordpress_db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'xxxxxxxxxxxxxxx';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;I setup the apache server
sudo nano /etc/apache2/sites-available/wordpress.confand configured the wordpress.conf file for a virtual host and ssl certificates. I enabled the site with
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo a2enmod ssl
sudo a2enmod headers
sudo a2dissite 000-default
sudo apache2ctl configtest
sudo systemctl reload apache2Finally I was able to access the fresh WordPress page and to login. It asked me for the database setup and I entered the credentials … and the setup was finished.
And from there I started to install the Edwiser Plugin and tried to activate it.
This is my history.
I don’t know … but I have the impression that the esc_html__( … ) function could be the root cause of the problem which is used in the context of the expression.
I removed the esc_html__() code for a test and replaced it by a simple ‘Hello’ text and the error is gone in that line … but of course the error re-appeared on another code line using the same printf() expression.
I removed the complete printf line just for a test. The error is gone in that line, but at the same time it appeared in another printf line.
Back from holiday I tried both of your possibilites. Php is now version 8.2
php -v
PHP 8.2.28 (cli) (built: Mar 13 2025 18:13:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
with Zend OPcache v8.2.28, Copyright (c), by Zend Technologiesand I edited the tow locations in the corresponding *.php file. I commented out the old line
printf(
esc_html__('Thanks for creating an account on %s. Your username is %s.', 'edwiser-bridge'),
'{SITE_NAME}',
' {USER_NAME}'
);/*
printf(
esc_html__( 'Thanks for creating an account on ', 'edwiser-bridge' ) . '%s' . esc_html__( '.>
'{SITE_NAME}',
' {USER_NAME}'
);
*/but still the error is the same
2025-04-06T19:30:34+00:00 CRITICAL Uncaught ArgumentCountError: 3 arguments are required, 2 given in /var/www/html/wordpress/wp-content/plugins/edwiser-bridge/includes/class-eb-default-email-templates.php:298 CONTEXT: {"error":{"type":1,"file":"/var/www/html/wordpress/wp-content/plugins/edwiser-bridge/includes/class-eb-default-email-templates.php","line":298},"remote-logging":true,"backtrace":["","#0 /var/www/html/wordpress/wp-content/plugins/edwiser-bridge/includes/class-eb-default-email-templates.php(298): printf()","#1 /var/www/html/wordpress/wp-content/plugins/edwiser-bridge/includes/class-eb-default-email-templates.php(40): app\wisdmlabs\edwiserBridge\Eb_Default_Email_Templates->get_new_user_account_template()","#2 /var/www/html/wordpress/wp-content/plugins/edwiser-bridge/includes/class-eb-activator.php(294): app\wisdmlabs\edwiserBridge\Eb_Default_Email_Templates->new_user_acoount()","#3 /var/www/html/wordpress/wp-content/plugins/edwiser-bridge/includes/class-eb-activator.php(135): app\wisdmlabs\edwiserBridge\Eb_Activator::create_default_email_tempaltes()","#4 /var/www/html/wordpress/wp-content/plugins/edwiser-bridge/includes/class-eb-activator.php(45): app\wisdmlabs\edwiserBridge\Eb_Activator::check_single_or_multi_site()","#5 /var/www/html/wordpress/wp-content/plugins/edwiser-bridge/edwiser-bridge.php(50): app\wisdmlabs\edwiserBridge\Eb_Activator::activate()","#6 /var/www/html/wordpress/wp-includes/class-wp-hook.php(324): app\wisdmlabs\edwiserBridge\activate_edwiser_bridge()","#7 /var/www/html/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()","#8 /var/www/html/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action()","#9 /var/www/html/wordpress/wp-admin/includes/plugin.php(703): do_action()","#10 /var/www/html/wordpress/wp-admin/plugins.php(60): activate_plugin()","#11 {main}","thrown"]}Downgrade to any other PHP version?