
desbest
Members-
Posts
118 -
Joined
-
Last visited
Everything posted by desbest
-
When I uncomment the appropriate lines in section 9 of htaccess to force or redirect all http links and requests to https, I am always taken to the https homepage instead of the page I'm looking for. Below is my htaccess. https://gist.github.com/desbest/5a02a971e2656585091f9df8f6bbd921 It works with http://ekzaga.com/education but not with http://ekzaga.com/blog What is going on?
-
I'm making some progress. I removed include("_header.php"); and include("_footer.php"); and now it logs into the right account. I will have to find out which of the header or footer is causing the problem, and which line of those files. Update I think what caused the problem is at the end of _footer.php I had <?php to start some php code but I never used ?> to close the php code so it caused a quirk 2nd Update I have fixed the problem. The cache became faulty so I deleted the templates/ folder that was inside the cache and now it works.
-
I ran tracy and got rid of all the errors and I still get the same problem of it logging into my "desbest" account instead of the account I specify. I have a related question. This page says to use $session->get() to get session variables. If that is true, then how come when I use $session->get("username"); it comes up as blank but when I use $session->username it doesn't come up as blank?
-
I have just turned debug mode on and have printed the output of debug mode, so I could see if the session variables are being set correctly. It turns out the session variables are being set correctly, but still the account being logged into is my "desbest" superuser account instead of the "teststudent" account. try { // echo "<br><h1>dauser[name] is </h1>".$dauser->name; // echo "<br><h1>dauser[pass] is </h1>".$dauser->pass; echo "<br><h1>session[username] is </h1>".$session->username; echo "<br><h1>session[dapassword] is </h1>".$session->dapassword; // $session->set("dapassword", "testpassword"); // $session->set("username", "teststudent"); // $task = $session->login($session->username, $session->dapassword); //use plaintext password // $task = $session->login("$session->username", "$session->dapassword"); $task = $session->forceLogin($session->username); if (!$task){ $notice = "Failed to login to your newly created user. Contact technical support."; } } catch(\Exception $e) { throw new WireException('Unable to login as user'); } I have no idea why it's logging into a different account than what I specify, if I was logged out before going on the web page and showing debug mode says that the session variables are set to what they should be.
-
forceLogin() does work but with my code, it logs into my "desbest" superuser account instead of the account I want the code to login into which is the user which has just been created. My code for the signup.php template file is 643 lines long, and it looks like I'll have to give someone my entire website for them to run it on their computer and fix it and I might have to pay them to fix it. As when I isolate the code to its minimal form, it works, but when I use my 643 lines long signup.php template file, it fails to work and I cannot see what is wrong with my code or if there's a bug with processwire. Do you think I'll have to post a thread in the Jobs section of processwire?
-
I have changed the variable from $session->password to $session->dapassword and It still doesn't work. Also I am using $session->username which is different from the "name" field used for the user template. $dauser = new User(); $dauser->pass = $session->dapassword; $dauser->name = $session->username; $dauser->save(); try { echo "<br><h1>dauser[name] is </h1>".$dauser->name; // echo "<br><h1>dauser[pass] is </h1>".$dauser->pass; echo "<br><h1>session[name] is </h1>".$session->name; echo "<br><h1>session[dapassword] is </h1>".$session->dapassword; $task = $session->login($session->username, $session->dapassword); //use plaintext password if (!$task){ $notice = "Failed to login to your newly created user. Contact technical support."; } } catch(\Exception $e) { throw new WireException('Unable to login as user'); } The login details are correct but instead of logging into the user called "teststudent" with the correct password, it logs into my superuser account called "desbest". What is going on and how do I fix it?
-
I've changed my code to check if $task is null or not, but the task isn't completing and I don't know why. If the details are correct, why isn't the user being logged into? Update Now it is logging into my superuser account instead of the account I specify, when I use $session->login I have displayed the variables on the web page I am using to login with the username and password, and it is logging into a completely different account that has a different username and password. What is going on?
-
I cannot use $session->login() to login as a specified user, and it doesn't return false or null. Here is my code. try { echo "<br><h1>dauser[name] is </h1>".$dauser->name; echo "<br><h1>session[password] is </h1>".$session->password; $task = $session->login($dauser->name, $session->password); if ($task === false){ echo "failed to login"; } // $darealuser = $users->get($dauser->name); // print_r($darealuser->getArray); // $users->setCurrentUser($darealuser); // $session->_user_id = $darealuser->id; } catch(\Exception $e) { throw new WireException('Unable to login as user'); } The name and password is correct, as I have printed it on the page to check it. I can enter a correct username and password, or an incorrect one, and it fails to login as the user, and it doesn't return true or false. The $session->login line fails to execute. What is going on?
-
When I use the following code I get an error. <?php function test(){ return $page->httpUrl(); // return $wire->page->httpUrl(); } $test = test(); echo $test; I get this error. How do I fix it? How do I get the current page's url inside a function? The function is being stored on the same template file of the page being displayed.
-
How do I get the title of a SelectOptions option, by its option id?
desbest replied to desbest's topic in Getting Started
Yes but I'm not getting the title from the current page, so I can't use the $page ones. How do I change $options = $fieldtypes->get('FieldtypeOptions')->getOptions("experienced_in")->title; to choose the ID I want, as there are multiple options and it keeps getting the first one. I want to choose a number of one of the array entries. I tried to add [0] or [1] to the line of code above, and it didn't work. -
Alternatively you can hold down the shift button and click refresh to clear the cache for the website and refresh.
-
When I upgrade from Processwire 2.8 to 3 I get an error. It says Error 500. I have commented out the "500 NOTE" section on .htaccess, I have checked the error log file in site/assets/logs and it's empty. How do I get the upgrade to work? Is it a namespace issue? I can't see anything in the upgrading instructions on how to fix it.
-
Is there a way to get the v1 templates working on a processwire website? I really like the design of the v1 website. I cannot install the Skyscrapers with the v1 templates on Processwire 3.0.62 and I cannot replace the templates folder from dadish's skyscrapers profile with the templates from v1 to get it to work.
-
What's the difference between https://github.com/dadish/pw-skyscrapers-profile and https://github.com/ryancramerdesign/skyscrapers2 ? If they're both the same, why does the dadish one exist? Is there a way to get a site profile with the original blue Skyscrapers 1 design?
-
How do I install Skyscrapers profile 1? I did the instructions by replacing all the files in site-default but when I try to install the installer crashes and I'm given a blank page.
-
How do I check if a field is blank or not, using a selector? I couldn't find any information on how to do this on the Selectors documentation, and on the forum. I would like to use $pages->find() Do I have a NULL variable and do something like $nullvar = NULL; $companiesacceptedawaitingemail = $pages->find("template=company, approved=1, approval_email_sent_datenumber!=$nullvar");
-
What is the difference between $pages->find() and $pages->get() ? They both look the same to me. Is ->get() for finding an individual page whereas find->() is for more than one? Also how do I find a page using a selector based on which user created the page? I couldn't find anything under Selectors documentation on how to do it.
-
Is there a way to store data in the same way as pages, but not appear as a page? I would like to store private messages using Processwire and the $page and $pages API provides a good way to do so. I know I can stop the fields inside pages from being visible in the admin panel, but is there a way to not have the page be seen in the Pages section, similar to how the Form Builder stores the entries to the forms without that being stored in the Pages section?
-
How do I get the value of a checkbox POST data?
desbest replied to desbest's topic in Getting Started
I have found a fix for this. In HTML, whenever a checkbox is checked and is POSTed it has a value of "on". If the checkbox is unchecked it has no value. Here is the working code. <?php if($input->post->changesettings) { $deactivated = (isset($input->post->deactivated)) ? 1 : 0; $user->deactivated = $deactivated; } ?> <form method="POST" action=""> <input type="checkbox" name="deactivated" <?php if ($user['deactivated'] == 1) echo "checked='checked'"; ?>> <input type="submit" name="changesettings" value="Change settings" class="bigbutton" /> </form>