The Drupal stock module enables users to save a portfolio and have it displayed in a page.

This facility is not available for anonymous users, but there is an easy workaround for this.

If you want the portfolio to be displayed in a block in the side bar, then do the following:

1. Create a block, set its input format to PHP.

2. Insert the following code in it:

print stock_do_quote('short', 'IBM INTC GOOG');

Change the ticker symbols to those you want to display to anonymous users.

3. Select "anonymous user" in the roles.

4. Save the block and place it where you want.

If you want this to be displayed in a page, then do the same in a node, with the input format set to PHP as well, but use the following code:

print stock_do_quote('long', 'IBM INTC GOOG');

That was easy, right?



Thu, 2015/01/08 - 19:49

I found out that in drupal 7 it's a different order:

print stock_do_quote('IBM GOOG', 'long');

In fact I want to have some advice, i search for a more sofisticated method to display portofolios (with purchase price) with a minimum of analyses

Is your Drupal or Backdrop CMS site slow?
Is it suffering from server resources shortages?
Is it experiencing outages?
Contact us for Drupal or Backdrop CMS Performance Optimization and Tuning Consulting