User comments on course page on frontend in Tutor LMS - comments

In wordpress, on the frontend, in Tutor LMS on a course page, how can we have a section(at the bottom) where users can comment; like in Learpress?
Please help!

By default, the Tutor LMS doesn’t have a comment form for the course details page. The comments is removed based on majority customer’s feedback because this is not a blog post page but a product page. However, you still can add a comment form very easily just by editing two files and following the steps:
Open this file /tutor/classes/Post_types.php,
-In this file, you will find this code array( 'title', 'editor', 'thumbnail', 'excerpt', 'author'),
-You need to replace the code with this code array( 'title', 'editor', 'thumbnail', 'excerpt', 'author', 'comments'),
Now you need to edit this file
/tutor/templates/single/course/instructors.php
-In this file before this code <?php } do_action( 'tutor_course/single/enrolled/after/instructors' );
-You need to add this code <?php comments_template( '', true ); ?>
Now you need to edit your course and enable comments for the course. to enable comments check the provided screenshot https://prnt.sc/26q0usm
Thank you

Related

Breadcrumb in magento

I am to magento. I got breadcrumb in my static blocks by default. But In my dashboard page, it is not displaying.I have searched in Google but nothing works. Can anyone tell me how to add breadcrumb in my dashboard page.I want to display breadcrumb without using page.xml
Thanks in Advance.
Go to app\design\frontend\your-package\ your -theme\template\your-modulename\phtml-file and add the following code snippet as per your requirement
// to get breadcrumbs block
<?php $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
// add first item ‘'home'’ with link
$breadcrumbs->addCrumb(
'home',
array(
'label'=>$this->__('Home'),
'title'=>$this->__('Home'),
'link'=>Mage::getBaseUrl()
)
);
// add second item ‘'brands'’ without link
$breadcrumbs->addCrumb(
'brands',
array(
'label'=>$this->__('Brands'),
'title'=>$this->__('Brands')
)
);
echo $breadcrumbs->toHtml(); ?>
By default in magento breadcrumb not come for member account section. You can add breadcrumb using xml. Here is the blog post that explain complete steps:
http://www.douglasradburn.co.uk/adding-breadcrumbs-to-customer-account-pages-in-magento/
You can also use the below extension to add breadcrumb links:
http://www.magentocommerce.com/magento-connect/customer-account-breadcrumbs.html
You need to check its compatibility with latest version.

Edit JomSocial Joomla Registration Page & Adding Content

