I've tried to setup different contexts to display a set message, but the message never actually gets displayed. I checked the page source to make sure it just wasn't being hidden by css or something else, but it's not. Regular drupal messages display fine, and everything else in the context (block visibility for instance) work fine. No errors in the logs. I know this doesn't give much to go on, but if you have any suggestions on things to try that might help, I'd be happy to test.

CommentFileSizeAuthor
#3 screenshot.png44.29 KBPCateNumbersUSA

Comments

rypit’s picture

Are you able to provide a screenshot of the context and reaction? Do you see the message if you are logged in vs anonymous?

rypit’s picture

Status: Active » Postponed (maintainer needs more info)

Could you also provide your PHP version? Thanks!

PCateNumbersUSA’s picture

StatusFileSize
new44.29 KB

No message either logged in or logged out. PHP version is 5.3.6. Screenshot is attached.

rypit’s picture

I'll assume that you have a valid context condition set. Can you provide the php version you're using?

Edit: Thanks. I'll be able to take a look at this soon! I'm thinking it may have something to do with some changes in 5.3 about the usage of pass-by-reference. If you have access to any error logs that would certainly help.

rypit’s picture

Status: Postponed (maintainer needs more info) » Active

Switching this to active as it seems probably that there is a problem with using pass by reference. Will confirm asap.

rypit’s picture

Status: Active » Postponed (maintainer needs more info)

Trying to reproduce this in php 5.3.6 with no luck.

Can you please add the following to context_set_message/plugins/context_set_message_reaction.inc and paste the results here:
after:
$message = isset($v->reactions[$this->plugin]['message']) ? $v->reactions[$this->plugin]['message'] : '';
add:
print_r($v->reactions[$this->plugin]);

... this will allow us to see if the plugin data is at least being loaded.

Thanks!

rypit’s picture

This doesn't seem to be a PHP issue. Could you please also post which versions of context and Drupal core you're using? Thanks again!

Side note: vanilla install with the following modules on PHP 5.3.6 works as intended:

 Drupal version         :  7.14 
 Context             Context (context)                                Module  Enabled        7.x-3.0-beta3    
 Context             Context Set Message (context_set_message)        Module  Enabled        7.x-1.0-alpha2 
 Context             Context UI (context_ui)                          Module  Enabled        7.x-3.0-beta3
 Other               Token (token)                                    Module  Enabled        7.x-1.1    
PCateNumbersUSA’s picture

Added print_r($v->reactions[$this->plugin]); as instructed and nothing printed. Here are the module versions I'm using:

Drupal: 7.14
Context: 7.x-3.0-beta3
Context UI: 7.x-3.0-beta3
Context Set Message: 7.x-1.0-alpha2
Token: 7.x-1.0-beta3

All the other context reactions are loading correctly, except for set_message.

rypit’s picture

Definitely appreciate your coming back here and posting details. I've downgraded my version of Token to match yours but the plugin is still working for me. Could you see if adding
print_r($this->get_contexts());
directly after the
function execute() {
line in context_set_message/plugins/context_set_message_reaction.inc? This should print out all of your applied contexts, and ideally should look something like this:

Array
(
    [test] => stdClass Object
        (
            [name] => test
            [description] => 
            [tag] => 
            [conditions] => Array
                (
                    [path] => Array
                        (
                            [values] => Array
                                (
                                    [<front>] => <front>
                                )

                        )

                )

            [reactions] => Array
                (
                    [set_message] => Array
                        (
                            [severity] => status
                            [message] => testing
                            [message_extra] => Array
                                (
                                    [hide_empty] => 1
                                )

                        )

                )

            [condition_mode] => 0
            [table] => context
            [type] => Normal
            [export_type] => 1
        )

)

If nothing prints here, it would lead me to believe that the plugin itself isn't being loaded. This may be a silly question, but have you tried clearing caches?

Thanks again!

PCateNumbersUSA’s picture

I added the line and all it printed was: Array ( ) I've cleared all the caches multiple times.

rypit’s picture

This is really strange. That means that no context reaction is occurring. Can you add a block with the same reaction and see if the same still prints? I've tried this on several environments now and am still unable to reproduce.

PCateNumbersUSA’s picture

OK, I setup a test context with the condition set to a specific path, and the set message as the only reaction, and the set message worked. I piece-by-piece added in the other conditions and reactions I had on my previous context and set message broke when I added in theme condition (http://drupal.org/project/context_condition_theme). Hopefully this will help you find out the cause of the conflict.

rypit’s picture

Do any other reactions break when this happens? Does the theme condition do anything that would hide a message from being displayed? Can you please paste the output of print_r($this->get_contexts()) as mentioned above both before and after you have the theme condition enabled? Thanks so much! I will try to recreate this ASAP.

rypit’s picture

Priority: Critical » Normal
Status: Postponed (maintainer needs more info) » Needs work

Found the issue here. Patch in the works. Thanks for all your reporting!

rypit’s picture

Status: Needs work » Closed (fixed)

Fixed in alpha3. Thanks again!

PCateNumbersUSA’s picture

Confirmed, it is working fine now. Thanks!