Block doesn't update

rapsli - February 14, 2008 - 13:39
Project:Block Refresh
Version:5.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hello
Great module. But somehow it doesn't work. I assigned the "who's online block" to refresh every 30 seconds. It does so firebug tells me. But somehow the code that comes back from the server with the updated code in it isn't replease with the block. :(

BTW: Your demosite has an error. The block point to an invalid url.

#1

swentel - February 19, 2008 - 12:08

The problem why it doesn't refresh is in block_refresh.module on line 77. The condition will always fail because of the use of ||.
Attached is a patch which solves this problem.

AttachmentSize
block_refresh.patch 591 bytes

#2

x3graphics - February 19, 2008 - 22:56

I have a block that loads the ads module which I would like to refresh every 5 seconds. This seems like the right module but it doesn't work. Without the patch it didn't do anything. After applying the patch it does attempt to refresh. After 5 seconds the block disappears then the whole page goes blank with only the next image ad on the page, and thats all that is on the page. The URL is still the same too.

Any Suggestions.

Thanks
X3

#3

swentel - February 20, 2008 - 18:41

Hmmm,

This is a hard one. I had this problem once too, the main problem when using ads (you are probably using the openads module ?) is that the javascript get's fired and doesn't find the exact div anymore, so the add just overwrites the complete html. I had to use an iframe with a seperate php file serving the ads. Basically this small php file did this:

- connect to the drupal database (you can do a bootstrap just for database)
- get the exact zone which you can for instance get from a url variable which is passed via the iframe url
- get the right variable from the database and serve the request
- add a meta refresh to this php file

Anyway, I'm going to try it with this module also, I'll reply again if I see any solution!

#4

x3graphics - February 20, 2008 - 23:30

Thanks swentel for looking into this. The module I am using is this one http://drupal.org/project/ad .

X3

#5

openadsmods - February 21, 2008 - 05:32

I can help you to fix this problem please contact info@openadsmod.com for more information. Already we have done many modules in openads and we have more clients around the world.

Also visit our site www.openadsmods.com

#6

aaron - February 28, 2008 - 21:43
Status:active» postponed (maintainer needs more info)

the ||'s should actually be ok. i don't understand the problem -- i'm able to get that block refreshing just fine.

make sure you go to the block you want to set and check on the auto refresh checkbox.

afterwords, you can see if it works by going to /block_refresh/[module-name]/[delta], such as /block_refresh/user/3 for the who's online block. you should get content if that works.

maybe there's a conflict with that other module?

thanks,
aaron

#7

aaron - February 28, 2008 - 21:44

make sure to grab the latest version from the repository -- i just added some changes, so they might not be loaded in the archive until tomorrow.

#8

x3graphics - March 1, 2008 - 00:29

Ok, so I updated and installed the latest files. Unfortunately it still doesn't work, at least with the advertisement module. Originally it didn't work at all, auto refresh and manual, did nothing. I changed the two || to && on line 101 and get the same results from before with it trying to refresh and then going to a blank page with my next random ad on the page and that is it.

#9

aaron - May 1, 2008 - 17:08

x3graphics -- i haven't worked with the advertisement module. but can you get it to work with any other module (such as who's online)? it might be a conflict between them.

alternatively, it could be your browser. what browser/os combo are you using?

#10

aaron - May 1, 2008 - 17:14

based on another issue i just saw, you might need to refresh your menu:

1) make sure you have the latest version of the module
2) update it
3) visit /admin/build/menu for good measure

see if that helps

#11

petya_vulcheva - May 9, 2008 - 10:14
Status:postponed (maintainer needs more info)» active

Hi I tried the block refresh module and after I used the patch it worked, but only with FireFox. When I am browsing the page with IE the block doesn't refresh. Does anyone knows how to fix this?

#12

aaron - May 28, 2008 - 03:03
Status:active» postponed (maintainer needs more info)

do you have user role permissions configured?

#13

mhaas01 - June 1, 2008 - 05:38

I, too, have loaded the module and failed to make it work. In my case, I want to use it with the Random Images module, but I also tested it with a simple view module.

Could you tell me how to use the patch? I clicked on it and my screen showed a page of code, but I don't know what to do with that code. Do I paste it into the module? If so, where do I paste it? In the end, in the front?

#14

NickSI - June 12, 2008 - 16:05

It seems that check "module_implements($block, 'block')" fails on blocks defined by views module. May be same problems exists with ads module (I am not familiar with that one). Of course this is not Block Refresh issue, but it looks like should either skip this check or choose another approach

#15

deverman - June 25, 2008 - 08:15

I get the following error for this module. I think it is setup right I turned on the permission for the user. Any idea?

warning page not found Jun 25 2008 - 4:08pm block_refresh/views/view_name

#16

