HarryAlexander
Forum Replies Created
-
Forum: Plugins
In reply to: [Classic Editor] Changes you made may not be saved.Rolled back to 5.5.3, working now, both sites ??
Forum: Plugins
In reply to: [External DB Connect.] Error after installI was receiving the same error, but then remembered that I needed modify some files per the readme.txt that comes with the plugin. I was able to get it working, by taking some liberty with the instructions as follows.
Steps to install plugin:
Step 1:extCreateDbUser(): Call this function in wp-admin/user-new.php file on line 108 if ( current_user_can( 'list_users' ) ){ //Create user in external database with Privilages/Access/Grants extCreateDbUser($user_id); //Defined in ExtDB plugin page }
There is no code that exists for ‘list users’ so I inserted the above code snip after the code at line 107, so now it looks like this:
if ( ! current_user_can( 'create_users' ) ) { wp_die( '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . '<p>' . __( 'You are not allowed to create users.' ) . '</p>', 403 ); } if ( current_user_can( 'list_users' ) ){ //Create user in external database with Privilages/Access/Grants extCreateDbUser($user_id); //Defined in ExtDB plugin page }
###
Step 2:
extUpdateDBUser(): Call this function in wp-admin/user-edit.php file on line 182if($_POST['pass2']) { //Update user in external database with Privilages/Access/Grants extDbUpdateUser($_POST['user_id']); //Defined in ExtDB plugin page }
I copied the above code and placed it after line 182, which was within an existing if statement, and now looks as follows (line 173-188)
<?php if ( isset($_GET['updated']) ) : ?> <div id="message" class="updated notice is-dismissible"> <?php if ( IS_PROFILE_PAGE ) : ?> <p><strong><?php _e('Profile updated.') ?></strong></p> <?php else: ?> <p><strong><?php _e('User updated.') ?></strong></p> <?php endif; ?> <?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?> <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('← Back to Users'); ?></a></p> <?php endif; ?> </div> if($_POST['pass2']) { //Update user in external database with Privilages/Access/Grants extDbUpdateUser($_POST['user_id']); //Defined in ExtDB plugin page } <?php endif; ?>
Step 3:
extDeleteDbUser(): Call this function in wp-admin/users.php file on line 178 (in case ‘delete’)switch ( $_REQUEST['delete_option'] ) { case 'delete': extDbDeleteUser($id); //Defined in ExtDB plugin page wp_delete_user( $id ); break;
I copied above code after 178 which breaks the code. Instead, what I think is intended, is to just insert one line extDbDeleteUser($id); after case ‘delete:’ The entire snip is as follows
switch ( $_REQUEST['delete_option'] ) { case 'delete': extDbDeleteUser($id); //Defined in ExtDB plugin page hra wp_delete_user( $id ); break; case 'reassign': wp_delete_user( $id, $_REQUEST['reassign_user'] ); break; }
Then I went in to Settings, External DB Settings and added the DB, Table, and Credentials and it all works fine.
For now, this suits my need, which is to have something to build from to access an external database. I thank the author for the work, it is very helpful.
I am an experienced technician, but total noob with WP. That said, I have questions about modifying these files. Are these core WP files? Should these files really be modified?