Having an issue, don't know why this is happening:
In the first instance, everything works just fine, the message is set and it displays:
$this->_helper->FlashMessenger()
->setNamespace('success')
->addMessage('Success!')
->addMessage('User ' . $this->_request->getPost('user_name') . ' sucessfully added!');
$this->redirect('users/index');
However, in this instance, it fails with the message:
Warning: Missing argument 1 for
Zend_Controller_Action_Helper_FlashMessenger::direct()
$this->_helper->FlashMessenger()
->setNamespace('error')
->addMessage('Failure!')
->addMessage('User was not added, please see errors below.');
Try changing your code to:
$this->_helper->getHelper('FlashMessenger')
->setNamespace('error')
->addMessage('Failure!')
->addMessage('User was not added, please see errors below.');
Related
I'm helping a client with getting their website ready for PHP8. After doing the update to the latest Joomla and making sure the template is updated, it runs fine on PHP8. I do however get the following error only on one page. The page where you have to create a new user:
Error: Failed opening required
'/usr/www/users/kznden/libraries/joomla/document/html/renderer/head.php' (include_path='.:/usr/share/php'): Cannot access offset of type string on string
I know this path doesnt exist anymore but how can I get rid of this error and the page working again? I opened the error.php file and believe the error is related to that file. If I'm wrong, please correct me. Specifically the following code:
$doc->setTitle($this->error->getCode() . ' - '.$this->title);
require_once(JPATH_LIBRARIES.'/joomla/document/html/renderer/head.php');
$header_renderer = new JDocumentRendererHead($doc);
$header_contents = $header_renderer->render(null);
Removing
require_once(JPATH_LIBRARIES.'/joomla/document/html/renderer/head.php');
doesn't seem to fix the issue.
enter image description here
I try to install the ARI Docs Viewer plugin of Joomla in localhost and I always have the following error: " Undefined property: AriDocsViewerContentPlugin::$stripUSC "
However, all the files to be displayed are all present in the local server.
When I disable the plugin, there is no error on the site and the document does not display.
I’ve already commented the next code tip and the error goes away but the document still does not appear.
if ($this->stripUSC) { // Alternatively:
preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xE2\xAF\x91", $source) but
it'd be slower. $source = $this->stripUSC($source); }
Does someone here already had this error ?
Thanks a lot!!!
I am trying to find the game someone is playing on twitch by using the api. I have setup the json_decode and it shows all of the content from the api. However whenever I try to print_r the game I get an error.
The error:
Notice: Undefined property: stdClass::$game in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\Portfolio -- Website\twitchstreaminfo\streaminfo.php on line31
PHP code:
$streamer = $_POST['username'];
$apiurl = "https://api.twitch.tv/kraken/streams/" . $streamer;
$apicontent = file_get_contents($apiurl);
$streamerinfo = json_decode($apicontent);
print_r($streamerinfo->game);
Try just doing the following first and verify the result:
print_r( $streamerinfo );
From what I can see with the API, the following should work:
print_r( $streamerinfo->stream->game );
Your error is saying that the propery of "$game" does not exist on the object "$streamerinfo". As suggested above, try priting the "$streamerinfo" to varify that it is valid. Another thing you can do to prevent this is to add the following :
if (isset($streamerinfo->game) {
print_r($streamerinfo->game);
}
That code will prevent this error, but not fix the problem. I suggest this as a final solution to help you solve the problem
if (isset($streamerinfo->game) {
print_r($streamerinfo->game);
} else {
print_r($streamerinfo);
}
This will keep your code from breaking in the way that it is now. But, it will also print "$streamerinfo" if it fails. This way you can see why it failed.
I am using this code to implement a 'Treasure Hunt' . I have very little idea about the code that I am working with . One thing I am trying to do is make the code work with XAMPP on my PC . I was able to fix the database errors that I was encountering whenever I tried to navigate to localhost/treasurehunt/admin/login . What I did was this -
Set a root username and password for the entire 'thing'
(using localhost/security/xamppsecurity.php)
Edited the database.php file with appropriate username and password (That of the 'root') .
Created a database (using localhost/phpmyadmin) and changed database.php accordingly .
Now , when I try to navigate to localhost/treasurehunt/admin/login page , I am getting an error . I tried fixing this from last two days (by searching on various forums) , but was not of "much" help . The error is as follows -
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$agent
Filename: core/Loader.php(829) : eval()'d code
Line Number: 9
Fatal error: Call to a member function is_mobile() on a non-object in
C:\xampp-portable\htdocs\treasurehunt\system\core\Loader.php(829) : eval()'d code on
line 9
Is there any way I can fix this . Please tell me which all code samples from which files do you guys need to understand the problem precisely . I will add the code to my question .
Thanks in advance .
Alright so I'm trying to get captcha to work here and I have this little error detecting thing that looks like this. I'm not going to paste the entire page as that would be way too long, only the essentials
page1
<?php require_once($_SERVER['DOCUMENT_ROOT'] . '/include/recaptchalib.php');
echo recaptcha_get_html($reCaptcha_publickey); ?>
<?php echo $_SESSION['devtest'];?>
page2
if (!$resp->is_valid)
{
$_SESSION['devtest'] = $resp->error . "testzzz"; // DEVELOPING, DELETE THIS
$errors = $errors . "'1',";
// Returns errors to page1
}
Now the $errors does have the '1', in it, it echoes the "testzzz" part of devtest fine but it displays no error.
Anyone know what I'm doing wrong? Thanks
EDIT: I followed this guide for the most part, i only changed the code for the if statement https://developers.google.com/recaptcha/docs/php
$resp->error is what you're looking for, $resp->is_valid is a Boolean value, and I think it's deprecated since reCaptcha became part of googles main tools so you might be checking a variable that doesn't exits. so (!$resp->is_valid) always returns TRUE.
Fixed it myself... i don't know why the default google code didnt work but simply
replacing
if (!$resp->is_valid)
with
if ($resp->error)
and it works for some reason