sdsheridan - October 16, 2008 - 20:27

If you're writing your own module, is there something special you have to do to get this to work? When I try the test above in #6, i don't get content for my block, while i do for other blocks. I'm wondering what I may have done wrong in my module.

#17

sdsheridan - October 16, 2008 - 20:39

OK, changed my comment above (#16) as I figured out the problem, and it wasn't my module.

In block_refresh.module, in the function block_refresh_block_content, the initial 'if' statement reads:

<?php
 
if (!isset($block) || !isset($delta) || ($block != 'block_refresh' && !module_implements($block, 'block'))) {
   
drupal_not_found();
  }
?>

The function 'module_implements' (http://api.drupal.org/api/function/module_implements/5) returns an array of modules implementing a particular hook, which should be the first parameter of a correct call to this function. It does not return a boolean value. Clearly this is not really what we want here.

I believe the function desired here is 'module_hook' (http://api.drupal.org/api/function/module_hook/5).

So, the code should actually be:

<?php
 
if (!isset($block) || !isset($delta) || ($block != 'block_refresh' && !module_hook($block, 'block'))) {
   
drupal_not_found();
  }
?>

I've made this change in my block_refresh.module, and now it's working as it should. The 'or' operators ( the ||s) in the 'if' statement are, I believe, correct as is (and as I've shown in the corrected code).

Hope this helps.

shawn

#18

corona ronin - March 6, 2009 - 00:07

Hey,

I have changed the code to include !module_hook instead of !module_implements, as directed by comment #17, and theres is no change. Blocks do not refresh at all, but the new node does appear in the block if the page is reloaded.

I have the node add form to set up to submit via ajax and to appear in a block, but the block doesn't refresh. I'm trying really hard to get this to work...any thoughts?

Thanks a ton!

#19

dunkelfuerst - March 6, 2009 - 01:13

Do you have it online, so that i can have a look on it?

#20

corona ronin - March 6, 2009 - 01:57

Yes sir!

It's running on my development site: http://www.dev.lifeundersun.glexia.net/

I put a pw on to prevent search engines from indexing it, the un/pw are both "dev".

You'll need to log into the site to add content, so use this account with un/pw both "basicuser."

The blocks can be found here: http://www.dev.lifeundersun.glexia.net/life

You'll see a box under the "life" image with a title, body, and a submit/preview button, and below it and to the right of it are the blocks which show a listing of those nodes. If type a title and some text in the body, and you press submit you'll see the ajax progress bar go, and the node will be submitted but the block will not refresh. But if you reload the page, you'll see the node in the block.

What do you think the problem might be?

I really appreciate you looking into this man, it's been a headache for a while. This module is just so cool I have been just itching to play with it, so thanks again!

#21

dunkelfuerst - March 6, 2009 - 05:05

Okay, i'm getting the problem. It's a problem with the dynamic_views.module you are using, because it's changing the id of the block and then jquery can't find the block anymore.

If i find a solution to this problem, which can be done within the block-refresh.module, i'll post it here.

#22

corona ronin - March 6, 2009 - 18:51

Hey,

I have disabled the dynamic views module and deleted it from my system. I have also disabled dynamic load, another module (provided with javascript tools) I was looking for to get ajax based refreshing on my blocks. However, the blocks still will not refresh after I have disabled both these modules and deleted dynamic views (there wasn't an option to uninstall dynamic views).

Now that dynamic views is not running, could you take another look and see what could be causing the problem, or do you have any other suggestions I might try to solve this problem?

Thanks so much!

#23

dunkelfuerst - March 6, 2009 - 19:30

I don't really used panels yet, but it seems, that it doesn't create normal blocks.

I see just 1 solution:
Since this is a BLOCK-refresh-module, make a block with the latest "statuses", f.e. with the views.module. This block is placeable everywhere on your site, even in the panels, and it will work(hopefully).

#24

corona ronin - March 6, 2009 - 19:58

Hey,

Thats what I have done. What you're seeing is a view, block view, not page. The prior view type (with pictures) was list form, now it's "full node" view. The only thing making up the view is "provide block" some fields (for list view, no longer necessary because currently it's "full node view," filters set as: node type "status," and set by node-created time to be "decending" so the most recent come up first, theres no arguments or any other filters, its a simple block view to show all nodes of that type in decending form.

Panels doesen't create the block, it provides a fixed box (essentially a div) for you to place blocks inside of it. The block you see on my site was created by views, not by panels. Just in case panels might be causing a conflict, I have placed the block not just in panels, but the right sidebar as well, so the same block appears in both places to see if panels is causing a conflict. So your recent suggestion was the situation all along.

With this in mind, what do you think could be causing the problem? If you would like access to anything inside the system to help investigate or would like anything else, I'll be more than happy to provide it.

Thank you!

#25

dunkelfuerst - March 7, 2009 - 18:16

Okay, I've looked into your site. I'm sry, but i think, it is not possible in Drupal 5 to use block-refresh with views-blocks, because views in 5.x version doesn't render the block correctly, so block-refresh isn't able to get the content just of the views-block and therefore it cannot update it.

Now, the only solution, i can think of, is to update the whole site to drupal 6.x, which is a lot of work, because many of your views-blocks are not exportable to the views-6.x version. (you would have to create them completly new) Of course your other modules would possibly not work with the 6.x version, or work different.

#26

corona ronin - March 7, 2009 - 23:41

Are you sure about this? I have trouble believing that Views doesen't export blocks correctly, it's one of the most central modules in Drupal. I appreciate your efforts, but I can't imagine that the reason the block wont refresh is a problem with views. There has to be another way to handle this...

#27

dunkelfuerst - March 8, 2009 - 01:07

I tried to export the test view, and import it into mine(6.x), and it didn't work. But maybe this was because of missing dependencies...

Nevertheless, i think the problem is really caused of views. I can't imagine, why else the id should happen to miss.

BUT, sure, everyone who has another idea of why it is going wrong, is appreaciated to solve this.

#28

corona ronin - March 8, 2009 - 01:52

Well the block ID (delta) shouldn't change...and any views exported by 5x into 6x wouldn't work at all because 6x is a completely different code base. The block ID shouldn't change because of views. There should be a way to find the delta, as outlined by this post:

http://drupal.org/node/104319

#29

dunkelfuerst - March 8, 2009 - 02:19

Yeah, that's what i meant, there will be problems or at least it will be a hell of a work.

Okay, you could give the block the id manually(by the panels module), but i don't know, why the module can#t get the data of the block, could you please post the code of your "block_refresh_block_content()"-function in the module?

#30

corona ronin - March 8, 2009 - 18:04

How do I get that code to post? I looked at this support queue issue here: http://drupal.org/node/288545 and there is a log file, what module creates a console which outputs code? Devel?

#31

dunkelfuerst - March 9, 2009 - 01:36

No, this is done by Firebug, a firefox extension. But you don't need it, because i already know, that the ajax-request, sent by jQuery simply fails,. That's why i want to look into the function i mentioned above.

http://www.dev.lifeundersun.glexia.net/block_refresh/views/simple_status...
this is the url, which it tries to load, and fails ;) normally there should just be the content of the block

#32

corona ronin - March 9, 2009 - 18:39

Should we make a request in the views queue to see if someone can take a better look at this?

#33

dunkelfuerst - March 9, 2009 - 19:42

yeah, why not, just try it

#34

corona ronin - May 11, 2009 - 21:29

We have paid a developer to make this functionality happen with views and panels. We are releasing the module to the community. Dunkelfuerst, I contacted you via drupal to see how we can make this happen. Please email me back and I will send you the module file.

Thanks, and hopefully this will help everyone!

Regards,

CR and the Lifeundersun.com team.

#35

mattbram - July 27, 2009 - 17:23

Was a solution to this issue ever found? I have a similar problem using Views and Panels. My block views auto-refresh properly when simply added to a node as a block. However, when I choose the same block view to appear in a panel, it will not refresh without a page reload. Are the Block Refresh and Panels modules not compatible?

Any help is appreciated.

Matt

#36

Protoactive - September 29, 2009 - 10:08

I toyed around with all the options on multiple threads and basically it works on Drupal 6 with these conditions. I had the modified 6.0 version installed, but I don't know if that helped.

1.Make the content a page. If there's php code in it, set input format to php. In our case it was an xml parser that took queries from a streaming server.
2.Create a view, add block and page to it, set your filters to "node: title" name of content (page, etc) you just made, "node: published" yes or no, etc. Save.
3.Don't put the block in the panel. Don't hide it in the panel, just don't have anything related with the block you want refreshed in the panel content layout at all. Arrange the page with panels, views, etc but avoid putting anything related with block you want refreshed in.
2.In Site building>Blocks>content:Block where content is the title of what you made in step 1, set the region dropdown from "none" to where you want it, In my case I put the "content:Block" block (which is by default "none") in the "content" section. You will decide what page it shows up on in the next step.
3.In Site building>Blocks>content:Block>configure you must configure the block to be refreshed to the page you want it listed on. In my case the content I entered in step 1 was a "song updater" based on a query to a server updated every 10 seconds so I placed it only on the front page by setting "Show on only the listed pages" and entering "frontpage" in the list of pages along with one other one so I can see it by itself.

*i also have the frontpage mod, for most drupal users "frontpage" would be "front"

On both pages the block was set to display on, it refreshed fine. Play around and see if it worked for you.

 
 

Drupal is a registered trademark of Dries Buytaert.