You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a simple plugin to set and get a pdf path like this:
<?php
...
add_action('wpProQuiz_quizEdit_tab_content_plugins', 'pdf_path');
function pdf_path()
{
$quizId = isset($_GET['quizId']) ? (int)$_GET['quizId'] : 0;
$pdf_path = '';
if($quizId){
$quiz = new WpProQuiz_Model_QuizMapper();
$quiz_data = $quiz->fetch($quizId);
$quiz_plugin = $quiz_data->getPluginContainer();
if($quiz_plugin){
$pdf_path = $quiz_plugin->get("'pdf_path'");
}
}
?>
<div class="postbox">
<h3 class="hndle">PDF Handbook (Optional)</h3>
<div class="inside">
<p class="description">
Please upload the pdf handbook file first via <a href="<?php echo admin_url(); ?>upload.php">media upload</a> then copy the path on the box below.
</p>
<div>
Pdf Handbook Path : <input type="text" name="plugin['pdf_path']" size="100" value="<?php echo $pdf_path; ?>">
</div>
</div>
</div>
<?php
}
?>
but on the page template (frontpage) I can't find a way to get the current quiz id. I put the quiz shortcode on the page with customized template but I dont know how to find put the quiz id. it should be like this:
<?php
$quizId = 1; //hardcoded. how to get the current quiz id???
$pdf_path = '';
$quiz = new WpProQuiz_Model_QuizMapper();
$quiz_data = $quiz->fetch($quizId);
$quiz_plugin = $quiz_data->getPluginContainer();
if($quiz_plugin){
$pdf_path = $quiz_plugin->get("'pdf_path'");
}
if($pdf_path){
?>
Also I found a problem on Wp-Pro-Quiz/lib/model/WpProQuiz_Model_PluginContainer.php. the 'exists' function supposed to be like this
public function exists($name)
{
//return isset($name);//--> not correct
return isset($this->_data[$name]);
}
The text was updated successfully, but these errors were encountered:
I created a simple plugin to set and get a pdf path like this:
but on the page template (frontpage) I can't find a way to get the current quiz id. I put the quiz shortcode on the page with customized template but I dont know how to find put the quiz id. it should be like this:
Also I found a problem on Wp-Pro-Quiz/lib/model/WpProQuiz_Model_PluginContainer.php. the 'exists' function supposed to be like this
The text was updated successfully, but these errors were encountered: