Trouble installing XAMPP; need for Javascript for WordPress class

I am taking the Javascript for WordPress class and have to install XAMPP to work locally. Naturally, I'm the one who runs into problems. Screenshots attached. The installation completed, but when I try to open the Control Panel, I receive a prompt to choose English, German or Abort. I click English and receive
“Error: Cannot write file to “C\ProgramFiles\XAMPP\xampp-control.ini” Access denied.”

Then, the Control Panel appears. It had the port errors. I followed the instructions in the WPMU tutorial to fix it. First, I searched Services, but there was no World Wide Publishing file. Then, I followed the instructions to set up two localhosts and restarted computer. I went to Apps, clicked on XAMPP Control Panel, received the language prompt and error message again. Control Panel opened and still had the same error messages about the ports. I'm stuck.

Michael

  • Milan

    Hello mkleiner

    Hope you are well today and thanks for asking us. :slight_smile:

    As per the error, you have enabled UAC ( User Account Control ) feature for your windows machine. So by its features it will not allow any third party application to make changes to the system files and folder. So best way to resolve this would be to install XAMPP in other drive than C:\\ where your system resides. :slight_smile:

    Uninstall it, and install it in other drive than "C:\\". Let me know how it goes. :slight_smile:
    Best Regards,
    Milan

  • mkleiner

    Milan,
    When I first tried installation again, I received the UAC message again.

    I created a Program Files and XAMPP folders on my Western Digital external hard drive and initiated installation and entered destination as ext HD. Before completing, error 1 on attached screen shot, different than yesterday. Then, same error about the Microsoft Basic Visual C++ received yesterday. Installation completed. Opened Control Panel. Got language option, but didn't get error after clicking English. The control panel had the error about the port settings. But, if I'm installing on the external hard drive, the troubleshooting on the ports won't work because they relate to the hard drive. This is for the Javascript Class, and the next week's lesson started today, and this is from this past week.

    Michael

  • Predrag Dubajic

    Hi Michael,

    Can you check if last response in this threads helps with your issue:
    http://answers.microsoft.com/en-us/windows/forum/windows8_1-winapps/cannot-download-xampp-error-windows-cannot-find-n/00d27767-d76d-4fd6-bea6-6eac23a40e9a?auth=1

    Can you also try changing your installation folder so it's still on your C: drive but instead of Program Files folder install in root of the drive under C://xampp for example?

    Have you considered giving WAMP or MAMP a go, those two should be easier to install and configure than XAMPP?

    Best regards,
    Predrag

  • mkleiner

    Predrag,
    Thank you for the reply.

    I tried installing to the route directory and it installed without the error message about not being able to write to n. No error about Microsoft Basic Visual C++. No error when I clicked on English.
    The ports needed to be configured and I did so as described in the WPMU tutorial (https://premium.wpmudev.org/blog/setting-up-xampp/). I shut down, restarted laptop, but when I opened the AAMPP Contol Panel, it still had the port errors.

    I am going by what the course says, to use XAMPP, so I don't even know about WAMP or MAMP.

    Michael

  • Milan

    Hello Michael,

    Thanks for carrying out all those tests and troubleshooting.

    Now please give one chance to MAMP. Its relatively very easy compare to other two options out there for windows.

    Just download its installer file from here,
    https://www.mamp.info/en/downloads/

    Follow instructions given in this article to install it on your hard drive.
    https://documentation-3.mamp.info/en/documentation/mamp-windows/

    Once you complete its installation, restart the pc and start the MAMP.

    Let me know how it goes for you. :slight_smile:
    Best Regards,
    Milan

  • mkleiner

    Predrag/Milan,

    Thank you.

    I closed Skype and was able to start the servers. :slight_smile: I got a Windows Firewall message, but clicked on home network, declicked Public, and clicked Allow Access.

    However, I am confused by the rest of the instructions.
    The ports are set to Apache: 80; Nginx: 80; MySQL: 3306
    "These ports are configurable. The default configuration for MAMP uses ports 8888, 7888 and 8889 . That way, the MAMP servers can run alongside other servers installed on your PC. Should ports 8888, 7888 and 8889 be in use by a different application, please change the values accordingly.

    The button Set Web & MySQL ports to 80 & 3306 will set the ports to the value commonly used on the internet. The button Set MAMP ports to default will reset the ports for Apache, Nginx and MySQL to 8888, 7888 and 8889.

    If you want MAMP to be available via the Internet please make sure that the configured ports are opened in your firewall."

    Am I supposed to change these?

    PHP: Standard Version is 7.0.9; instructions have older one in screenshot. Left Cache off.

    Web Server
    Choose either the Apache or Nginx web server.

    Document Root

    Click on "Select..." to select where your html/PHP files and images are stored. This directory is called Document Root. The default Document Root in MAMP is: c:\MAMP\htdocs.
    I navigated to MAMP\htdocs. Left web server as Apache.

    I opened the Start Page. Where am I supposed to go to do the class exercises, Javascript, JQuery?

    Michael

  • mkleiner

    Predrag/Milan,

    This is the next step in the Javascript for WordPress class.

    "Let’s use the default WordPress theme, Twenty Sixteen, for testing. Modifying the code of an existing theme is bad practice so we’ll create a child theme. Child themes inherit all their functionality from parent themes, except where specified.

    "Create a new directory in your themes folder named jquery-test-theme. Create three files within: style.css, scripts.js and functions.php. Add the following to the stylesheet and save it:

    "/*
    Theme Name: Jquery Test Theme
    Description: A theme based on Twenty Sixteen for testing our jQuery prowess
    Author: Daniel Pataki
    Author URI: http://danielpataki.com
    Template: twentysixteen
    Version: 1.0.0
    */
    view rawstyle.css hosted with ? by GitHub
    Add the following to the functions.php and save it:

    <?php
    add_action( 'wp_enqueue_scripts', 'jquery_test_assets' );
    function jquery_test_assets() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css' );
    wp_enqueue_script( 'jquery-test', get_stylesheet_directory_uri() . '/scripts.js', array('jquery'), '1.0.0', true );
    }
    view rawfunctions.php hosted with ? by GitHub"

    I don't see anything about creating directories, unless it is the same as databases, which I don't think it is. Where and how do I create the directories? Where do I enter all of this? I've clicked around, but am lost.

    Michael

  • Predrag Dubajic

    Hi Michael,

    If your MAMP servers have started properly there shouldn't be any additional settings for MAMP itself required.

    Next thing you would need to do is install WordPress in your localhost.
    By default you should be able to do this by creating new folder, for example WordPress, under C:\MAMP\htdocs folders and pasting WordPress files inside it, we're talking about standard folders that you can create using Windows Explorer.

    After that go to your database by going to localhost/phpMyAdmin/ or localhost:8888/phpMyAdmin/ and create new database.

    Once that is done you should be able to access your local site by going to http://localhost/WordPress/ or http://localhost:8888/WordPress/.
    It should now run WP setup where you can follow the steps to complete your WP installation.

    Now you can go to back to your WP files using Windows Explorer and navigate to C:\MAMP\htdocs\WordPress\wp-content\themes\ folder and there you can create child theme mentioned above.

    Best regards,
    Predrag

  • mkleiner

    Prerdrag,
    Thanks for the reply.
    I'm trying to follow your instructions, Rachel McCollin's How to Develop with MAMP tutorial and Dan Pataki's assignment in the class (which this is Lesson 4 and Lesson 6 will be available tomorrow).

    My first question to try to clear my confusion: Is the database the same as a directory?
    Dan's instruction above is:
    "Create a new directory in your themes folder named jquery-test-theme. Create three files within: style.css, scripts.js and functions.php. Add the following to the stylesheet and save it:
    In your instructions, and Rachel McCollin's tutorial, you both use the word database. She also mentioned about downloading WordPress. She says in MyPHPAdmin/Databases, create database. Is this the same as Dan saying "create directory in your themes folder jquery-test-theme."? I entered jquery-test-theme in Create Database box.

    I downloaded and installed WordPress. I started the set-up process and got stopped at the wp-config information, asking for the database name, username and password. OK, I see Rachel's instructions what to enter.
    I followed through. Now, I have another WP dashboard named jquery-test-theme. I still have these questions above re database and directory. Is the database the same as the directory? The jquery-test-theme is now in the themes folder? Am I using the Editor in the dashboard to place the code, though that is labeled style.css? How and where am I creating style.css, scripts.js and functions.php? Are these created as pages? When I added new page, naming functions.php, it put a - instead of a . between functions and php in the permalink. Although, when I look at All pages list, it is functions.php.

    Add the following to the stylesheet and save it:

    "/*
    Theme Name: Jquery Test Theme
    Description: A theme based on Twenty Sixteen for testing our jQuery prowess
    Author: Daniel Pataki
    Author URI: http://danielpataki.com
    Template: twentysixteen
    Version: 1.0.0
    */
    view rawstyle.css hosted with ? by GitHub

    I added this to the Editor, which is style.css. Correct? The other part of the confusion is the screen in Dan's video instruction doesn't look the same. There isn't the WordPress dashboard. He goes "bim boom," created functions.php, scripts.js. Though, he does say files. Different terminology among the three of you makes it confusing. Frustrating I'm going to be three weeks behind. Did anyone else have this much trouble, first with AAMP, then MAMP? From the postings, doesn't seem like it. I've never used local servers before and still learning WP. Think always learning WordPress.

    Michael

  • Adam Czajczyk

    Hello Michael!

    My first question to try to clear my confusion: Is the database the same as a directory?

    The database is not the same as directory. The directory is another word for "folder". That's the "place" on a disk drive where you store your files, it's used for organizing files.

    The database is a "tool" used to store data. Basically, it's a way to store information and is handled by a special software (that's bundled-in with MAMP/WAMP/XAAMP). WordPress communicates with it to store data such as e.g. content of posts and pages, information about user accounts and many more.

    She also mentioned about downloading WordPress. She says in MyPHPAdmin/Databases, create database. Is this the same as Dan saying "create directory in your themes folder jquery-test-theme."? I entered jquery-test-theme in Create Database box.

    These are two different things. WordPress needs a working database to be able to work. That's what Rachel means. What Dan asks is next level - when you already have WordPress up and running.

    As for your following questions. I got the impression that it's all still quite new to you. This is perfectly fine and understandable. We all started at some point and we all always learn. I do think however that there may be a lot more to learn first before jumping into programming. We're more than happy to answer all your questions and provide you with as much assistance as possible but it may be better to start with getting to know more about basics. Coding/programming is a complex task and it's better to be comfortable with all the terminology such as directories/folders, database, files, scripts, installing, configuring and using WordPress etc. Having that said, I believe that makes sense to you and you got my point. It's absolutely fine to start with basics but these basics are essentials.

    If you have any further questions and/or I misunderstood your point, let me know and I'll be happy to assist you.

    Kind regards,
    Adam

  • mkleiner

    Hi Adam,
    Thanks for replying.

    Of course, I know what a folder is. :slight_smile:

    There are a few things at work for me that are causing frustration and I have to step back for perspective. Despite the fact this class is ongoing, it's also not going away. It will remain in my account and I can go at my pace. I suppose I can still post in the discussion groups, which is one of the tasks in the class.
    I'm not new to web design, but fairly new to WordPress, which is supposed to be this easy way to design sites without coding, and you can have a site up in 30 minutes. That's a similar sell in other WYSIWG software. There's a lot that goes into web sites not mentioned: copy; photographs taken, scanned, cropped, resized; meta tags; SEO. WordPress has its learning curve, partly because each theme works differently within the framework of WordPress. Certain elements are made easier, drop down menus, the plug-ins install quickly, contact forms. If it was so "easy," why would there need to be a Javascript class for WordPress class? :slight_smile:

    I have finally finished a redesign of a client's site, a pet sitting, dog walking business. Not complex. The site in Dreamweaver was doing fine, but then Google changed the ratings for how sites looked on mobile devices. I thought I would try Upfront and Spirit because I'd be done in a few hours because WordPress makes site responsive. It took months because things weren't working for me. Grabbing the elements over. Working one way on my laptop (two laptops because I bought a new one during the process), another on desktop, went through different mice, worked differently in browsers. The way something looked in edit mode was not the way it looked on the site. I worked mostly with Tyler, who was a great help. I think there were three upgrades of Upfront during the process. Felt like I was snakebit. So, my frustration stems from that. I'm lucky it wasn't a pushy client.

    That said, I have recently started a redesign of my book site, where I'm going to have seven slide shows. I'm using Scribe and things are better. The time I'm spending is experimental, so I'm not getting frustrated. I waited a while before I contacted Support with questions, and actually, as I was typing some of the questions, I found the solution. :slight_smile:

    I also got through the first three lessons of the Javascript course and then we were supposed to install XAMPP. Problem installing it on my laptop. Suggestion try on another drive. I installed on my external hard drive, still had a problem. Suggestion try MAMP and then ran into these issues. Though, the installation wasn't that bad. Imagine, though, the feeling of "why me?" again.

    Maybe, we can clarify some of my questions and see how I can progress. If it gets hard, maybe I cut back to one of the basic classes. I guess it doesn't matter that I called the database the same as Dan said directory. It's a test anyway. Is this going in the themes folder in c:disappointed:MAMP/htdocs/wordpress/wp-content/themes?

    I pasted the code for the css in Editor, which is the css.

    Did I do the correct thing by adding pages in dashboard, one functions.php and another scripts.js? Then, I would use the Text tab in each to write the code?

    Michael

    P.S. One of my 16-year old sons is taking a Java Script elective with Treehouse.com in 11th grade. He's interested in games. Maybe, I'll be able to help him. :slight_smile:

  • Predrag Dubajic

    Hi Michael,

    WordPress does have a bit of a learning curve but it should be easier each day and soon enough you'll feel like WP expert :slight_smile:

    Issue you were having with installing XAMPP doesn't actually have anything to do with WP so we can't blame it on him :slight_smile:
    I remember having issues with setting XAMPP before and that's why I suggested WAMP and MAMP since both of these are working for me without any additional configuration, just install and you're ready to ( usually :slight_smile: )

    I waited a while before I contacted Support with questions, and actually, as I was typing some of the questions, I found the solution.

    You're not the only one, if I got a dollar for each time this happened to me I would be driving around in a Ferrari :smiley:

    To get serious now, in database all your data is stored, WP is used as a tool to communicate between your database and front end of your site, once you have created new database and installed WP you shouldn't be touching database any more at this point.

    You will be using your Windows Explorer from now on to access your files and make changes to them.
    So when you access your wp-content/themes/ folder there's where you will create new child theme, which is mentioned in course.
    Now in that child theme you'll create your .php and .js files, those can't be created from WP admin section directly, so once you have created them you can use Dreamweaver to put the code in those files.

    Let us know if this help and if you need additional assistance :slight_smile:

    Best regards,
    Predrag

  • mkleiner

    Predrag,

    Thanks for the nice reply.
    I created the test theme in the themes folder on the hard drive. (See attached). MAMP/wordpress/htdocs/wordpress/wp-content/themes/jquery-test-theme.

    I created the functions.php, scripts.js and style.css files in Notepad++.

    I went to the lesson. Jquery supposed to change masthead to red. Didn't. Thought I might have to activate the new theme in WP Admin. Now, I can't access the admin. See attached. Thank you.

    Michael

  • Adam Czajczyk

    Hello Michael!

    I hope you're well today!

    Let me please first get back to my previous post for a while. I really hope I didn't offended you but if I did in anyway, I sincerely apologize. That wasn't ever my intention, I was just slightly confused with these questions. Again, I'm really sorry if my response sounded harsh or offensive.

    As for your recent question.

    I reviewed screenshots that you posted and all that you did there seems fine. The only exception is that this line should not be anywhere in the code (CSS and JS):

    view rawstyle.css hosted with ? by GitHub

    Other than that, the folder and file structure and content looks fine.

    There's however one thing that bothers me a bit and since I obviously do not have access (and cannot have it) to the install local to your computer I'm not sure if that is proper.

    The URL that's showed on screenshots (for both front and back-end of your WordPress) is:

    localhost/MAMP/wordpress/

    Shouldn't it be just

    localhost/wordpress/

    ?

    I installed WAMP (since I'm on Windows machine) to check it and on my install it would be "localhost/wordpress". Actually, it would even be "localhost:8181/wordpress" because I configured WAMP to use 8181 port.

    I'm asking this because an error that's displayed there suggests that server (MAMP) is running on your machine but it cannot find path for given URL and this usually means that the URL isn't proper.

    When you first accessed your newly installed WordPress what was the URL that you typed into your browser? Could you make sure about it?

    I'm asking this only because I'm not able to review/check this myself on your computer, I hope that makes sense :slight_smile:

    Have a great day!
    Adam

  • mkleiner

    Adam/Predrag,

    Let's try to solve this mess.

    I looked at Rachel's instructions for MAMP (https://premium.wpmudev.org/blog/develop-wordpress-locally-mamp/) and the URL is supposed to be localhost/Wordpress unless the port was changed. I had Apache set to 80, which was the default. With localhost/wordpress, I received the errors in the attached screen shots. I tried changing Apache to 8888 and received the same error messages for localhost:80/wordpress and localhost:8888/wordpress. I thought about moving wordpress folder out of MAMP, but Rachel's tutorial has it in MAMP/htdocs/. Now, I've run into another problem. I went to change Apache back to 80 and now I'm receiving error message that MySQL port is being used. When I click OK, Apache doesn't resume. This didn't happen when I changed the port from 80 to 8888. The port is showing as 80. I also noticed on the Start/Stop tab toward the bottom, there's a box that says "Start URL with..." It said /MAMP. I tried changing to localhost/wordpress, but I'm in the loop of the MySQL error message.

  • Milan

    Hello mkleiner

    Hope you are having a good day. :slight_smile:

    It seems like your installation got totally corrupted !! :wink: Let's try to install it one more time. :slight_smile:

    #1) Go to Control Panel > Programs > Program and Features. Uninstall MAMP.
    #2) Re-run its setup file to install it again.
    #3) Extract WordPress folder from downloaded zip to C:\\MAMP\htdocs\ .( Assuming you are having a downloaded WordPress installation zip. If not you can download it from here )
    #4) Restart your system
    #5) Make sure that skype is closed.
    #6) Run MAMAP application. Start the server.

    Let me know how it goes.
    Kind Regards,
    Milan

  • mkleiner

    Milan, etal
    I uninstalled and reinstalled MAMP. When I shut down, Windows 10 updates had to be installed and that took about an hour and a half.
    I opened MAMP and the servers started on their own. The default ports are Apache: 80 Nginx:80 and MySQL:3306.
    I went to the starter page. localhost/wordpress was correct. Went through the set-up process again, creating database, installing WordPress. After I clicked Install, I didn't get a success page, just a WordPress logo. I opened another tab and entered localhost/wordpress and tried to login and received invalid username. I tried my e-mail address and received invalid e-mail address. I went back to what was supposed to be the success page, backspaced to the previous page, clicked on Install and received message, "already installed." Again, I received invalid username and e-mail address messages. Ugh!

    Michael

  • Predrag Dubajic

    Hi Michael,

    Could you attach some screenshots of what's happening, it will help us understand better where exactly you're having issues?

    When you go to localhost/wordpress to you see your WP or just the logo? Screenshots would be nice here for example :slight_smile:

    What happens when you go to localhost/wordpress/wp-admin, do you see login form normally?

    Let us know :slight_smile:

    Best regards,
    Predrag

  • mkleiner

    Predrag, etal. :slight_smile:

    I would've sent the screen shot last night, but I lost the page going back and forth. Today, I got totally different message than last night. When I went to localhost/wordpress/wp-admin I got the login page, populated with the username and password. The default password was different than the first installation, so I changed that. But the error message said invalid username. I used the same username as the first installation. When I tried using my e-mail address, I received the same message. Invalid username.

    Attached is what I received today--in Chrome and Edge browsers. In Edge, it keeps trying to force http:// in front of localhost. I can try later and see if I get a different message.

    Michael

  • Predrag Dubajic

    Hi Michael,

    This looks like servers are not running properly, can you try firing them again after quitting skype as mentioned before?

    As for the login issue, let's try creating new user by using your theme files and see if you're able to login with those.
    To do this you'll need to edit your active theme functions.php file.
    You probably have Twenty Sixteen theme active so go to /wp-content/themes/twentysixteen/ folder and edit functions.php file.
    At the end of file paste this code:

    function add_admin_acct(){
    	$login = 'USERNAME';
    	$passw = 'PASSWORD';
    	$email = 'EMAIL';
    
    	if ( !username_exists( $login )  && !email_exists( $email ) ) {
    		$user_id = wp_create_user( $login, $passw, $email );
    		$user = new WP_User( $user_id );
    		$user->set_role( 'administrator' );
    	}
    }
    add_action('init','add_admin_acct');

    Now replace USERNAME, PASSWORD and EMAIL placeholders with details for new account, just make sure it's not the same username and email as your current account.
    Save the file and refresh your home page so that code is fired.
    You can now remove the code from the file and you should be able to use this newly created user to log in.

    Let us know how it goes.

    Best regards,
    Predrag

  • mkleiner

    Predrag, etal
    No change. Attached are screenshots of navigating to functions.php file in twenty sixteen theme and then pasting above code at end of functions.php page. Refreshed page and got same error as yesterday (attached). Then, I thought maybe the code should go in the jquery-test-theme folder for the class, but that didn't help and function is referencing twenty-sixteen. I cleared browsing history and that didn't help either. Today is the last lesson of the class. The lessons will still be there whenever this mess gets solved.

    Michael

  • Milan

    Hello mkleiner ,

    Hope you are having a good day today. :slight_smile:

    Could you please open your site's wp-config.php file and enable debug mode in it ?
    To enable debug mode for your site please replace this line in file,

    define ( "WP_DEBUG", false );

    with this one,

    define ( "WP_DEBUG", true );

    After this change, save the file and try to access your site. Let me know if you see any errors or notices.

    Best Regards,
    Milan

  • Predrag Dubajic

    Hi Michael,

    What happens when you go to /localhost/ in your browser, do you see link to your WordPress installation like this:

    If you do then MAMP is working fine but the issue is somewhere with your WP installation.

    Which theme do you have active Twenty Sixteen or your jquery-test-theme theme?
    If jquery-test-theme is active can you try going to your themes folder in Win Explorer and rename jquery-test-theme folder to anything else, it should deactivate the theme and you should be able to access localhost/wordpress and localhost/wordpress/wp-admin again.

    Let us know of the status after that.

    Best regards,
    Predrag

  • mkleiner

    I was checking this to see why I hadn't heard anything in a while. I know I answered Predrag's post, but somehow it didn't post. Now, I have to remember. Well, I just tried localhost/ and I get Index of / * wordpress in Chrome, Edge and MAMP. When I try localhost/wordpress, I get that page and then it changes to
    My Site
    Just another WordPress site
    Nothing found (See screenshot).
    Attached are screenshots from Sept. 23 and today.

    Michael

  • Dimitris

    Hey there mkleiner,

    I trust you're well today and really sorry for your missed post here! :slight_smile:

    I just inspected the screenshots you kindly shared with us, and as far as I can see you can reach the frontend at localhost/wordpress/ but not the backend at localhost/wordpress/wp-admin/.

    About the "nothing found" message in front page, this is happening because it should be set up to display the latest post in front page. There's an option to select either your latest posts or a static page through Settings -> Reading -> Front page displays

    But you should get to administrator area to make any of these changes. As the rename of your child theme folder didn't make the trick, could you please move it (cut-paste) into another location outside your MAMP installation (eg. in Desktop) and try to access localhost/wordpress/wp-admin/ again? By doing so, the default TwentySixteen theme should be autoactivate and admin area should become reachable.

    Warm regards,
    Dimitris :slight_smile:

  • mkleiner

    I had already renamed the jquery-test-theme2 back to original and it didn't work. I tried again, cutting and pasting the folder to the desktop like you said. When I tried to create the three files again and save them, the files were already in the MAMP directory, but when I went to the folder in Files, the jquery-test-theme folder was empty as it should have been. I dragged the files from the desktop folder to the one in MAMP.

    localhost got the index page
    localhost/wordpress got the same index page and then nothing found
    localhost/wordpress/wp-admin got me the login screen with username and password populated.
    Don't jump up and down yet. When I clicked Login, I received "incorrect username". When I entered my e-mail address, I received "invalid e-mail address." I copied and pasted the password again and still got the username error.

    Michael

  • Predrag Dubajic

    Hi Michael,

    It looks like something is wrong with the current account you're trying to use, it could be due to @ sign in the username.
    Here's what you could do now, we can use some code to create new admin account and see if that works.

    What you would need to do is go to wp-content/themes/twentysixteen/ folder (or whatever is your current active theme), from there edit functions.php file and at the end of it paste this code:

    function add_admin_acct(){
    	$login = 'test';
    	$passw = 'test';
    	$email = 'test@test.com';
    
    	if ( !username_exists( $login )  && !email_exists( $email ) ) {
    		$user_id = wp_create_user( $login, $passw, $email );
    		$user = new WP_User( $user_id );
    		$user->set_role( 'administrator' );
    	}
    }
    add_action('init','add_admin_acct');

    Save the file and now navigate to localhost/wordpress page in your browser, this would fire the code and create new admin user in background.
    Now go to localhost/wordpress/wp-admin and try logging in with test for both username and password.

    Once you have logged in you should remove the code from functions.php

    Let us know if this worked.

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi Michael,

    Oh wow, that's strange, I used that code countless of times when I got locked out of admin section, it seems that there's a different issue here.

    Can you try reinstalling the WordPress?

    Easiest way would be to go to http://localhost/phpMyAdmin/ click on Databases tab and remove your wordpress database, and then re-create it.
    After that go to your WordPress installation files and remove wp-config.php file.

    Now go to localhost/wordpress/ and WP installation process should show up again.
    Once done you should be able to login with the account you set during WP setup.

    Let us know if this worked.

    Best regards,
    Predrag

  • mkleiner

    Finally! But, not without issues. I had to remind myself of where to get WordPress, and it was still in my downloads. I was getting an unable to make a database connection error at localhost/wordpress. I uninstalled and installed WordPress a few times, recreated new directory in themes. Then, I advanced to "need wp-config-sample.php file. Please add it." So, I reinstalled WordPress to get it back, since you had said to delete it. Then, I noticed something. When I tried to save functions.php, style.css and scripts.js files the default folder was still the previous theme name. The path was coming off the hard drive. On one of the reinstalls of MAMP, I put it in the folder for the class, "Javacript for WordPress," and I had kept saving there. I dragged the wordpress directory from the class folder to the MAMP/htdocs folder on the hard drive, then deleted from the class folder. I referred back and forth between your instructions and the instructions for installing WordPress on MAMP. When I went to localhost/wordpress, it started the installation. When I set up the username I removed the @ since you thought that might be a problem. I was able to login to the dashboard and now I have to remember what I have to do there. A couple of questions, which should be simple to answer. I renamed the "class" folder mkjquery-test-theme, and that's in the upper left of the dashboard. In Themes, there is a jquery-test-theme. Do I need to activate that? Somewhere along this thread I did that and problems arose. Should I upload mkjquery-test-theme or can I rename mkjquery-test-theme to jquery-test-theme in the themes folder on the hard drive, and then activate in dashboard? Thank you again. Frustrating that we started on this on Sept. 7 and the class has been done for like three weeks. Class is still there, though.

    Michael

  • Dimitris

    Hey there mkleiner,

    hope you're doing good and don't mind chiming in!

    I'm very glad that you'd finally have a working WP installation to start up. As most probably you will need more of these in the future, I'd propose you to keep on learning how MAMP works. :wink:

    A couple of questions, which should be simple to answer. I renamed the "class" folder mkjquery-test-theme, and that's in the upper left of the dashboard. In Themes, there is a jquery-test-theme. Do I need to activate that? Somewhere along this thread I did that and problems arose. Should I upload mkjquery-test-theme or can I rename mkjquery-test-theme to jquery-test-theme in the themes folder on the hard drive, and then activate in dashboard?

    As long as I understand, these two themes should be exactly the same, with just a different folder name? Please advise!
    If this is the case, then activating either of these shouldn't be any harm. But if they do, you can simply cut/paste them in another location like your computer desktop, and the default TwentySixteen theme will be auto-activated instead.
    You can inspect them in /YOUR_LOCAL_WP_INSTALLATION/wp-content/themes/ folder.

    Warm regards,
    Dimitris

  • mkleiner

    I renamed the the directory in htdocs/wordpress/wp-content/themes back to jquery-test-them and activated the theme. I started back with a little bit of the course. Most codes are working, though, it's a bit hard to follow the code that is "creating the result." There's a lot in that section of the course, including looking at different jquery selectors, which is going to take some concentrated time to read and understand.

    Thank you for your help.

    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.