how to run an admin task in joomla with a cron job? - joomla

I wrote a custom component in Joomla! that pulls in content from an XML feed and stores it in the Joomla database. I want the admin URL (/administrator/index?option=com_mycomp) to run via cron once every night to run the component. I can't figure out how to make this work, though, since the component is an administrator task and you have to be logged in to run it.
How do I get by this? I tried including my user/pw in the url (http:admin:password#www.mysite.com/joomla/administrator....) but it doesn't work. Is there anyway other way to send login credentials, or any other way to do this?

I know this thread is very old, but here's how I handled a similar task.
The "trick" is to take the custom PHP code you have created, and embed it into an article within your Joomla website.
I did this by using the JUMI extension, that allows custom PHP code to be stored within the Joomla repository and embedded, as required, within an article.
Then, create a CRON task that will activate the appropriate URL for the page containing the code you want to run.

Just put your script in the administrator directory of the component like
/administrator/components/com_yourcomponent/cron.yourcomponent.php
This is how FeedGator handles cron tasks [Sounds very similar to what you're trying to do.] ... you can also write a frontend controller in your component per one of the comments
========== [Update] ============
I created this ultra-simple installable component that could also be used for this purpose. It allows for a frontend menu item to be assigned to a php page (including the route as suggested). So you:
install the component
create new menu item, (may want to use a 'hidden' menu) select the 'show' view option and enter the script to run via cron in 'file to include' like path/yourcron.php
call the 'page' in your cron or test using: yourjoomlasite.com/index.php?option=com_show or yourjoomlasite.com/your-menu-alias

Mostly corn urls works from front-end even if your component deals with administrator only in Joomla.
So whatever your code in admin cron get it to front-end & so that your cronurl becomes like index.php?option=com_yourcomponent&task=cronjob.
Use this url to set cron using cPanel.
However this solution doesn't need to see whether admin is logged or not.

Related

Joomla Cron for administration

In my website, I want to update data from external source everyday.
I create an administration module and he works manually but I need automate the process.
I think a cron can do that but the problem is the login ?
Joomla 3.
Set up the cronjob on the joomla server needs no login. Login is only needed via Http Requests, A cron job on the server dosent need a login (cron job on same server with joomla)
But as module it will not work. Why just hit a php script as cronjob?
A module needs joomla rendering in most cases and this will not work!

custom contact form not working with magento installation

I want to implement this Contact form from kontaktformular.com inside a separate folder (named "custom-contact-form") on my Magento root directory.
Eg: mywebsite.com/custom-contact-form
Now, kontaktformular.com gives you whole package with html, php and css files to make and run your custom contact form. Here is the package.
One of the files that they give out is test.php to send a test mail to a given email address to see if everything works all right or not. This file is has a pretty simple php script to send an email to a secific email address. Now, it doesn't work! And I can't figure out why? Is it because of some kind of PHP conflict with magento installation?
Infact, I have tried many other simple contact form scripts and none of them seem to work.
I want to know the reason causing it not to work. Also, is there a way to add a custom contact form in magento WITHOUT creating a new extenshion?
oh, why do you want use that contact form?
the magento connect has this very nice webforms extension.
http://www.magentocommerce.com/magento-connect/webforms-community-edition.html

Is there a class or a way that lets you run laravel code via command line?

I'm managing a website where I need to update its contents by getting rss feeds, I'm always going to my update link/route via web browser to update.
I'm planning to use crontab so that I don't need to manually update it, So is there a way to run that code via command line?
In short: Yes.
Laravel has an extensive CLI interface which allows you to do exactly that. In these commands, you have access to all Laravel resources as if it was run by the webserver.

Need a Joomla! component "reminder by mail"

I need a component for Joomla 2.5 to remind people about this website in certain time.
On frontend will be the form:
Remind me about this website on:
"email field"
|dd| |mm| |yyyy| / (date selector)
| remind |
So the component should create a cronjob on this date to send an email. Can you advice something, please? Or suggest any solution?
You definitely need to store a list of emails and dates in some table.
Cronjobs are outside of Joomla's domain and may not be set by Joomla.
So you would typically provide two solutions to your users:
Create a frontend task that performs the mailing: a dedicated controller/task in a custom component usually, something you would invoke with
index.php?option=your_component&task=cron
Echo the correct invocation string and ask your user to schedule it as appropriate.
Run a check in a plugin, so after rendering is complete you can perform your additional tasks. There will be no cronjobs since it will be run by Joomla itself on each site visit. You want to make sure your plugin doesn't invoke the function too often or it will kill the site.

Magento - Create Customer Account form is missing

On a Magento 1.11.1 site (Pro).
When I go to the URL [site]/customer/account/create I should get the form for creating a customer from the file /frontend/base/default/template/persistent/customer/form/register.phtml in block Mage_Customer_Block_Form_Register. Instead there is no such block included (show hints and show blocks enabled).
The customer login form works [site]/customer/account/login by displaying the form from file /frontend/base/default/template/persistent/customer/form/login.phtml in block Mage_Customer_Block_Form_Login. This works fine.
I'm using basically the modern theme with modifications (in a separate directory).
Also, customers are still able to create an account via the checkout process.
Is there an configuration parameter that might be set that could disable the standalone 'create customer account' functionality?
Could I have some issue with the templating that is getting in the way of displaying this register block?
So far I have not found the program logic that controls whether the register block is included or removed or anything? I've checked on file permissions and everything else I could think of, but there is obviously something I am overlooking or not aware of.
Any pointers on discovering the source of the problem would be appreciated.

Resources