I'm running JomSocial 3.2 on Joomla 3.
I want to add some content to the right side of the registration page.
Some pictures and other contents.
So far, i've been able to get to the "register.index.php" file,
which is the file that displays some of the content in the homepag.
The file is in: "/site_root/components/com_community/templates/default/" folder
but i've not been able to fully edit the whole registration page.
This could be done in many different ways - even without editing any file. Install this extension: http://extensions.joomla.org/extension/advanced-module-manager and when editing module you'll have additional tab called "tasks" There will be field URL, type inside URLs of your registration form. Thanks to this you'll be able to assign modules to registration form.
You could also override for:
ROOT/components/com_community/templates/default/register.index.php
Copy it to:
ROOT/templates/your-template/html/com_community (if you don't have "html" or "com_community" folders, feel free to create them)
Then you may create module position inside file using this code:
$modules = JModuleHelper::getModules( 'reg-positon' );
foreach ($modules as $module) {
$_options = array( 'style' => 'xhtml' );
echo JModuleHelper::renderModule( $module, $_options );
}
Above code creates module position: "reg-positon'. You'll need to type this name manually as it will be not listed on module positions list.
Now you'll need a bit of html to display it on right or left of registration form.

Magento: No 'Add product' button on back end new order

I've just installed the latest version of Magento 1.8 and everything is great and works perfectly. However, we've just discovered that there is no 'Add product' button on the admin new orders page. Everything else works as before, including:
customers can order from the front end
admin can add a product from the 'last ordered' or 'recently viewed products' from the customer recent activity panel
It therefore seems to be an issue with just this button alone. We've tried the below fixes without any success:
removed theme from our site (revert to default); button still missing
noted a previous bug relating to payment methods in v 1.7; tried copying all payment .phtml files to theme; button still missing
At a loss as to what this could be. All other functions appear to be working. Has anyone got any pointers as to how to resolve this?
This isn't exactly an ideal fix, because it involves changing core functionality, but the "Add Product" backend button is handled in:
app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items.php
What you're looking for specifically is the getButtonsHtml function. Having the same issue after upgrading from 1.6 to 1.9, I changed mine to look like this:
public function getButtonsHtml()
{
$html = '';
// Make buttons to be rendered in opposite order of addition. This makes "Add products" the last one.
$this->_buttons = array_reverse($this->_buttons);
//If the buttons array isn't empty, let it do its thing
if (!empty($this->_buttons))
{
foreach ($this->_buttons as $buttonData) {
$html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($buttonData)->toHtml();
}
}
else {
$addButtonData = array(
'label' => Mage::helper('sales')->__('Add Products'),
'onclick' => "order.productGridShow(this)",
'class' => 'add',
);
$html .= $this->getLayout()->createBlock('adminhtml/widget_button')->setData($addButtonData)->toHtml();
}
return $html;
}
It works, but it's really just a hackjob fix. I'm hoping someone more knowledgeable than I can come up with a proper solution.
Edit - Leaving the above answer, but I sussed out my personal problem. I was running a dual install of Magento, and I forgot to change the .htaccess of my Minify library to re-route to the newer install. So it was compiling the old 1.6 JavaScript and using it on my 1.9 install.

Magento Widget - How to confirm access to block code?

I have created my first Magento widget on a test site (same code and configuration as my live site). The widget works perfectly on the test site. However, having moved the code to the live site, I can configure the widget instance, but the output of the widget is not showing on the product page. So I know Magento is pulling information from the widget's config.xml and widget.xml files.
I have confirmed that the correct layout update is being inserted in the core_layout_update table. The information on the live system's table is exactly the same as that on the working test site.
I have confirmed that the file permissions and ownership are correct on the live site.
I have confirmed that I can put another (Magento supplied) widget in the exact spot on the configurable product page (Product Extra Info). So I know that my templating, etc. is not getting in the way of adding the widget in that spot.
I've tried deleting the widget instance and recreating a new instance of the same widget.
I have compared the code to the test site and copied the code straight from the test site. Still no success. I have enabled php_flag display_errors in .htaccess and no errors are shown. And no errors are showing in the exception.log when enabled.
The live and test systems are on different servers, different OS's, different versions of PHP (both 5.3.x). I've refreshed all the caches and confirmed that the test widget is showing so I don't think this is a caching issue.
How is the best way to confirm that Magento on the live site can actually access or find the Block code for my widget? As indicated I know Magento is accessing the widget.xml file in my local code directory. Not sure if installing Alan Storm's CommerceBug is the way to trace or dump what Magento is trying to load (modules, widgets, etc) for the page in question.
Verify that you have your xml in the /app/etc/modules folder.
You can turn on Block Hints by going to Admin->System->Configuration->Advanced->Developer, change the Current Configuration Scope to Main Website and click on Debug. Change Template Path Hints to Yes and save.
Verify your filenames. This has gotten me a number of times. I develop on a Mac (non case-sensitive), and occasionally when I upload to Linux (case-sensitive), it breaks. One of the first thing I check is the file name's case.
Ensure that the class name matches the filename.
The next step I'd take is to take a look at the final page layout xml generated for the page your'e adding the widget to and ensure a bit of Layout XML is being added to the page for your widget. If it isn't, there's something wrong with the Layout XML Updates that are added to the table via the widget UI. If it is, then start debugging why the particular chunk of generated layout XML isn't being added to the page.
This is the top-down approach to debugging the problem, but it's the only way I know to be sure.
I had the same problem. It's my decision:
app\code\local\Mage\Core\Model\Resource\Layout.php
When 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout') result is not correct: 'theme' => 'multistore', should be 'theme' => 'your_theme'.
So, delete argument 'layout' in function getTheme() and get right result
*/
class Mage_Core_Model_Resource_Layout extends Mage_Core_Model_Resource_Db_Abstract
{
...
public function fetchUpdatesByHandle($handle, $params = array())
{
$bind = array(
'store_id' => Mage::app()->getStore()->getId(),
'area' => Mage::getSingleton('core/design_package')->getArea(),
'package' => Mage::getSingleton('core/design_package')->getPackageName(),
// 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout')
'theme' => Mage::getSingleton('core/design_package')->getTheme()
);
foreach ($params as $key => $value) {
if (isset($bind[$key])) {
$bind[$key] = $value;
}
}
$bind['layout_update_handle'] = $handle;
$result = '';
$readAdapter = $this->_getReadAdapter();
if ($readAdapter) {
$select = $readAdapter->select()
->from(array('layout_update' => $this->getMainTable()), array('xml'))
->join(array('link'=>$this->getTable('core/layout_link')),
'link.layout_update_id=layout_update.layout_update_id',
'')
->where('link.store_id IN (0, :store_id)')
->where('link.area = :area')
->where('link.package = :package')
->where('link.theme = :theme')
->where('layout_update.handle = :layout_update_handle')
->order('layout_update.sort_order ' . Varien_Db_Select::SQL_ASC);
$result = join('', $readAdapter->fetchCol($select, $bind));
}
return $result;
}
}

Dynamic Image Links Depending on Excerpt/'Single Post' View in Wordpress

I'm working on a new Wordpress theme; the default index view displays the excerpts of recent posts. Some posts will be regarding file downloads, and include an image, description, and link to the location where the described files are hosted. The images for these types of posts will be anchored with links(other types of posts may contain images that are not linked).
For these types of posts, I would like the images to link to their entry's full post views(single.php) when displayed in excerpts, but for the same images to link to an external download link when displayed as part of the full post view.
I'm not sure how exactly I would accomplish that.
Any help would be greatly appreciated!
Because I don't have post thumbnails defined, and since posts may or may not contain multiple images, I ended up doing it this way:
I turned off tags in excerpts(I had an excerpt plugin enabling tags in excerpt), then I added the following to the function.php file:
function catch_that_image() {
global $post, $posts;
$first_img = ''; ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
$post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){
//Defines a default image
$first_img = "/images/default.jpg"; }
return $first_img;}
Then I added the following to the main index template file in between the posts title and the excerpt/content:
<p><img src="<?php echo catch_that_image() ?>"></p>
Random note: It's wrapped in a for styling reasons.
Thanx again for guiding me in the right direction.
if your theme uses 'the_excerpt()' for the front page, I think you can add a filter in functions.php, and with a regexp change the link href from the download link to the permalink.
something like,
function replace_link($content) {
if (is_home())
return preg_replace('regular_expression', get_permalink(), $content);
else
return $content;
}
add_filter('the_excerpt', 'replace_link');
I can't create an actual regular expression without knowing what your download link looks like

Resources