After session moderation occurs, we should clearly indicate when a session has been declined so that site visitors are aware of this fact.

This could be a simple bit of cod_session code that implements hook_node_view and adds themeable, polite text such as "This session has been declined" or "this session will not be presented at the conference." It would be nice to make this configurable.

Comments

primerg’s picture

Status: Active » Needs review
StatusFileSize
new1.53 KB

- Attached patch creates a new setting in the Structure > Content types > Session > Scheduling settings
- Adds a textarea field for the admin to enter their message. an empty message means they don't want to add the notice.
- The declined message will show above the content (that's why im using the hook_node_view_alter instead). I was thinking of either using drupal_set_message or adding it inside the body. The message only accepts plain message and it is wrapped by div with class "message session-declined"

saltednut’s picture

Status: Needs review » Needs work

Although it applied cleanly, I was getting a PDO Exception due to hook_node_view_alter being declared twice when I applied #1

Altered the patch to combine hook_node_view functions but I am not seeing these scheduling settings on the 'Session' content type.

sheldonkreger’s picture

The PDO Exception mentioned in #2 was caused by a mislabeled function inside of cod_session_evaluations.module: The hook_node_view_alter in that file was misnamed "cod_session_node_view_alter". So, I renamed it "cod_session_evaluations_node_view_alter", which eliminated the PDO exception.

I've also attached a screenshot of where the scheduling settings live inside of the Session content type. I can see them after I apply the patch in #1.

sheldonkreger’s picture

Status: Needs work » Needs review
dsdeiz’s picture

StatusFileSize
new35.09 KB

Hi! Works here as well. Wasn't able to test cod_session_evaluations error though since I can't install it.

dsdeiz’s picture

StatusFileSize
new1.58 KB

Got a notice saying Notice: Undefined index: field_accepted in cod_session_node_view_alter() (line 430 of /path/to/cod/profiles/cod/modules/cod_support/cod_session/cod_session.module). after viewing other content types.

primerg’s picture

Status: Needs review » Needs work

Testing the patch.

Testing
- enabled cod_bof and cod_sessions
- adding declined messages settings for bof and sessions. No error found
- testing and viewing node add for bof and sessions. No error found
- declining session proposal. No error found. The message appeared.
- declining bof proposal. FAILED. Not possible.

Because BoF doesn't have the field_status, so there is no reason to add this settings. So, I'm rethinking of the implementation of the declined message settings. Should it be at the field level settings? Thoughts?

dsdeiz’s picture

StatusFileSize
new1.99 KB

Hi, field level settings seems like a better way to do it. Here's my first take with field level settings.

saltednut’s picture

Status: Needs work » Needs review
StatusFileSize
new30.54 KB
new71.86 KB

@dsdeiz thanks for the patch. In the future, please use the [project_name]-[short-description]-[issue-number]-[comment-number].patch format for patches - we have a lot of them floating around so this makes it a little easier to keep track of whats going on.

Review: patch applies cleanly. I was able to add a message if the session is declined. If no message is set, there is no message. See screenshots. Looks good/seems logical to me.

Screen Shot 2012-07-10 at 10.07.13 AM.png
Screen Shot 2012-07-10 at 10.10.12 AM.png

sheldonkreger’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new87.67 KB

Patch in #8 is clean.

I did some additional testing. Here's a few scenarios:

Scenario 1

1. Log in as Authenticated user and create a Session.

2. Log in as Admin, edit the session, marking as "declined". Message shows.

3. Log back in as Authenticated user and visit the Session node. Message shows, and the Session is also marked as 'declined' inside of schedule info status (as in the above post)

4. Session is removed from the View at /program/sessions/proposed.

Scenario 2

1. Log in as Admin and create a Session, marking as "declined" while creating.

Works - error message shows as expected. Not sure why anyone would do this, though.

Scenario 3 - BoFs

BoFs do not have field_accepted, so this isn't going to work. Perhaps we can add field_accepted to BoFs. On the other hand, site admins can always remove BoFs manually. But this is outside the scope of this issue.

Patch in #8 looks good to me.

twardnw’s picture

BoFs are not moderated, so field_accepted would not be applicable.

Patch in #8 applies clean for me, any scenario with a declined session showed the declined message (perhaps we should establish a default for this field)

coltrane’s picture

Status: Reviewed & tested by the community » Needs work

I think it needs a default and a theme function so the markup can be overridden.

dsdeiz’s picture

Status: Needs work » Needs review
StatusFileSize
new2.73 KB

Used "This session has been declined." as default message and added theme function.

dsdeiz’s picture

Issue tags: +da_drupalcon

Tagging.

primerg’s picture

Status: Needs review » Needs work
Issue tags: -da_drupalcon

Let's use the cod_session prefix for the theme function just to be consistent.

dsdeiz’s picture

Updated.

dsdeiz’s picture

Status: Needs work » Needs review

Sorry, missed to change status.

mjonesdinero’s picture

Patch in #16 applies cleanly, it shows the decline message after updating the Status to declined

saltednut’s picture

Patch applied cleanly and works - just one note. This is an edge case, but if for some reason the 'node-session-body' field ("Description") is left empty, this will produce an error.

Notice: Undefined index: body in cod_session_node_view_alter() (line 455 of /cod_support/cod_session/cod_session.module).

This could probably be fixed using:

$build['body'][0]['#markup'] = theme('cod_session_declined_msg', array('msg' => $msg)) . @$build['body'][0]['#markup'];
coltrane’s picture

How about

$output = theme('cod_session_declined_msg', array('msg' => $msg));
if (isset($build['body'][0]['#markup'])) {
  $build['body'][0]['#markup'] = $output . $build['body'][0]['#markup'];
}
else {
  $build['body'][0]['#markup'] = $output;
}
saltednut’s picture

Yes, that is better.

Currently the "@" error-control operator prefix will even disable error reporting for critical errors that will terminate script execution. Among other things, this means that if you use "@" to suppress errors from a certain function and either it isn't available or has been mistyped, the script will die right there with no indication as to why.

http://www.php.net/manual/en/language.operators.errorcontrol.php

saltednut’s picture

Patch adds the check for Undefined index described in comment #19

sheldonkreger’s picture

Status: Needs review » Reviewed & tested by the community

#22 applies cleanly.

No more error message when body field is missing.

Message displays in both scenarios listed in #10, and declined sessions do not appear on the schedule. Good work!!!

mjonesdinero’s picture

patch on #22 applies cleanly.

Message displays as well as declined sessions don't appear on the schedule.

ezra-g’s picture

Status: Reviewed & tested by the community » Fixed

I modified the text slightly to say "This session has been declined by the session moderation team." so we provide some information about who took declined the session. This is committed. Thanks!

http://drupalcode.org/project/cod_support.git/commit/c92e13c

Automatically closed -- issue fixed for 2 weeks with no activity.